summaryrefslogtreecommitdiff
path: root/svtools/workben
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2000-09-18 16:07:07 +0000
commit8ab086b6cc054501bfbf7ef6fa509c393691e860 (patch)
tree324d51845d7f1a2f4e02a14db22fb5947137c822 /svtools/workben
parent411e68cc54ae97eebd79ae3a9cb2971b74cb2a9e (diff)
initial import
Diffstat (limited to 'svtools/workben')
-rw-r--r--svtools/workben/browser.cxx882
-rw-r--r--svtools/workben/cui/loadlib.cxx121
-rw-r--r--svtools/workben/cui/makefile.mk106
-rw-r--r--svtools/workben/makefile.mk180
-rw-r--r--svtools/workben/stest.cxx239
-rw-r--r--svtools/workben/svdem.cxx1176
-rw-r--r--svtools/workben/urange.cxx251
7 files changed, 2955 insertions, 0 deletions
diff --git a/svtools/workben/browser.cxx b/svtools/workben/browser.cxx
new file mode 100644
index 000000000000..593f13e22ce3
--- /dev/null
+++ b/svtools/workben/browser.cxx
@@ -0,0 +1,882 @@
+/*************************************************************************
+ *
+ * $RCSfile: browser.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#pragma hdrstop
+
+//#undef VCL
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _SV_SOUND_HXX //autogen
+#include <vcl/sound.hxx>
+#endif
+
+#ifndef _SV_MSGBOX_HXX //autogen
+#include <vcl/msgbox.hxx>
+#endif
+
+#ifndef _SV_FLOATWIN_HXX //autogen
+#include <vcl/floatwin.hxx>
+#endif
+
+#ifndef _SV_MENU_HXX //autogen
+#include <vcl/menu.hxx>
+#endif
+
+#ifndef _SV_WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+
+#ifndef _SV_EDIT_HXX //autogen
+#include <vcl/edit.hxx>
+#endif
+
+#ifndef _SVX_BRWBOX_HXX //autogen
+#include <brwbox.hxx>
+#endif
+
+#ifndef _SV_GROUP_HXX //autogen
+#include <vcl/group.hxx>
+#endif
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _SV_DIALOG_HXX //autogen
+#include <vcl/dialog.hxx>
+#endif
+
+#define MID_BROWSER 10
+#define MID_MODE 11
+#define MID_EVENTVIEW 12
+#define MID_INVALIDATE 13
+#define MID_CLEAR 14
+#define MID_ROW 20
+#define MID_INSERTROW_BEFORE 21
+#define MID_INSERTROW_AT 22
+#define MID_INSERTROW_BEHIND 23
+#define MID_REMOVEROW_BEFORE 24
+#define MID_REMOVEROW_AT 25
+#define MID_REMOVEROW_BEHIND 26
+#define MID_MODIFYROW_BEFORE 27
+#define MID_MODIFYROW_AT 28
+#define MID_MODIFYROW_BEHIND 29
+#define MID_COL 30
+#define MID_INSERTCOL 31
+#define MID_REMOVECOL 32
+#define MID_MOVECOLLEFT 33
+#define MID_MOVECOLRIGHT 34
+#define MID_SELECTIONS 60
+#define MID_SELECTROW 61
+#define MID_SELECTALL 62
+#define MID_SELECTNONE 63
+#define MID_INVERSE 64
+#define MID_EXTRAS 70
+#define MID_STARMONEY_1 71
+
+//==================================================================
+
+class BrowseModeDialog: public ModalDialog
+{
+ RadioButton aSingleSel;
+ RadioButton aMultiSel;
+ GroupBox aSelGroup;
+
+ CheckBox aKeepHighlight;
+ CheckBox aColumnCursor;
+ CheckBox aThumbDragging;
+ GroupBox aOptGroup;
+
+ RadioButton aNoHLines;
+ RadioButton aDottedHLines;
+ RadioButton aFullHLines;
+ GroupBox aHLinGroup;
+
+ RadioButton aNoVLines;
+ RadioButton aDottedVLines;
+ RadioButton aFullVLines;
+ GroupBox aVLinGroup;
+
+ OKButton aOKButton;
+ CancelButton aCancelButton;
+
+public:
+ BrowseModeDialog( Window *pParent );
+
+ void SetMode( BrowserMode eMode );
+ BrowserMode GetMode() const;
+};
+
+//==================================================================
+
+DECLARE_LIST(DataList,long);
+
+class Browser: public BrowseBox
+{
+friend class AppWindow;
+
+ DataList aRows;
+ BOOL bInverse;
+ Edit* pEdit;
+
+protected:
+ virtual long GetRowCount() const;
+ virtual BOOL SeekRow( long nRow );
+ virtual void PaintField( OutputDevice& rDev, const Rectangle& rRect,
+ USHORT nColumnId ) const;
+
+ virtual void Select();
+ virtual void DoubleClick();
+ virtual void CursorMoved();
+ virtual void StartScroll();
+ virtual void EndScroll();
+ virtual void Command( const CommandEvent &eEvt );
+
+ virtual BOOL StartDragging( Pointer& rMovePtr,
+ Pointer& rCopyPtr );
+ virtual void EndDragging( const DropAction &rAction );
+ virtual void MouseButtonDown( const BrowserMouseEvent &rEvt );
+
+public:
+ Browser( AppWindow* pParent, BrowserMode eMode );
+ ~Browser();
+
+ void SetInverseSelection( BOOL bInverseSel )
+ { bInverse = bInverseSel; }
+};
+
+//------------------------------------------------------------------
+
+class AppWindow: public WorkWindow
+{
+ MenuBar aMenu;
+ PopupMenu aBrwMenu, aRowMenu, aColMenu, aSelMenu, aExtMenu;
+ Edit aEdit;
+ Browser aBrowser;
+ BrowserMode eCurMode;
+ FloatingWindow *pEventView;
+ ULONG nNewRowNo;
+
+private:
+ DECL_LINK( Modify, void * );
+ DECL_LINK( MenuSelect, Menu * );
+
+protected:
+ void Resize();
+ void Activate();
+
+public:
+ AppWindow();
+ ~AppWindow();
+
+ void Event( const String &rEvent );
+};
+
+//------------------------------------------------------------------
+
+class App: public Application
+{
+protected:
+#ifdef VCL
+ void Main();
+#else
+ void Main( int, char *[] );
+#endif
+
+public:
+ App();
+ ~App();
+};
+
+//==================================================================
+
+App aApp;
+
+//==================================================================
+
+BrowseModeDialog::BrowseModeDialog( Window *pParent ):
+ ModalDialog( pParent, WinBits( WB_MOVEABLE | WB_CLOSEABLE | WB_SVLOOK ) ),
+
+ aSingleSel( this ),
+ aMultiSel( this ),
+ aSelGroup( this ),
+
+ aKeepHighlight( this ),
+ aColumnCursor( this ),
+ aThumbDragging( this ),
+ aOptGroup( this ),
+
+ aNoHLines( this ),
+ aDottedHLines( this ),
+ aFullHLines( this ),
+ aHLinGroup( this ),
+
+ aNoVLines( this, WinBits( WB_GROUP ) ),
+ aDottedVLines( this ),
+ aFullVLines( this ),
+ aVLinGroup( this ),
+
+ aOKButton( this ),
+ aCancelButton( this )
+{
+ SetOutputSizePixel( Size( 290, 220 ) );
+ SetText( String( "Browse Mode", RTL_TEXTENCODING_IBM_850 ) );
+
+ aSingleSel.SetText( String( "single", RTL_TEXTENCODING_IBM_850 ) );
+ aMultiSel.SetText( String( "multi", RTL_TEXTENCODING_IBM_850 ) );
+ aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aKeepHighlight.SetText( String( "keep highlight", RTL_TEXTENCODING_IBM_850 ) );
+ aColumnCursor.SetText( String( "column cursor", RTL_TEXTENCODING_IBM_850 ) );
+ aThumbDragging.SetText( String( "thumb dragging", RTL_TEXTENCODING_IBM_850 ) );
+ aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoHLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
+ aDottedHLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
+ aFullHLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
+ aHLinGroup.SetText( String( " Horizontal ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoVLines.SetText( String( "none", RTL_TEXTENCODING_IBM_850 ) );
+ aDottedVLines.SetText( String( "dotted", RTL_TEXTENCODING_IBM_850 ) );
+ aFullVLines.SetText( String( "full", RTL_TEXTENCODING_IBM_850 ) );
+ aVLinGroup.SetText( String( " Vertical ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aSingleSel.SetPosSizePixel( Point( 20, 30 ), Size( 80, 14 ) );
+ aMultiSel.SetPosSizePixel( Point( 20, 70 ), Size( 80, 14 ) );
+ aSelGroup.SetPosSizePixel( Point( 10, 10 ), Size( 100, 80 ) );
+ aSelGroup.SetText( String( " Selection ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aKeepHighlight.SetPosSizePixel( Point( 130, 30 ), Size( 140, 14 ) );
+ aColumnCursor.SetPosSizePixel( Point( 130, 50 ), Size( 140, 14 ) );
+ aThumbDragging.SetPosSizePixel( Point( 130, 70 ), Size( 140, 14 ) );
+ aOptGroup.SetPosSizePixel( Point( 120, 10 ), Size( 160, 80 ) );
+ aOptGroup.SetText( String( " Options ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoHLines.SetPosSizePixel( Point( 20, 120 ), Size( 80, 14 ) );
+ aDottedHLines.SetPosSizePixel( Point( 20, 140 ), Size( 80, 14 ) );
+ aFullHLines.SetPosSizePixel( Point( 20, 160 ), Size( 80, 14 ) );
+ aHLinGroup.SetPosSizePixel( Point( 10, 100 ), Size( 100, 80 ) );
+ aHLinGroup.SetText( String( " horizontal ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aNoVLines.SetPosSizePixel( Point( 130, 120 ), Size( 80, 14 ) );
+ aDottedVLines.SetPosSizePixel( Point( 130, 140 ), Size( 80, 14 ) );
+ aFullVLines.SetPosSizePixel( Point( 130, 160 ), Size( 80, 14 ) );
+ aVLinGroup.SetPosSizePixel( Point( 120, 100 ), Size( 100, 80 ) );
+ aVLinGroup.SetText( String( " vertical ", RTL_TEXTENCODING_IBM_850 ) );
+
+ aOKButton.SetPosSizePixel( Point( 10, 190 ), Size( 100, 22 ) );
+ aCancelButton.SetPosSizePixel( Point( 120, 190 ), Size( 100, 22 ) );
+
+ aSingleSel.Check();
+ aNoHLines.Check();
+ aNoVLines.Check();
+
+ aSingleSel.Show();
+ aMultiSel.Show();
+ aSelGroup.Show();
+
+ aKeepHighlight.Show();
+ aColumnCursor.Show();
+ aThumbDragging.Show();
+ aOptGroup.Show();
+
+ aNoHLines.Show();
+ aDottedHLines.Show();
+ aFullHLines.Show();
+ aHLinGroup.Show();
+
+ aNoVLines.Show();
+ aDottedVLines.Show();
+ aFullVLines.Show();
+ aVLinGroup.Show();
+
+ aOKButton.Show();
+ aCancelButton.Show();
+}
+
+//------------------------------------------------------------------
+
+void BrowseModeDialog::SetMode( BrowserMode eMode )
+{
+ if ( ( eMode & BROWSER_COLUMNSELECTION ) == BROWSER_COLUMNSELECTION )
+ aColumnCursor.Check();
+ if ( ( eMode & BROWSER_MULTISELECTION ) == BROWSER_MULTISELECTION )
+ aMultiSel.Check();
+ if ( ( eMode & BROWSER_THUMBDRAGGING ) == BROWSER_THUMBDRAGGING )
+ aThumbDragging.Check();
+ if ( ( eMode & BROWSER_KEEPHIGHLIGHT ) == BROWSER_KEEPHIGHLIGHT )
+ aKeepHighlight.Check();
+ if ( ( eMode & BROWSER_HLINESFULL ) == BROWSER_HLINESFULL )
+ aFullHLines.Check();
+ if ( ( eMode & BROWSER_VLINESFULL ) == BROWSER_VLINESFULL )
+ aFullVLines.Check();
+ if ( ( eMode & BROWSER_HLINESDOTS ) == BROWSER_HLINESDOTS )
+ aDottedHLines.Check();
+ if ( ( eMode & BROWSER_VLINESDOTS ) == BROWSER_VLINESDOTS )
+ aDottedVLines.Check();
+}
+
+//------------------------------------------------------------------
+
+BrowserMode BrowseModeDialog::GetMode() const
+{
+ BrowserMode eMode = 0;
+
+ if ( aColumnCursor.IsChecked() )
+ eMode |= BROWSER_COLUMNSELECTION;
+ if ( aMultiSel.IsChecked() )
+ eMode |= BROWSER_MULTISELECTION;
+
+ if ( aKeepHighlight.IsChecked() )
+ eMode |= BROWSER_KEEPHIGHLIGHT;
+ if ( aThumbDragging.IsChecked() )
+ eMode |= BROWSER_THUMBDRAGGING;
+
+ if ( aDottedHLines.IsChecked() )
+ eMode |= BROWSER_HLINESDOTS;
+ if ( aFullHLines.IsChecked() )
+ eMode |= BROWSER_HLINESFULL;
+
+ if ( aDottedVLines.IsChecked() )
+ eMode |= BROWSER_VLINESDOTS;
+ if ( aFullVLines.IsChecked() )
+ eMode |= BROWSER_VLINESFULL;
+
+ return eMode;
+}
+
+//==================================================================
+
+Browser::Browser( AppWindow* pParent, BrowserMode eMode ):
+ BrowseBox( pParent, WinBits(WB_DRAG), eMode ),
+ bInverse(FALSE),
+ pEdit( 0 )
+{
+ for ( long n = 0; n < 100; ++n )
+ aRows.Insert( n, LIST_APPEND );
+
+ //InsertHandleColumn( 30 );
+ InsertDataColumn( 1, String( "eins", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 1 );
+ InsertDataColumn( 2, String( "zwei", RTL_TEXTENCODING_IBM_850 ), 85 ); // FreezeColumn( 2 );
+ InsertDataColumn( 3, String( "drei", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 4, String( "vier", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 5, String( "fuenf", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 6, String( "sechs", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 7, String( "sieben", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 8, String( "acht", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn( 9, String( "neun", RTL_TEXTENCODING_IBM_850 ), 85 );
+ InsertDataColumn(10, String( "zehn", RTL_TEXTENCODING_IBM_850 ), 85 );
+}
+
+//------------------------------------------------------------------
+
+Browser::~Browser()
+{
+ delete pEdit;
+}
+
+//------------------------------------------------------------------
+
+BOOL Browser::StartDragging( Pointer& rMovePtr, Pointer& rCopyPtr )
+{
+ rMovePtr = Pointer( POINTER_MOVEDATA );
+ rCopyPtr = Pointer( POINTER_COPYDATA );
+ return TRUE;
+}
+
+//------------------------------------------------------------------
+
+void Browser::MouseButtonDown( const BrowserMouseEvent &rEvt )
+{
+ if ( 3 == rEvt.GetClicks() )
+ InfoBox( 0, String( GetColumnAtXPosPixel(rEvt.GetPosPixel().X() ) ) ).Execute();
+ else
+ BrowseBox::MouseButtonDown( rEvt );
+}
+
+//------------------------------------------------------------------
+
+void Browser::EndDragging( const DropAction &rAction )
+{
+}
+
+//------------------------------------------------------------------
+
+void Browser::StartScroll()
+{
+ ( (AppWindow*) GetParent() )->Event( String( "StartScroll", RTL_TEXTENCODING_IBM_850 ) );
+ if ( pEdit )
+ pEdit->Hide();
+ BrowseBox::StartScroll();
+}
+
+//------------------------------------------------------------------
+
+void Browser::EndScroll()
+{
+ BrowseBox::EndScroll();
+ ( (AppWindow*) GetParent() )->Event( String( "EndScroll", RTL_TEXTENCODING_IBM_850 ) );
+ if ( pEdit )
+ pEdit->Show();
+}
+//------------------------------------------------------------------
+
+void Browser::Command( const CommandEvent &rEvt )
+{
+ String aEvent( String( "Command at ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += rEvt.GetMousePosPixel().X();
+ aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
+ aEvent += rEvt.GetMousePosPixel().Y();
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+ BrowseBox::Command(rEvt);
+}
+
+//------------------------------------------------------------------
+
+void Browser::Select()
+{
+ String aEvent( String( "Select: ", RTL_TEXTENCODING_IBM_850 ) );
+ DELETEZ(pEdit);
+ for ( long nRow = FirstSelectedRow(bInverse); nRow >= 0; nRow = NextSelectedRow() )
+ {
+ if ( bInverse )
+ aEvent += String( String( "~", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( nRow );
+ aEvent += String( ", ", RTL_TEXTENCODING_IBM_850 );
+ }
+ aEvent.Erase( aEvent.Len() - 2 );
+
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+}
+
+//------------------------------------------------------------------
+
+void Browser::DoubleClick()
+{
+ String aEvent( String( "DoubleClick: ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( GetCurRow() );
+ aEvent += String( String( ", ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( FirstSelectedRow() );
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+
+ SetNoSelection();
+ if ( !pEdit )
+ pEdit = new Edit( &GetDataWindow() );
+ Rectangle aRect( GetFieldRect( GetCurColumnId() ) );
+ pEdit->SetPosSizePixel( aRect.TopLeft(), aRect.GetSize() );
+ pEdit->Show();
+ pEdit->GrabFocus();
+}
+
+//------------------------------------------------------------------
+
+void Browser::CursorMoved()
+{
+ String aEvent( String( "Cursor: ", RTL_TEXTENCODING_IBM_850 ) );
+ aEvent += String( GetCurRow() );
+ aEvent += String( ":", RTL_TEXTENCODING_IBM_850 );
+ aEvent += String( GetCurColumnId() );
+ ( (AppWindow*) GetParent() )->Event( aEvent );
+ if ( IsFieldVisible( GetCurRow(), GetCurColumnId(), TRUE ) )
+ ( (AppWindow*) GetParent() )->Event( String( "completely visible", RTL_TEXTENCODING_IBM_850 ) );
+ else if ( IsFieldVisible( 1, GetCurColumnId(), FALSE) )
+ ( (AppWindow*) GetParent() )->Event( String( "partly visible", RTL_TEXTENCODING_IBM_850 ) );
+ else
+ ( (AppWindow*) GetParent() )->Event( String( "not visible", RTL_TEXTENCODING_IBM_850 ) );
+
+ DELETEZ(pEdit);
+}
+
+//------------------------------------------------------------------
+
+long Browser::GetRowCount() const
+{
+ return aRows.Count();
+}
+
+//------------------------------------------------------------------
+
+BOOL Browser::SeekRow( long nRow )
+{
+ if ( nRow >= 0 && nRow < (long) aRows.Count() )
+ {
+ aRows.Seek(nRow);
+ return TRUE;
+ }
+ return FALSE;
+}
+
+//------------------------------------------------------------------
+
+void Browser::PaintField( OutputDevice& rDev, const Rectangle& rRect,
+ USHORT nColumnId ) const
+{
+ rDev.SetClipRegion( rRect );
+ String aText( aRows.GetCurObject() );
+ aText += String( ".", RTL_TEXTENCODING_IBM_850 );
+ aText += String( nColumnId );
+ rDev.DrawText( rRect.TopLeft(), aText );
+}
+
+//==================================================================
+
+AppWindow::AppWindow():
+ WorkWindow( 0, WinBits(WB_APP|WB_STDWORK) ),
+ aEdit( this, WinBits( WB_BORDER ) ),
+ aBrowser( this, 0 ),
+ eCurMode( 0 ),
+ pEventView( 0 ),
+ nNewRowNo( 2000L )
+{
+ SetText( String( "BrowseBox Testframe", RTL_TEXTENCODING_IBM_850 ) );
+
+ aMenu.InsertItem( MID_BROWSER, String( "~Browser", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_BROWSER, &aBrwMenu );
+ aBrwMenu.InsertItem( MID_MODE, String( "~Mode...", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertItem( MID_EVENTVIEW, String( "~Event-Viewer", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertSeparator();
+ aBrwMenu.InsertItem( MID_INVALIDATE, String( "~Invalidate", RTL_TEXTENCODING_IBM_850 ) );
+ aBrwMenu.InsertItem( MID_CLEAR, String( "~Clear", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_ROW, String( "~Row", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_ROW, &aRowMenu );
+ aRowMenu.InsertItem( MID_INSERTROW_BEFORE, String( "Insert before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_INSERTROW_AT, String( "~Insert at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_INSERTROW_BEHIND, String( "~Insert behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertSeparator();
+ aRowMenu.InsertItem( MID_REMOVEROW_BEFORE, String( "Remove before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_REMOVEROW_AT, String( "~Remove at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_REMOVEROW_BEHIND, String( "~Remove behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertSeparator();
+ aRowMenu.InsertItem( MID_MODIFYROW_BEFORE, String( "Modify before current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_MODIFYROW_AT, String( "~Modify at current", RTL_TEXTENCODING_IBM_850 ) );
+ aRowMenu.InsertItem( MID_MODIFYROW_BEHIND, String( "~Modify behind current", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_COL, String( "~Column", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_COL, &aColMenu );
+ aColMenu.InsertItem( MID_INSERTCOL, String( "~Insert", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_REMOVECOL, String( "Re~move", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_MOVECOLLEFT, String( "Move ~Left", RTL_TEXTENCODING_IBM_850 ) );
+ aColMenu.InsertItem( MID_MOVECOLRIGHT, String( "Move ~Right", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.InsertItem( MID_SELECTIONS, String( "Selections", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_SELECTIONS, &aSelMenu );
+ aSelMenu.InsertItem( MID_SELECTROW, String( "Row", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_SELECTALL, String( "All", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_SELECTNONE, String( "None", RTL_TEXTENCODING_IBM_850 ) );
+ aSelMenu.InsertItem( MID_INVERSE, String( "Inverse", RTL_TEXTENCODING_IBM_850 ), MENU_APPEND, MIB_CHECKABLE );
+ aMenu.InsertItem( MID_EXTRAS, String( "Extras", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.SetPopupMenu( MID_EXTRAS, &aExtMenu );
+ aExtMenu.InsertItem( MID_STARMONEY_1, String( "StarMoney: SelectRow(+1)+DeleteRow", RTL_TEXTENCODING_IBM_850 ) );
+ aMenu.PushSelectHdl( LINK(this, AppWindow, MenuSelect) );
+
+ aEdit.SetModifyHdl( LINK(this,AppWindow,Modify) );
+
+ aEdit.Show();
+ aBrowser.Show();
+ Show();
+}
+
+//------------------------------------------------------------------
+
+AppWindow::~AppWindow()
+{
+ GetpApp()->SetAppMenu( 0 );
+ if ( pEventView )
+ delete pEventView;
+}
+
+//------------------------------------------------------------------
+
+IMPL_LINK_INLINE_START( AppWindow, Modify, void *, pCaller )
+{
+ Edit *pEdit = (Edit*) pCaller;
+ aBrowser.GoToRow( pEdit->GetText().ToInt32() );
+ aBrowser.GrabFocus();
+
+ return TRUE;
+}
+IMPL_LINK_INLINE_END( AppWindow, Modify, void *, pCaller )
+
+//------------------------------------------------------------------
+
+IMPL_LINK( AppWindow, MenuSelect, Menu *, pMenu )
+{
+ ULONG nPos;
+
+ switch ( pMenu->GetCurItemId() )
+ {
+ case MID_MODE:
+ {
+ BrowseModeDialog *pDlg = new BrowseModeDialog( this );
+ pDlg->SetMode( eCurMode );
+ if ( pDlg->Execute() == RET_OK )
+ {
+ eCurMode = pDlg->GetMode();
+ aBrowser.SetMode( eCurMode | BROWSER_AUTOSIZE_LASTCOL );
+ }
+ delete pDlg;
+ break;
+ }
+
+ case MID_INVALIDATE:
+ aBrowser.Invalidate();
+ break;
+
+ case MID_INSERTROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( aBrowser.GetCurRow()-1 );
+ break;
+
+ case MID_INSERTROW_AT:
+ nPos = aBrowser.GetCurRow();
+ if ( nPos == BROWSER_ENDOFSELECTION )
+ nPos = 0;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( nPos );
+ break;
+
+ case MID_INSERTROW_BEHIND:
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Insert( nNewRowNo++, nPos );
+ aBrowser.RowInserted( nPos );
+ break;
+
+ case MID_REMOVEROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_REMOVEROW_AT:
+ nPos = aBrowser.GetCurRow();
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_REMOVEROW_BEHIND:
+ if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+
+ case MID_MODIFYROW_BEFORE:
+ if ( aBrowser.GetCurRow() == 0 )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() - 1;
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_MODIFYROW_AT:
+ nPos = aBrowser.GetCurRow();
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_MODIFYROW_BEHIND:
+ if ( (aBrowser.GetCurRow()+1) >= aBrowser.GetRowCount() )
+ {
+ Sound::Beep();
+ break;
+ }
+ nPos = aBrowser.GetCurRow() + 1;
+ aBrowser.aRows.Replace( nNewRowNo++, nPos );
+ aBrowser.RowModified( nPos );
+ break;
+
+ case MID_EVENTVIEW:
+ if ( pEventView )
+ {
+ delete pEventView;
+ pEventView = 0;
+ }
+ else
+ {
+ pEventView = new FloatingWindow( this );
+ pEventView->SetPosPixel( Point( 100, 100 ) );
+ pEventView->SetOutputSizePixel(
+ Size( 320, 8*GetTextHeight() ) );
+ pEventView->Show();
+ aBrowser.CursorMoved();
+ aBrowser.Select();
+ }
+ break;
+
+ case MID_SELECTROW:
+ aBrowser.SelectRow( aBrowser.GetCurRow(),
+ !aBrowser.IsRowSelected( aBrowser.GetCurRow() ) );
+ break;
+
+ case MID_SELECTALL:
+ aBrowser.SelectAll();
+ break;
+
+ case MID_SELECTNONE:
+ aBrowser.SetNoSelection();
+ break;
+
+ case MID_INVERSE:
+ {
+ BOOL bChecked = pMenu->IsItemChecked( MID_INVERSE );
+ pMenu->CheckItem( MID_INVERSE, !bChecked );
+ aBrowser.SetInverseSelection( !bChecked );
+ break;
+ }
+
+ case MID_CLEAR:
+ aBrowser.Clear();
+ break;
+
+ case MID_STARMONEY_1:
+ {
+ nPos = aBrowser.GetCurRow();
+ aBrowser.SelectRow( nPos + 1, TRUE );
+ aBrowser.aRows.Remove( nPos );
+ aBrowser.RowRemoved( nPos );
+ break;
+ }
+ }
+
+ return TRUE;
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Resize()
+{
+ Size aOutSz( GetOutputSizePixel() );
+
+ aEdit.SetPosSizePixel(
+ Point( 0, 0 ),
+ Size( aOutSz.Width(), 24 ) );
+
+ aBrowser.SetPosSizePixel(
+ Point( 0, aEdit.GetSizePixel().Height() ),
+ Size( aOutSz.Width(), aOutSz.Height() - 24 ) );
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Activate()
+{
+ GetpApp()->SetAppMenu( &aMenu );
+ aBrowser.GrabFocus();
+}
+
+//------------------------------------------------------------------
+
+void AppWindow::Event( const String &rEvent )
+{
+ if ( pEventView )
+ {
+ pEventView->Scroll( 0, -GetTextHeight() );
+ pEventView->Update();
+ pEventView->DrawText( Point(0, 7*GetTextHeight() ), rEvent );
+ }
+}
+
+//==================================================================
+
+App::App()
+{
+}
+
+//------------------------------------------------------------------
+
+App::~App()
+{
+}
+
+//------------------------------------------------------------------
+
+#ifdef VCL
+void App::Main( )
+#else
+void App::Main( int, char *[] )
+#endif
+{
+ EnableSVLook();
+
+ AppWindow aAppWin;
+
+
+ Execute();
+}
+
diff --git a/svtools/workben/cui/loadlib.cxx b/svtools/workben/cui/loadlib.cxx
new file mode 100644
index 000000000000..8fdca9e60b62
--- /dev/null
+++ b/svtools/workben/cui/loadlib.cxx
@@ -0,0 +1,121 @@
+/*************************************************************************
+ *
+ * $RCSfile: loadlib.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <tools/string.hxx>
+#include <libcall.hxx>
+
+
+extern "C" {
+
+struct VersionInfo
+{
+ char aTime[20];
+ char aDate[20];
+ char aUpd[5];
+ char aMinor;
+ char aBuild[5];
+#if SUPD>564
+ char aInpath[20];
+#endif
+};
+
+#ifdef WNT
+__declspec(dllexport)
+#endif
+ VersionInfo *GetVersionInfo();
+};
+
+typedef VersionInfo*(__LOADONCALLAPI *PFUNC)(void);
+
+int __LOADONCALLAPI main( int argc, char **argv )
+{
+ VersionInfo *pInfo = 0L;
+ PFUNC pFunc;
+
+ if ( argc != 2 )
+ {
+ fprintf( stderr, "USAGE: %s DllName \n", argv[0] );
+ exit(0);
+ }
+ SvLibrary aLibrary(argv[1]);
+ pFunc = (PFUNC) aLibrary.GetFunction( "GetVersionInfo" );
+ if ( pFunc )
+ pInfo = (*pFunc)();
+ if ( pInfo )
+ {
+ fprintf( stdout, "Date : %s\n", pInfo->aDate );
+ fprintf( stdout, "Time : %s\n", pInfo->aTime );
+ fprintf( stdout, "UPD : %s\n", pInfo->aUpd );
+ fprintf( stdout, "Minor : %c\n", pInfo->aMinor );
+ fprintf( stdout, "Build : %s\n", pInfo->aBuild );
+#if SUPD>564
+ fprintf( stdout, "Inpath : %s\n", pInfo->aInpath );
+#endif
+ }
+ else
+ fprintf( stderr, "VersionInfo not Found !\n" );
+ return 0;
+}
+
diff --git a/svtools/workben/cui/makefile.mk b/svtools/workben/cui/makefile.mk
new file mode 100644
index 000000000000..1fd22a706d60
--- /dev/null
+++ b/svtools/workben/cui/makefile.mk
@@ -0,0 +1,106 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..$/..
+
+PRJNAME=SVTOOLS
+TARGET=cuidem
+LIBTARGET=NO
+
+TARGETTYPE=CUI
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/loadlib.obj
+
+APP4TARGET= dllver
+.IF "$(GUI)" != "MAC"
+APP4STDLIBS= \
+ $(SVMEMLIB) \
+ $(SVTOOLLIB) \
+ $(SVLLIB) \
+ $(SVLIB) \
+ $(TOOLSLIB) \
+ $(VOSLIB) \
+ $(SALLIB)
+.IF "$(GUI)"=="WNT" || "$(COM)"=="GCC"
+APP4STDLIBS+= $(CPPULIB)
+.ENDIF
+.ELSE
+APP4STDLIBS=$(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+APP4LIBS = $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+ $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+APP4OBJS= $(OBJ)$/loadlib.obj
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
+
diff --git a/svtools/workben/makefile.mk b/svtools/workben/makefile.mk
new file mode 100644
index 000000000000..08ab359143dc
--- /dev/null
+++ b/svtools/workben/makefile.mk
@@ -0,0 +1,180 @@
+#*************************************************************************
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.1.1.1 $
+#
+# last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+#
+# The Contents of this file are made available subject to the terms of
+# either of the following licenses
+#
+# - GNU Lesser General Public License Version 2.1
+# - Sun Industry Standards Source License Version 1.1
+#
+# Sun Microsystems Inc., October, 2000
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2000 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#
+# Sun Industry Standards Source License Version 1.1
+# =================================================
+# The contents of this file are subject to the Sun Industry Standards
+# Source License Version 1.1 (the "License"); You may not use this file
+# except in compliance with the License. You may obtain a copy of the
+# License at http://www.openoffice.org/license.html.
+#
+# Software provided under this License is provided on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+# See the License for the specific provisions governing your rights and
+# obligations concerning the Software.
+#
+# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+#
+# Copyright: 2000 by Sun Microsystems, Inc.
+#
+# All Rights Reserved.
+#
+# Contributor(s): _______________________________________
+#
+#
+#
+#*************************************************************************
+
+PRJ=..
+
+PRJNAME=SVTOOLS
+TARGET=svdem
+LIBTARGET=NO
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE : svpre.mk
+.INCLUDE : settings.mk
+.INCLUDE : sv.mk
+
+# --- Files --------------------------------------------------------
+
+OBJFILES= $(OBJ)$/svdem.obj
+# removed, because these files aren't ported to Unicode
+# $(OBJ)$/browser.obj \
+# $(OBJ)$/stest.obj \
+# $(OBJ)$/grptest.obj
+
+APP1TARGET= $(TARGET)
+.IF "$(GUI)" != "MAC"
+APP1STDLIBS= $(SVTOOLLIB) \
+ $(SVLIB) \
+ $(TOOLSLIB) \
+ $(SALLIB) \
+ $(VOSLIB) \
+ $(CPPULIB)
+.ELSE
+APP1STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+ $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+APP1LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+ $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+APP1DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/_svt.lib
+.ENDIF
+APP1OBJS= $(OBJ)$/svdem.obj
+APP1STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP2TARGET= browser
+.IF "$(GUI)" != "MAC"
+#APP2STDLIBS= $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(CPPULIB)
+.ELSE
+#APP2STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP2LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP2DEPN= $(LB)$/_svt.lib $(L)$/itools.lib $(SVLIBDEPEND)
+.ENDIF
+#APP2OBJS= $(OBJ)$/browser.obj
+#APP2STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP3TARGET= stest
+.IF "$(GUI)" != "MAC"
+#APP3STDLIBS= $(SVMEMLIB) \
+# $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(SVLLIB) \
+# $(CPPULIB)
+.ELSE
+#APP3STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP3LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP3DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/svmem.lib $(LB)$/_svt.lib
+.ENDIF
+#APP3OBJS= $(OBJ)$/stest.obj
+#APP3STACK= 32768
+
+# removed, because these files aren't ported to Unicode
+#APP4TARGET= grptest
+.IF "$(GUI)" != "MAC"
+#APP4STDLIBS= $(SVMEMLIB) \
+# $(SVTOOLLIB) \
+# $(SVLIB) \
+# $(SALLIB) \
+# $(TOOLSLIB) \
+# $(VOSLIB) \
+# $(CPPULIB)
+.ELSE
+#APP4STDLIBS= $(SOLARBINDIR)$/TL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/VCL$(UPD)$(DLLPOSTFIX).DLL \
+# $(SOLARBINDIR)$/SVT$(UPD)$(DLLPOSTFIX).DLL
+#APP4LIBS= $(SOLARLIBDIR)$/SALMAIN.MAC.LIB \
+# $(SOLARLIBDIR)$/NOSHAREDMAIN.LIB
+.ENDIF
+.IF "$(GUI)" != "MAC"
+#APP4DEPN= $(L)$/itools.lib $(SVLIBDEPEND) $(LB)$/svmem.lib $(LB)$/_svt.lib
+.ENDIF
+#APP4OBJS= $(OBJ)$/grptest.obj
+#APP4STACK= 32768
+
+
+.IF "$(GUI)" == "MAC"
+MACRES = $(SV_RES)SV.R $(SV_RES)SV_DEMO.R $(SV_RES)SV_POWER.R
+.ENDIF
+
+# --- Targets -------------------------------------------------------
+
+.INCLUDE : target.mk
diff --git a/svtools/workben/stest.cxx b/svtools/workben/stest.cxx
new file mode 100644
index 000000000000..83d946a7a4bf
--- /dev/null
+++ b/svtools/workben/stest.cxx
@@ -0,0 +1,239 @@
+/*************************************************************************
+ *
+ * $RCSfile: stest.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#ifdef VCL
+#include <svmedit.hxx>
+#endif
+
+#ifndef _TXTCMP_HXX //autogen
+#include <txtcmp.hxx>
+#endif
+
+#ifndef _SV_BUTTON_HXX //autogen
+#include <vcl/button.hxx>
+#endif
+
+#ifndef _SV_WRKWIN_HXX //autogen
+#include <vcl/wrkwin.hxx>
+#endif
+
+#ifndef _SV_FIXED_HXX //autogen
+#include <vcl/fixed.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+
+class MyApp : public Application
+{
+public:
+#ifndef VCL
+ virtual void Main( int, char*[] );
+#else
+ virtual void Main( );
+#endif
+};
+
+class SearchWindow : public WorkWindow
+{
+ PushButton aPB;
+ FixedText aFT1, aFT2, aFT3;
+ MultiLineEdit aEText, aESrch;
+ RadioButton aModeN, aModeR, aModeL;
+ SearchParam aParam;
+
+public:
+ SearchWindow();
+
+ DECL_LINK( ClickHdl, Button * );
+};
+
+// --- SearchWindow::SearchWindow() ------------------------------------
+
+SearchWindow::SearchWindow() :
+ WorkWindow( NULL, WinBits( WB_APP | WB_STDWORK )),
+ aPB( this, WinBits( 0 )),
+ aFT1( this, WinBits( 0 )),
+ aFT2( this, WinBits( 0 )),
+ aFT3( this, WinBits( 0 )),
+ aEText( this, WinBits( WB_BORDER )),
+ aESrch( this, WinBits( WB_BORDER )),
+ aModeN( this, WinBits( 0 )),
+ aModeR( this, WinBits( 0 )),
+ aModeL( this, WinBits( 0 )),
+ aParam( "" )
+{
+ aPB.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeN.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeR.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+ aModeL.SetClickHdl( LINK( this, SearchWindow, ClickHdl ));
+
+ SetMapMode( MapMode( MAP_APPFONT ));
+ SetSizePixel( LogicToPixel( Size( 300, 180 ) ) );
+
+ aEText.SetPosSizePixel( LogicToPixel( Point( 0, 22 )), LogicToPixel(Size( 270, 32 )) );
+ aFT1.SetPosSizePixel( LogicToPixel( Point( 0, 10 )), LogicToPixel(Size( 18, 11 )) );
+ aFT2.SetPosSizePixel( LogicToPixel( Point( 0, 60 )), LogicToPixel(Size( 24, 10 )) );
+ aESrch.SetPosSizePixel( LogicToPixel( Point( 0, 70 )), LogicToPixel(Size( 270, 24 )) );
+ aPB.SetPosSizePixel( LogicToPixel( Point( 223, 139 )), LogicToPixel(Size( 48, 12 )) );
+ aFT3.SetPosSizePixel( LogicToPixel( Point( 0, 104 )), LogicToPixel(Size( 270, 15 )) );
+ aModeN.SetPosSizePixel( LogicToPixel( Point( 5, 116 ) ), LogicToPixel( Size( 40, 12 ) ) );
+ aModeR.SetPosSizePixel( LogicToPixel( Point( 5, 126 ) ), LogicToPixel( Size( 40, 12 ) ) );
+ aModeL.SetPosSizePixel( LogicToPixel( Point( 5, 136 ) ), LogicToPixel( Size( 40, 12 ) ) );
+
+ aEText.Show();
+ aFT1.Show();
+ aFT2.Show();
+ aESrch.Show();
+ aPB.Show();
+ aFT3.Show();
+ aModeN.Show();
+ aModeR.Show();
+ aModeL.Show();
+
+ aFT3.SetText( "gefunden:" );
+ aFT1.SetText( "Text:" );
+ aFT2.SetText( "Suche:" );
+ aPB.SetText( "starte Suche" );
+ aModeN.SetText( "normal" );
+ aModeR.SetText( "RegExp" );
+ aModeL.SetText( "LevDis" );
+
+ SetText( "Such-Demo" );
+}
+
+
+// --- SearchWindow::SearchSelectHdl() ---------------------------------
+
+IMPL_LINK( SearchWindow, ClickHdl, Button *, pButton )
+{
+ if( pButton == &aPB )
+ {
+ String sText( aEText.GetText() );
+ String sSrch( aESrch.GetText() );
+
+/* InfoBox( this, String( "T: " ) + sText +
+ String( "\nS: " ) + sSrch ).Execute();
+*/
+ BOOL bRet = FALSE;
+ USHORT nStt = 0, nEnd = sText.Len();
+
+ {
+ aParam.SetSrchStr( sSrch );
+ SearchText aSrchText( aParam, GetpApp()->GetAppInternational() );
+ bRet = aSrchText.SearchFrwrd( sText, &nStt, &nEnd );
+
+// BOOL SearchBkwrd( const String &rStr, USHORT* pStart, USHORT* pEnde );
+ }
+
+ String sFound( "gefunden" );
+ if( !bRet )
+ sFound.Insert( "nicht ", 0 );
+
+ sFound += ": S<";
+ sFound += nStt;
+ sFound += "> E<";
+ sFound += nEnd;
+ sFound += '>';
+
+ if( bRet )
+ {
+ sFound += '<';
+ sFound += sText.Copy( nStt, nEnd - nStt +1 );
+ sFound += '>';
+ }
+
+ aFT3.SetText( sFound );
+ }
+ else if( pButton == &aModeN )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_NORMAL );
+ }
+ else if( pButton == &aModeR )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_REGEXP );
+ }
+ else if( pButton == &aModeL )
+ {
+ aParam.SetSrchType( SearchParam::SRCH_LEVDIST );
+ }
+ return 0;
+}
+
+
+// --- MyApp::Main() -----------------------------------------------
+
+#ifndef VCL
+void MyApp::Main( int, char*[] )
+#else
+void MyApp::Main( )
+#endif
+{
+ SearchWindow* pSearchWindow = new SearchWindow;
+ pSearchWindow->Show();
+ Execute();
+ delete pSearchWindow;
+
+}
+
+// --- aMyApp ------------------------------------------------------
+
+MyApp aMyApp;
diff --git a/svtools/workben/svdem.cxx b/svtools/workben/svdem.cxx
new file mode 100644
index 000000000000..9de046fae423
--- /dev/null
+++ b/svtools/workben/svdem.cxx
@@ -0,0 +1,1176 @@
+/*************************************************************************
+ *
+ * $RCSfile: svdem.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+#include <vcl/wrkwin.hxx>
+#include <vcl/dialog.hxx>
+#include <vcl/msgbox.hxx>
+#include <vcl/drag.hxx>
+#include <vcl/print.hxx>
+#include <vcl/svapp.hxx>
+#include <vcl/help.hxx>
+#include <vcl/fixed.hxx>
+#include <vcl/button.hxx>
+#include <vcl/scrbar.hxx>
+#include <vcl/slider.hxx>
+#include <vcl/group.hxx>
+#include <vcl/toolbox.hxx>
+#include <vcl/status.hxx>
+#include <stdmenu.hxx>
+#include <ctrltool.hxx>
+#include <ctrlbox.hxx>
+#include <tabbar.hxx>
+#include <valueset.hxx>
+#include <headbar.hxx>
+#include <prgsbar.hxx>
+#include <calendar.hxx>
+#include <prnsetup.hxx>
+#include <printdlg.hxx>
+
+// -----------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main();
+};
+
+// -----------------------------------------------------------------------
+
+class ShowBitmap : public WorkWindow
+{
+ Bitmap aBmp;
+
+public:
+ ShowBitmap( Window* pParent, const Bitmap& rBmp );
+
+ virtual void Paint( const Rectangle& );
+ virtual BOOL Close();
+};
+
+// -----------------------------------------------------------------------
+
+class ShowFont : public Control
+{
+public:
+ ShowFont( Window* pParent );
+
+ virtual void Paint( const Rectangle& );
+ void SetFont( const Font& rFont )
+ { Invalidate(); Control::SetFont( rFont ); }
+};
+
+// --- class OrientSlider ------------------------------------------------
+
+class OrientSlider : public Slider
+{
+public:
+ OrientSlider( Window* pParent );
+
+ short GetOrientation() const { return (short)GetThumbPos(); }
+};
+
+// -----------------------------------------------------------------------
+
+OrientSlider::OrientSlider( Window* pParent ) :
+ Slider( pParent, WB_HORZ | WB_DRAG )
+{
+ SetThumbPos( 0 );
+ SetLineSize( 10 );
+ SetPageSize( 100 );
+ SetRange( Range( 0, 3600 ) );
+}
+
+// -----------------------------------------------------------------------
+
+class MyFontDialog : public ModalDialog
+{
+private:
+ FontList* pList;
+ Font aCurFont;
+ Printer aPrinter;
+ FontNameBox aFontBox;
+ FontStyleBox aStyleBox;
+ FontSizeBox aSizeBox;
+ ListBox aUnderlineBox;
+ ListBox aStrikeoutBox;
+ CheckBox aWordLineBox;
+ CheckBox aShadowBox;
+ CheckBox aOutlineBox;
+ ColorListBox aColorBox;
+ GroupBox aEffectBox;
+ OrientSlider aLineOrientSlider;
+ ShowFont aShowFont;
+ GroupBox aSampleBox;
+ FixedText aMapText;
+ OKButton aOKBtn;
+ CancelButton aCancelBtn;
+
+public:
+ MyFontDialog( Window* pParent );
+
+ DECL_LINK( SelectFont, ComboBox* );
+ DECL_LINK( SelectStyle, ComboBox* );
+ DECL_LINK( AttrHdl, Window * );
+ void SetAttr();
+ short Execute();
+};
+
+// -----------------------------------------------------------------------
+
+class MyTabBar : public TabBar
+{
+public:
+ MyTabBar( Window* pParent,
+ WinBits nWinStyle = WB_STDTABBAR ) :
+ TabBar( pParent, nWinStyle ) {}
+
+ virtual long DeactivatePage();
+ virtual long AllowRenaming();
+ virtual void Split();
+ virtual void Command( const CommandEvent& rCEvt );
+ virtual BOOL QueryDrop( DropEvent& rDEvt );
+};
+
+// -----------------------------------------------------------------------
+
+class MyCalendar : public WorkWindow
+{
+ MenuBar aMenuBar;
+ PopupMenu aWeekStartMenu;
+ PopupMenu aWeekCountMenu;
+ Calendar aCalendar;
+ Color aInfoColor;
+ Color aHolidayColor;
+ Color aFrameColor;
+
+public:
+ MyCalendar( Window* pParent );
+ ~MyCalendar();
+
+ DECL_LINK( RequestDateInfoHdl, Calendar* );
+ DECL_LINK( DoubleClickHdl, Calendar* );
+ DECL_LINK( MenuSelectHdl, Menu* );
+
+ void Resize();
+};
+
+// -----------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+private:
+ Printer aPrn;
+ ToolBox aBox;
+ StatusBar aBar;
+ HeaderBar aHeadBar;
+ ColorListBox aColorList;
+ LineListBox aLineList;
+ ValueSet aValueSet;
+ CalendarField aCalendarField;
+ CalendarField aCalendarField2;
+ MyTabBar aTabBar;
+ ProgressBar aPrgsBar;
+ PushButton aFontBtn;
+ PushButton aCalendarBtn;
+ PushButton aPrnSetupBtn;
+ PushButton aPrnDlgBtn;
+ Size aBoxSize;
+ MyCalendar* pCalendar;
+ PopupMenu* pMenu;
+ FontNameMenu* pNameMenu;
+ FontStyleMenu* pStyleMenu;
+ FontSizeMenu* pSizeMenu;
+
+public:
+ MyWin( Window* pParent, WinBits aWinStyle );
+ ~MyWin();
+
+ DECL_LINK( Test, PushButton* );
+ DECL_LINK( SelectHdl, Window* );
+ DECL_LINK( CalSelectHdl, CalendarField* );
+ void ContextMenu( const Point& rPos );
+
+ void Command( const CommandEvent& rCEvt );
+ void MouseButtonDown( const MouseEvent& rMEvt );
+ void KeyInput( const KeyEvent& rKEvt );
+ void Paint( const Rectangle& rRect );
+ void Resize();
+};
+
+// -----------------------------------------------------------------------
+
+void MyApp::Main()
+{
+ Help aHelp;
+ SetHelp( &aHelp );
+ Help::EnableContextHelp();
+ Help::EnableExtHelp();
+ Help::EnableBalloonHelp();
+ Help::EnableQuickHelp();
+
+ MyWin aMainWin( NULL, WinBits( WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) );
+ aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "SVTOOLS - Workbench" ) ) );
+ aMainWin.GrabFocus();
+ aMainWin.Show();
+
+ Execute();
+}
+
+// -----------------------------------------------------------------------
+
+ShowBitmap::ShowBitmap( Window* pParent, const Bitmap& rBmp ) :
+ WorkWindow( pParent, WB_STDWORK ),
+ aBmp( rBmp )
+{
+ SetOutputSizePixel( rBmp.GetSizePixel() );
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Bitmap-Viewer" ) ) );
+ Show();
+}
+
+// -----------------------------------------------------------------------
+
+void ShowBitmap::Paint( const Rectangle& )
+{
+ DrawBitmap( Point(), GetOutputSizePixel(), aBmp );
+}
+
+// -----------------------------------------------------------------------
+
+BOOL ShowBitmap::Close()
+{
+ Hide();
+ delete this;
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+ShowFont::ShowFont( Window* pParent ) :
+ Control( pParent, WB_BORDER )
+{
+ SetMapMode( MapMode( MAP_POINT, Point(),
+ Fraction( 1, 10 ), Fraction( 1, 10 ) ) );
+ SetBackground( Wallpaper( Color( COL_WHITE ) ) );
+}
+
+// -----------------------------------------------------------------------
+
+void ShowFont::Paint( const Rectangle& )
+{
+ const Font& rFont = GetFont();
+ String aText;
+ Size aWindowSize( GetOutputSize() );
+ long x,y;
+
+ if ( rFont.GetLineOrientation() )
+ {
+ aText.Append( String::CreateFromInt32( rFont.GetLineOrientation()/10 ) );
+ aText.AppendAscii( " degree." );
+
+ x = aWindowSize.Width()/2;
+ y = aWindowSize.Height()/2;
+ }
+ else
+ {
+ aText = rFont.GetName();
+ if ( !aText.Len() )
+ aText.AssignAscii( "Sample" );
+
+ x = aWindowSize.Width()/2 - GetTextWidth( aText )/2;
+ y = aWindowSize.Height()/2 - GetTextHeight()/2;
+ }
+
+ DrawText( Point( x, y ), aText );
+}
+
+// -----------------------------------------------------------------------
+
+MyFontDialog::MyFontDialog( Window* pParent ) :
+ ModalDialog( pParent, WB_SVLOOK | WB_STDMODAL ),
+ aFontBox( this ),
+ aStyleBox( this ),
+ aSizeBox( this ),
+ aUnderlineBox( this, WB_DROPDOWN ),
+ aStrikeoutBox( this, WB_DROPDOWN ),
+ aWordLineBox( this ),
+ aShadowBox( this ),
+ aOutlineBox( this ),
+ aColorBox( this, WB_DROPDOWN ),
+ aEffectBox( this ),
+ aLineOrientSlider( this ),
+ aShowFont( this ),
+ aSampleBox( this ),
+ aMapText( this, WB_LEFT | WB_WORDBREAK ),
+ aOKBtn( this, WB_DEFBUTTON ),
+ aCancelBtn( this )
+{
+ pList = NULL;
+
+ aFontBox.EnableWYSIWYG( TRUE );
+ aFontBox.EnableSymbols( TRUE );
+ aFontBox.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
+ aFontBox.SetSelectHdl( LINK( this, MyFontDialog, SelectFont ) );
+ aFontBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectFont ) );
+ aFontBox.Show();
+
+ aStyleBox.SetPosSizePixel( Point( 160, 10 ), Size( 100, 140 ) );
+ aStyleBox.SetSelectHdl( LINK( this, MyFontDialog, SelectStyle ) );
+ aStyleBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectStyle ) );
+ aStyleBox.Show();
+
+ aSizeBox.SetPosSizePixel( Point( 270, 10 ), Size( 60, 140 ) );
+ aSizeBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aSizeBox.SetLoseFocusHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aSizeBox.Show();
+
+ aUnderlineBox.SetPosSizePixel( Point( 15, 180 ), Size( 130, 100 ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_NONE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SINGLE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOTTED" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DONTKNOW" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_LONGDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOTDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SMALLWAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_WAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLEWAVE" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLD" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDOTTED" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDLONGDASH" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOTDOT" ) ) );
+ aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDWAVE" ) ) );
+ aUnderlineBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aUnderlineBox.Show();
+
+ aStrikeoutBox.SetPosSizePixel( Point( 15, 210 ), Size( 130, 100 ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_NONE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SINGLE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DOUBLE" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DONTKNOW" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_BOLD" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SLASH" ) ) );
+ aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_X" ) ) );
+ aStrikeoutBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aStrikeoutBox.Show();
+
+ aWordLineBox.SetPosSizePixel( Point( 15, 240 ), Size( 130, 19 ) );
+ aWordLineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Only ~Words" ) ) );
+ aWordLineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aWordLineBox.Show();
+
+ aShadowBox.SetPosSizePixel( Point( 15, 260 ), Size( 130, 19 ) );
+ aShadowBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ) );
+ aShadowBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aShadowBox.Show();
+
+ aOutlineBox.SetPosSizePixel( Point( 15, 280 ), Size( 130, 19 ) );
+ aOutlineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ) );
+ aOutlineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aOutlineBox.Show();
+
+ {
+ aColorBox.SetPosSizePixel( Point( 15, 305 ), Size( 130, 100 ) );
+ aColorBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aColorBox.SetUpdateMode( FALSE );
+ aColorBox.InsertEntry( Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aColorBox.InsertEntry( Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aColorBox.InsertEntry( Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aColorBox.InsertEntry( Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aColorBox.InsertEntry( Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aColorBox.InsertEntry( Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aColorBox.InsertEntry( Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aColorBox.InsertEntry( Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aColorBox.InsertEntry( Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aColorBox.InsertEntry( Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aColorBox.InsertEntry( Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aColorBox.SetUpdateMode( TRUE );
+ aColorBox.Show();
+ }
+
+ aEffectBox.SetPosSizePixel( Point( 10, 160 ), Size( 140, 175 ) );
+ aEffectBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Effects" ) ) );
+ aEffectBox.Show();
+
+ Size aSliderSize = aLineOrientSlider.GetSizePixel();
+ aLineOrientSlider.SetPosSizePixel( Point( 160, 335-aSliderSize.Height() ),
+ Size( 250, aSliderSize.Height() ) );
+ aLineOrientSlider.SetSlideHdl( LINK( this, MyFontDialog, AttrHdl ) );
+ aLineOrientSlider.Show();
+
+ aShowFont.SetPosSizePixel( Point( 165, 180 ), Size( 240, 70 ) );
+ aShowFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
+ aShowFont.Show();
+
+ aSampleBox.SetPosSizePixel( Point( 160, 160 ), Size( 250, 100 ) );
+ aSampleBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
+ aSampleBox.Show();
+
+ aMapText.SetPosSizePixel( Point( 160, 270 ), Size( 250, 35 ) );
+ aMapText.Show();
+
+ aOKBtn.SetPosSizePixel( Point( 340, 10 ), Size( 70, 25 ) );
+ aOKBtn.Show();
+
+ aCancelBtn.SetPosSizePixel( Point( 340, 40 ), Size( 70, 25 ) );
+ aCancelBtn.Show();
+
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "FontDialog" ) ) );
+ SetOutputSizePixel( Size( 420, 345 ) );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, SelectFont, ComboBox*, EMPTYARG )
+{
+ aStyleBox.Fill( aFontBox.GetText(), pList );
+ FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
+ aSizeBox.Fill( aInfo, pList );
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, SelectStyle, ComboBox*, EMPTYARG )
+{
+ FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
+ aSizeBox.Fill( aInfo, pList );
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyFontDialog, AttrHdl, Window*, EMPTYARG )
+{
+ SetAttr();
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyFontDialog::SetAttr()
+{
+ FontInfo aFont( pList->Get( aFontBox.GetText(), aStyleBox.GetText() ) );
+ aFont.SetSize( Size( 0, aSizeBox.GetValue() ) );
+ aFont.SetUnderline( (FontUnderline)aUnderlineBox.GetSelectEntryPos() );
+ aFont.SetStrikeout( (FontStrikeout)aStrikeoutBox.GetSelectEntryPos() );
+ aFont.SetColor( Color( (ColorName)aColorBox.GetSelectEntryPos() ) );
+ aFont.SetWordLineMode( aWordLineBox.IsChecked() );
+ aFont.SetShadow( aShadowBox.IsChecked() );
+ aFont.SetOutline( aOutlineBox.IsChecked() );
+ aFont.SetLineOrientation( aLineOrientSlider.GetOrientation() );
+ aFont.SetTransparent( TRUE );
+ aMapText.SetText( pList->GetFontMapText( aFont ) );
+ aShowFont.SetFont( aFont );
+}
+
+// -----------------------------------------------------------------------
+
+short MyFontDialog::Execute()
+{
+ pList = new FontList( &aPrinter, this );
+ aFontBox.Fill( pList );
+ aSizeBox.SetValue( 120 );
+ aUnderlineBox.SelectEntryPos( 0 );
+ aStrikeoutBox.SelectEntryPos( 0 );
+ aColorBox.SelectEntryPos( 0 );
+ SelectFont( &aFontBox );
+ short nRet = ModalDialog::Execute();
+ delete pList;
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+long MyTabBar::DeactivatePage()
+{
+ if ( GetCurPageId() == 6 )
+ {
+ QueryBox aQueryBox( this, WB_YES_NO | WB_DEF_YES,
+ XubString( RTL_CONSTASCII_USTRINGPARAM( "Deactivate" ) ) );
+ if ( aQueryBox.Execute() == RET_YES )
+ return TRUE;
+ else
+ return FALSE;
+ }
+ else
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+long MyTabBar::AllowRenaming()
+{
+ XubString aStr( RTL_CONSTASCII_USTRINGPARAM( "Allow renaming: " ) );
+ aStr += GetEditText();
+ QueryBox aQueryBox( this, WB_YES_NO_CANCEL | WB_DEF_YES, aStr );
+ long nRet = aQueryBox.Execute();
+ if ( nRet == RET_YES )
+ return TAB_RENAMING_YES;
+ else if ( nRet == RET_NO )
+ return TAB_RENAMING_NO;
+ else // ( nRet == RET_CANCEL )
+ return TAB_RENAMING_CANCEL;
+}
+
+// -----------------------------------------------------------------------
+
+void MyTabBar::Split()
+{
+ Size aSize = GetSizePixel();
+ long nWidth = GetSplitSize();
+ long nMaxWidth = GetParent()->GetOutputSizePixel().Width()-50;
+ if ( nWidth < GetMinSize() )
+ nWidth = GetMinSize();
+ else if ( nWidth > nMaxWidth )
+ nWidth = nMaxWidth;
+ SetSizePixel( Size( nWidth, aSize.Height() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void MyTabBar::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_STARTDRAG )
+ {
+ Region aRegion;
+ if ( StartDrag( rCEvt, aRegion ) )
+ {
+ DragServer::Clear();
+ DragServer::CopyString( XubString( RTL_CONSTASCII_USTRINGPARAM( "TabBar" ) ) );
+ if ( GetSelectPageCount() > 1 )
+ {
+ ExecuteDrag( Pointer( POINTER_MOVEFILES ),
+ Pointer( POINTER_COPYFILES ),
+ DRAG_ALL, &aRegion );
+ }
+ else
+ {
+ ExecuteDrag( Pointer( POINTER_MOVEFILE ),
+ Pointer( POINTER_COPYFILE ),
+ DRAG_ALL, &aRegion );
+ }
+ HideDropPos();
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
+BOOL MyTabBar::QueryDrop( DropEvent& rDEvt )
+{
+ if ( rDEvt.IsLeaveWindow() )
+ HideDropPos();
+ else
+ ShowDropPos( rDEvt.GetPosPixel() );
+/*
+ if ( rDEvt.IsLeaveWindow() )
+ EndSwitchPage();
+ else
+ SwitchPage( rDEvt.GetPosPixel() );
+*/
+
+ return TRUE;
+}
+
+// -----------------------------------------------------------------------
+
+MyCalendar::MyCalendar( Window* pParent ) :
+ WorkWindow( pParent, WB_STDWORK ),
+ aCalendar( this, WB_TABSTOP | WB_WEEKNUMBER | WB_BOLDTEXT | WB_FRAMEINFO | WB_MULTISELECT ),
+ aInfoColor( COL_LIGHTBLUE ),
+ aHolidayColor( COL_LIGHTRED ),
+ aFrameColor( COL_LIGHTRED )
+{
+ const International& rIntn = aCalendar.GetInternational();
+ aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Wochen~anfang" ) ) );
+ aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Erste Woche" ) ) );
+ aMenuBar.SetPopupMenu( 1, &aWeekStartMenu );
+ aMenuBar.SetPopupMenu( 2, &aWeekCountMenu );
+ for ( USHORT i = 0; i < 7; i++ )
+ aWeekStartMenu.InsertItem( 10+i, rIntn.GetDayText( (DayOfWeek)i ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekStartMenu.CheckItem( 10+(USHORT)rIntn.GetWeekStart() );
+ aWeekCountMenu.InsertItem( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "~1. Januar" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.InsertItem( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste 4 ~Tage-Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.InsertItem( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste ~volle Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
+ aWeekCountMenu.CheckItem( 20+(USHORT)rIntn.GetWeekCountStart() );
+ aMenuBar.SetSelectHdl( LINK( this, MyCalendar, MenuSelectHdl ) );
+ SetMenuBar( &aMenuBar );
+
+ Date aCurDate = aCalendar.GetCurDate();
+ aCalendar.SetRequestDateInfoHdl( LINK( this, MyCalendar, RequestDateInfoHdl ) );
+ aCalendar.SetDoubleClickHdl( LINK( this, MyCalendar, DoubleClickHdl ) );
+ aCalendar.SetSaturdayColor( Color( COL_LIGHTGREEN ) );
+ aCalendar.SetSundayColor( aHolidayColor );
+ aCalendar.AddDateInfo( Date( 1, 1, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Neujahr" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 24, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Heiligabend" ) ), &aInfoColor, NULL );
+ aCalendar.AddDateInfo( Date( 25, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "1. Weihnachttag" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 26, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "2. Weihnachttag" ) ), &aHolidayColor, NULL );
+ aCalendar.AddDateInfo( Date( 31, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Silvester" ) ), &aInfoColor, NULL );
+ aCalendar.SetPosPixel( Point() );
+ aCalendar.SetFirstDate( Date( 1, 1, aCurDate.GetYear() ) );
+ aCalendar.Show();
+
+ SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
+ SetOutputSizePixel( aCalendar.CalcWindowSizePixel( 3, 4 ) );
+}
+
+// -----------------------------------------------------------------------
+
+MyCalendar::~MyCalendar()
+{
+ SetMenuBar( NULL );
+ aMenuBar.SetPopupMenu( 1, NULL );
+ aMenuBar.SetPopupMenu( 2, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, RequestDateInfoHdl, Calendar*, EMPTYARG )
+{
+ USHORT nRequestYear = aCalendar.GetRequestYear();
+ if ( (nRequestYear >= 1954) && (nRequestYear <= 1989) )
+ aCalendar.AddDateInfo( Date( 17, 6, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
+ else if ( nRequestYear >= 1990 )
+ aCalendar.AddDateInfo( Date( 3, 10, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, DoubleClickHdl, Calendar*, EMPTYARG )
+{
+ Date aDate = aCalendar.GetCurDate();
+ String aStr( RTL_CONSTASCII_USTRINGPARAM( "Info: " ) );
+ aStr += Application::GetAppInternational().GetDate( aDate );
+ aCalendar.AddDateInfo( aDate, aStr, NULL, &aFrameColor, DIB_BOLD );
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyCalendar, MenuSelectHdl, Menu*, pMenu )
+{
+ International aIntn = aCalendar.GetInternational();
+ USHORT nItemId = pMenu->GetCurItemId();
+
+ if ( (nItemId >= 10) && (nItemId <= 19) )
+ aIntn.SetWeekStart( (DayOfWeek)(nItemId-10) );
+ else if ( (nItemId >= 20) && (nItemId <= 29) )
+ aIntn.SetWeekCountStart( (WeekCountStart)(nItemId-20) );
+ aCalendar.SetInternational( aIntn );
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyCalendar::Resize()
+{
+ aCalendar.SetSizePixel( GetOutputSizePixel() );
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::MyWin( Window* pParent, WinBits aWinStyle ) :
+ WorkWindow(pParent, aWinStyle | WB_SVLOOK ),
+ aBox( this, WB_BORDER | WB_SVLOOK ),
+ aBar( this, WB_BORDER | WB_SVLOOK | WB_RIGHT ),
+ aHeadBar( this, WB_BORDER | WB_SVLOOK | WB_DRAG | WB_BUTTONSTYLE ),
+ aColorList( this ),
+ aLineList( this ),
+ aValueSet( this, WB_TABSTOP | WB_NAMEFIELD | WB_NONEFIELD | WB_BORDER | WB_ITEMBORDER | WB_VSCROLL /* | WB_FLATVALUESET */ ),
+ aCalendarField( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
+ aCalendarField2( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
+ aTabBar( this, WB_BORDER | WB_MULTISELECT | WB_SCROLL | WB_SIZEABLE | WB_DRAG ),
+ aPrgsBar( this ),
+ aFontBtn( this ),
+ aCalendarBtn( this ),
+ aPrnSetupBtn( this ),
+ aPrnDlgBtn( this )
+{
+ SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFaceColor() ) );
+
+ pCalendar = NULL;
+ pMenu = NULL;
+
+ Bitmap aBmp;
+ aBox.InsertItem( 1, aBmp );
+ aBox.InsertItem( 2, aBmp );
+ aBox.InsertItem( 3, aBmp );
+ aBox.InsertItem( 4, aBmp );
+ aBox.InsertSeparator();
+ aBox.InsertItem( 5, aBmp );
+ aBox.InsertItem( 6, aBmp );
+ aBox.InsertItem( 7, aBmp );
+ aBox.InsertItem( 8, aBmp );
+ aBox.InsertSpace();
+ aBox.InsertItem( 9, aBmp );
+ aBox.SetPosPixel( Point( 0, 0 ) );
+ aBoxSize = aBox.GetSizePixel();
+ aBox.Show();
+
+ aBar.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ready" ) ) );
+ aBar.InsertItem( 1, 35 );
+ aBar.InsertItem( 2, 55 );
+ aBar.InsertItem( 3, 55 );
+ aBar.SetItemText( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
+ aBar.SetItemText( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "21.01.93" ) ) );
+ aBar.SetItemText( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "12:00:00" ) ) );
+ aBar.Show();
+
+ long nY = aBox.GetSizePixel().Height()+10;
+ {
+ aHeadBar.SetPosPixel( Point( 0, nY ) );
+ aHeadBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Sender" ) ), 150 );
+ aHeadBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ), 150, HIB_CENTER | HIB_VCENTER | HIB_CLICKABLE );
+ aHeadBar.InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ), 75 );
+ aHeadBar.InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ), 60, HIB_RIGHT | HIB_VCENTER | HIB_CLICKABLE );
+ aHeadBar.InsertItem( 9999, String(), HEADERBAR_FULLSIZE, HIB_RIGHT | HIB_VCENTER | HIB_FIXEDPOS );
+ aHeadBar.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aHeadBar.Show();
+ nY += aHeadBar.GetSizePixel().Height() += 10;
+ }
+
+ {
+ aColorList.SetPosSizePixel( Point( 10, nY ), Size( 130, 180 ) );
+ aColorList.SetUpdateMode( FALSE );
+ aColorList.InsertEntry( Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aColorList.InsertEntry( Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aColorList.InsertEntry( Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aColorList.InsertEntry( Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aColorList.InsertEntry( Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aColorList.InsertEntry( Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aColorList.InsertEntry( Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aColorList.InsertEntry( Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aColorList.InsertEntry( Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aColorList.InsertEntry( Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aColorList.InsertEntry( Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aColorList.SetUpdateMode( TRUE );
+ aColorList.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aColorList.Show();
+ }
+
+ {
+ aLineList.SetPosSizePixel( Point( 150, nY ), Size( 130, 180 ) );
+ aLineList.SetUnit( FUNIT_POINT );
+ aLineList.SetSourceUnit( FUNIT_TWIP );
+ aLineList.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Hairline" ) ) );
+ aLineList.InsertEntry( 1500 );
+ aLineList.InsertEntry( 3000 );
+ aLineList.InsertEntry( 4500 );
+ aLineList.InsertEntry( 6000 );
+ aLineList.InsertEntry( 7500 );
+ aLineList.InsertEntry( 9000 );
+ aLineList.InsertEntry( 1500, 1500, 1500 );
+ aLineList.InsertEntry( 3000, 1500, 1500 );
+ aLineList.InsertEntry( 4500, 1500, 1500 );
+ aLineList.InsertEntry( 3000, 3000, 1500 );
+ aLineList.InsertEntry( 4500, 3000, 1500 );
+ aLineList.InsertEntry( 4500, 4500, 1500 );
+ aLineList.Show();
+ }
+
+ {
+ aValueSet.SetPosSizePixel( Point( 290, nY ), Size( 130, 180 ) );
+ aValueSet.InsertItem( 9, Color( COL_BLACK ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
+ aValueSet.InsertItem( 10, Color( COL_BLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
+ aValueSet.InsertItem( 11, Color( COL_GREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
+ aValueSet.InsertItem( 12, Color( COL_CYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
+ aValueSet.InsertItem( 13, Color( COL_RED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
+ aValueSet.InsertItem( 14, Color( COL_MAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
+ aValueSet.InsertItem( 15, Color( COL_BROWN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
+ aValueSet.InsertItem( 16, Color( COL_GRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
+ aValueSet.InsertItem( 17, Color( COL_LIGHTGRAY ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
+ aValueSet.InsertItem( 18, Color( COL_LIGHTBLUE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
+ aValueSet.InsertItem( 19, Color( COL_LIGHTGREEN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
+ aValueSet.InsertItem( 20, Color( COL_LIGHTCYAN ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
+ aValueSet.InsertItem( 21, Color( COL_LIGHTRED ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
+ aValueSet.InsertItem( 22, Color( COL_LIGHTMAGENTA ), XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
+ aValueSet.InsertItem( 23, Color( COL_YELLOW ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
+ aValueSet.InsertItem( 24, Color( COL_WHITE ), XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
+ aValueSet.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
+ aValueSet.SetColCount( 4 );
+ aValueSet.SetLineCount( 4 );
+ aValueSet.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
+ aValueSet.Show();
+ }
+
+ {
+ aCalendarField.EnableEmptyFieldValue( TRUE );
+ aCalendarField.SetCalendarStyle( aCalendarField.GetCalendarStyle() | WB_RANGESELECT );
+ aCalendarField.SetSelectHdl( LINK( this, MyWin, CalSelectHdl ) );
+// aCalendarField.SetDate( Date() );
+ aCalendarField.SetEmptyDate();
+ aCalendarField.EnableToday();
+ aCalendarField.EnableNone();
+ aCalendarField.SetPosSizePixel( Point( 430, nY ), Size( 130, 20 ) );
+ aCalendarField.Show();
+ }
+
+ {
+ aCalendarField2.SetDate( Date() );
+ aCalendarField2.SetPosSizePixel( Point( 570, nY ), Size( 130, 20 ) );
+ aCalendarField2.Show();
+ }
+
+ nY += 200;
+ {
+ aTabBar.SetPosSizePixel( Point( 10, nY ),
+ Size( 300, aTabBar.GetSizePixel().Height() ) );
+ aTabBar.InsertPage( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 1" ) ) );
+ aTabBar.InsertPage( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 2" ) ) );
+ aTabBar.InsertPage( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 3" ) ) );
+ aTabBar.InsertPage( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 4" ) ) );
+ aTabBar.InsertPage( 5, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 5" ) ) );
+ aTabBar.InsertPage( 6, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 6" ) ) );
+ aTabBar.InsertPage( 7, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 7" ) ) );
+ aTabBar.InsertPage( 8, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 8" ) ) );
+ aTabBar.InsertPage( 9, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 9" ) ) );
+ aTabBar.InsertPage( 10, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 10" ) ) );
+ aTabBar.InsertPage( 11, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 11" ) ) );
+ aTabBar.InsertPage( 12, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 12" ) ) );
+ aTabBar.InsertPage( 13, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 13" ) ) );
+ aTabBar.InsertPage( 14, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 14" ) ) );
+ aTabBar.InsertPage( 15, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 15" ) ) );
+ aTabBar.InsertPage( 16, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 16" ) ) );
+ aTabBar.InsertPage( 17, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 17" ) ) );
+ aTabBar.InsertPage( 18, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 18" ) ) );
+ aTabBar.InsertPage( 19, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 19" ) ) );
+ aTabBar.InsertPage( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 20" ) ) );
+ aTabBar.InsertPage( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "This is a long Page Text" ) ) );
+ aTabBar.InsertPage( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "Short Text" ) ) );
+ aTabBar.InsertPage( 23, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very very long Page Text" ) ) );
+ aTabBar.InsertPage( 24, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 24" ) ) );
+ aTabBar.InsertPage( 25, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 25" ) ) );
+ aTabBar.InsertPage( 26, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very long Page Text" ) ) );
+ aTabBar.InsertPage( 27, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 27" ) ) );
+ aTabBar.InsertPage( 28, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 28" ) ) );
+ aTabBar.InsertPage( 29, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 29" ) ) );
+ aTabBar.InsertPage( 30, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 30" ) ) );
+ aTabBar.EnableEditMode();
+ aTabBar.Show();
+ }
+
+ nY += 35;
+ {
+ aPrgsBar.SetPosPixel( Point( 10, nY ) );
+ aPrgsBar.Show();
+ }
+
+ nY += 40;
+ {
+ aFontBtn.SetPosSizePixel( Point( 10, nY ), Size( 100, 30 ) );
+ aFontBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Font..." ) ) );
+ aFontBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aFontBtn.Show();
+
+ aCalendarBtn.SetPosSizePixel( Point( 120, nY ), Size( 100, 30 ) );
+ aCalendarBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
+ aCalendarBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aCalendarBtn.Show();
+
+ aPrnSetupBtn.SetPosSizePixel( Point( 230, nY ), Size( 100, 30 ) );
+ aPrnSetupBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "PrnSetup..." ) ) );
+ aPrnSetupBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aPrnSetupBtn.Show();
+
+ aPrnDlgBtn.SetPosSizePixel( Point( 340, nY ), Size( 100, 30 ) );
+ aPrnDlgBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Print...." ) ) );
+ aPrnDlgBtn.SetClickHdl( LINK( this, MyWin, Test ) );
+ aPrnDlgBtn.Show();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+MyWin::~MyWin()
+{
+ if ( pCalendar )
+ delete pCalendar;
+
+ if ( pMenu )
+ {
+ delete pMenu;
+ delete pNameMenu;
+ delete pStyleMenu;
+ delete pSizeMenu;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, Test, PushButton*, pBtn )
+{
+ if ( pBtn == &aFontBtn )
+ {
+ MyFontDialog* pDlg = new MyFontDialog( this );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ else if ( pBtn == &aCalendarBtn )
+ {
+ if ( !pCalendar )
+ pCalendar = new MyCalendar( this );
+ pCalendar->ToTop();
+ pCalendar->Show();
+ }
+ else if ( pBtn == &aPrnSetupBtn )
+ {
+ PrinterSetupDialog* pDlg = new PrinterSetupDialog( this );
+ pDlg->SetPrinter( &aPrn );
+ pDlg->Execute();
+ delete pDlg;
+ }
+ else if ( pBtn == &aPrnDlgBtn )
+ {
+ PrintDialog* pDlg = new PrintDialog( this );
+ pDlg->SetPrinter( &aPrn );
+ pDlg->EnableRange( PRINTDIALOG_ALL );
+ pDlg->EnableRange( PRINTDIALOG_RANGE );
+ pDlg->Execute();
+ delete pDlg;
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, SelectHdl, Window*, pCtrl )
+{
+ if ( pCtrl == &aColorList )
+ {
+ Color aColor = aColorList.GetSelectEntryColor();
+ aValueSet.SetColor( aColor );
+ aLineList.SetColor( aColor );
+ }
+ else if ( pCtrl == &aValueSet )
+ {
+ USHORT nId = aValueSet.GetSelectItemId();
+ if ( nId > 8 )
+ {
+ Color aColor = aValueSet.GetItemColor( nId );
+ aValueSet.SetFillColor( aColor );
+ }
+ }
+ else if ( pCtrl == &aHeadBar )
+ {
+ USHORT nCurItemId = aHeadBar.GetCurItemId();
+ for ( USHORT i = 0; i < aHeadBar.GetItemCount(); i++ )
+ {
+ USHORT nItemId = aHeadBar.GetItemId( i );
+ HeaderBarItemBits nBits = aHeadBar.GetItemBits( nItemId );
+ if ( nItemId == nCurItemId )
+ {
+ HeaderBarItemBits nOldBits = nBits;
+ nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
+ if ( nOldBits & HIB_DOWNARROW )
+ nBits |= HIB_UPARROW;
+ else
+ nBits |= HIB_DOWNARROW;
+ }
+ else
+ nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
+ aHeadBar.SetItemBits( nItemId, nBits );
+ }
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+IMPL_LINK( MyWin, CalSelectHdl, CalendarField*, pCtrl )
+{
+ if ( pCtrl == &aCalendarField )
+ {
+ Calendar* pCalendar = pCtrl->GetCalendar();
+ aCalendarField2.SetDate( pCalendar->GetSelectDate( pCalendar->GetSelectDateCount()-1 ) );
+ }
+
+ return 0;
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::ContextMenu( const Point& rPos )
+{
+ FontList aList( this );
+
+ if ( !pMenu )
+ {
+ pMenu = new PopupMenu;
+ pNameMenu = new FontNameMenu;
+ pStyleMenu = new FontStyleMenu;
+ pSizeMenu = new FontSizeMenu;
+
+ pMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Font" ) ) );
+ pMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Attribute" ) ) );
+ pMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) );
+ pMenu->SetPopupMenu( 1, pNameMenu );
+ pMenu->SetPopupMenu( 2, pStyleMenu );
+ pMenu->SetPopupMenu( 3, pSizeMenu );
+
+ pNameMenu->Fill( &aList );
+ pNameMenu->SetCurName( aList.GetFontName( 0 ).GetName() );
+
+ pStyleMenu->InsertSeparator();
+ pStyleMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Underline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Stri~keout" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ pStyleMenu->InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
+ }
+
+ pStyleMenu->Fill( pNameMenu->GetCurName(), &aList );
+ pSizeMenu->Fill( aList.Get( pNameMenu->GetCurName(),
+ pStyleMenu->GetCurStyle() ), &aList );
+
+ pMenu->Execute( this, rPos );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Command( const CommandEvent& rCEvt )
+{
+ if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
+ ContextMenu( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ aValueSet.StartSelection();
+ WorkWindow::MouseButtonDown( rMEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::KeyInput( const KeyEvent& rKEvt )
+{
+ if ( rKEvt.GetKeyCode().GetCode() == KEY_P )
+ {
+ for ( USHORT i = 0; i <= 130; i += 2 )
+ {
+ for ( USHORT j = 0; j < 6000; j++ )
+ {
+ aPrgsBar.SetValue( i );
+ Application::Reschedule();
+ }
+ }
+ }
+ else if ( rKEvt.GetCharCode() == '+' )
+ aHeadBar.SetOffset( aHeadBar.GetOffset()+1 );
+ else if ( rKEvt.GetCharCode() == '-' )
+ aHeadBar.SetOffset( aHeadBar.GetOffset()-1 );
+
+ WorkWindow::KeyInput( rKEvt );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Paint( const Rectangle& rRect )
+{
+ WorkWindow::Paint( rRect );
+}
+
+// -----------------------------------------------------------------------
+
+void MyWin::Resize()
+{
+ Size aWinSize = GetOutputSizePixel();
+
+ aBox.SetSizePixel( Size( aWinSize.Width(), aBoxSize.Height() ) );
+
+ Size aSize = aBar.GetSizePixel();
+ aBar.SetPosSizePixel( Point( 0, aWinSize.Height()-aSize.Height() ),
+ Size( aWinSize.Width(), aSize.Height() ) );
+
+ Size aBarSize = aSize;
+ Point aPos = aHeadBar.GetPosPixel();
+ aSize = aHeadBar.GetSizePixel();
+ aHeadBar.SetSizePixel( Size( aWinSize.Width(), aSize.Height() ) );
+ aHeadBar.SetDragSize( aWinSize.Height() - aSize.Height() - aPos.Y() - aBarSize.Height() );
+
+ aPos = aPrgsBar.GetPosPixel();
+ aSize = aPrgsBar.GetSizePixel();
+ if ( aPos.X() < aWinSize.Width()-10 )
+ aPrgsBar.SetSizePixel( Size( aWinSize.Width()-aPos.X()-10, aSize.Height() ) );
+}
+
+// -----------------------------------------------------------------------
+
+MyApp aMyApp;
diff --git a/svtools/workben/urange.cxx b/svtools/workben/urange.cxx
new file mode 100644
index 000000000000..44e9e868362c
--- /dev/null
+++ b/svtools/workben/urange.cxx
@@ -0,0 +1,251 @@
+/*************************************************************************
+ *
+ * $RCSfile: urange.cxx,v $
+ *
+ * $Revision: 1.1.1.1 $
+ *
+ * last change: $Author: hr $ $Date: 2000-09-18 16:59:07 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+/* Test the SfxUShortRanges class */
+
+#ifndef _SFXITEMS_HXX
+#include <sfxitems.hxx>
+#endif
+
+USHORT nValues1[] = {340,472,482,4288,4374,4890,5026,5356,5724,6130,6186,6666,9222,9764,9908,
+ 10110,11302,11748,11946,12298,12344,12642,12958,13076,13410,13496,14462,
+ 14480,14592,16292,16788,17102,17792,17844,18182,18396,18522,18974,19292,
+ 19630,20336,21808,21972,22382,23568,25156,26978,27158,27730,28014,28280,
+ 28774,29258,30920,30938,31356,31582,32194,32734,32893,33757,33911,34013,
+ 34565,35283,38895,40273,41281,42157,44429,44553,45825,46367,48163,48417,
+ 49501,50499,52105,53035,53715,53899,54015,54131,54865,55155,55507,56325,
+ 57045,59243,59833,59859,59951,60361,61387,62453,62703,63155,63517,63621,
+ 63895,0};
+
+USHORT nValues2[] = {2362,3100,3286,3548,4056,4224,5058,5198,5398,5990,6910,7034,7046,8574,8762,
+ 9360,9494,9720,11432,12900,12946,13626,13844,14344,15028,16306,16494,16972,
+ 17340,17504,17610,18270,18506,19832,19962,20356,20792,21146,21270,21722,
+ 22486,22752,23554,24148,24210,24910,25006,25500,26464,26952,27216,28394,
+ 28398,29602,31130,31642,31894,33343,34191,34593,34931,36221,36637,37287,
+ 37765,39853,41231,41711,41799,44213,44863,46491,47459,48707,48911,49353,
+ 49923,49997,50117,51357,51519,52043,52563,52727,53781,54065,54249,55333,
+ 56549,57361,57777,58165,58507,59229,59719,60379,60845,62697,63123,65169,0};
+
+#include <sv.hxx>
+
+SfxUShortRanges aRanges1a( nValues1 );
+SfxUShortRanges aRanges1b( nValues1 );
+SfxUShortRanges aRanges1c( nValues1 );
+SfxUShortRanges aRanges2( nValues2 );
+
+
+String aStr1;
+String aStr2;
+String aStr3;
+
+
+static String MakeString_Impl( SfxUShortRanges& aRanges )
+{
+ String aStr;
+
+ USHORT nPos = 0;
+ const USHORT* pRanges = ( const USHORT*)aRanges;
+
+ while( pRanges[ nPos ] != 0 )
+ {
+ aStr += pRanges[ nPos ];
+ aStr += " - ";
+ aStr += pRanges[ nPos+1 ];
+ aStr += ", ";
+ nPos += 2;
+ }
+
+
+ return aStr;
+}
+
+
+// -------------------------------------------------------------------------
+
+class MyApp : public Application
+{
+public:
+ void Main( int, char* [] );
+};
+
+// -------------------------------------------------------------------------
+
+class MyDialog : public ModalDialog
+{
+private:
+ GroupBox aGroup1;
+ MultiLineEdit aEdit1;
+ GroupBox aGroup2;
+ MultiLineEdit aEdit2;
+ GroupBox aGroup3;
+ MultiLineEdit aEdit3;
+ OKButton aBtn1;
+ CancelButton aBtn2;
+
+public:
+ MyDialog( Window* pParent );
+
+ void MouseButtonDown( const MouseEvent& rMEvt );
+};
+
+// -------------------------------------------------------------------------
+
+MyDialog::MyDialog( Window* pParent ) :
+ ModalDialog( pParent, WB_STDMODAL | WB_SVLOOK ),
+ aGroup1( this ),
+ aEdit1( this, WB_BORDER | WB_READONLY ),
+ aGroup2( this ),
+ aEdit2( this, WB_BORDER | WB_READONLY ),
+ aGroup3( this ),
+ aEdit3( this, WB_BORDER | WB_READONLY ),
+ aBtn1( this, WB_DEFBUTTON ),
+ aBtn2( this )
+{
+ aGroup1.SetText( "Union" );
+ aGroup1.SetPosSizePixel( Point( 5, 5 ), Size( 330, 80 ) );
+ aGroup1.Show();
+
+ aEdit1.SetPosSizePixel( Point ( 10, 20 ), Size( 320, 60 ) );
+ aEdit1.SetText( aStr1 );
+ aEdit1.Show();
+
+ aGroup2.SetText( "Difference" );
+ aGroup2.SetPosSizePixel( Point( 5, 90 ), Size( 330, 80 ) );
+ aGroup2.Show();
+
+ aEdit2.SetPosSizePixel( Point( 10, 105 ), Size( 320, 60 ) );
+ aEdit2.SetText( aStr2 );
+ aEdit2.Show();
+
+ aGroup3.SetText( "Intersection" );
+ aGroup3.SetPosSizePixel( Point( 5, 175 ), Size( 330, 80 ) );
+ aGroup3.Show();
+
+ aEdit3.SetPosSizePixel( Point( 10, 190 ), Size( 320, 60 ) );
+ aEdit3.SetText( aStr3 );
+ aEdit3.Show();
+
+ aBtn1.SetPosSizePixel( Point( 10, 310 ), Size( 100, 25 ) );
+ aBtn1.Show();
+
+ aBtn2.SetPosSizePixel( Point( 120, 310 ), Size( 100, 25 ) );
+ aBtn2.Show();
+
+ SetOutputSizePixel( Size( 340, 345 ) );
+ SetText( "SfxUShortRanges Test" );
+}
+
+// -------------------------------------------------------------------------
+
+void MyDialog::MouseButtonDown( const MouseEvent& rMEvt )
+{
+}
+
+
+// -------------------------------------------------------------------------
+
+class MyWin : public WorkWindow
+{
+public:
+ MyWin( Window* pParent, WinBits aWinStyle ) :
+ WorkWindow( pParent, aWinStyle )
+ {}
+
+ void MouseButtonDown( const MouseEvent& );
+};
+
+
+// -------------------------------------------------------------------------
+
+MyApp aMyApp;
+
+void MyApp::Main( int, char* [] )
+{
+ EnableSVLook();
+ SetAppFont( System::GetStandardFont( STDFONT_APP ) );
+
+ MyWin aMainWin( NULL, WB_APP | WB_STDWORK );
+ aMainWin.SetText( "SfxUShortRanges - Test" );
+ aMainWin.Show();
+
+ aRanges1a += aRanges2;
+ aRanges1b -= aRanges2;
+ aRanges1c /= aRanges2;
+
+ aStr1 = MakeString_Impl( aRanges1a );
+ aStr2 = MakeString_Impl( aRanges1b );
+ aStr3 = MakeString_Impl( aRanges1c );
+
+ Execute();
+}
+
+// -------------------------------------------------------------------------
+
+void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
+{
+ if( rMEvt.IsLeft() )
+ {
+ MyDialog* pDialog = new MyDialog( this );
+ pDialog->Execute();
+ delete pDialog;
+ }
+}
+