xref: /aoo41x/main/svtools/workben/svdem.cxx (revision 5900e8ec)
1*5900e8ecSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*5900e8ecSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*5900e8ecSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*5900e8ecSAndrew Rist  * distributed with this work for additional information
6*5900e8ecSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*5900e8ecSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*5900e8ecSAndrew Rist  * "License"); you may not use this file except in compliance
9*5900e8ecSAndrew Rist  * with the License.  You may obtain a copy of the License at
10*5900e8ecSAndrew Rist  *
11*5900e8ecSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*5900e8ecSAndrew Rist  *
13*5900e8ecSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*5900e8ecSAndrew Rist  * software distributed under the License is distributed on an
15*5900e8ecSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*5900e8ecSAndrew Rist  * KIND, either express or implied.  See the License for the
17*5900e8ecSAndrew Rist  * specific language governing permissions and limitations
18*5900e8ecSAndrew Rist  * under the License.
19*5900e8ecSAndrew Rist  *
20*5900e8ecSAndrew Rist  *************************************************************/
21*5900e8ecSAndrew Rist 
22*5900e8ecSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_svtools.hxx"
26cdf0e10cSrcweir #include <stdio.h>
27cdf0e10cSrcweir #include <cppuhelper/servicefactory.hxx>
28cdf0e10cSrcweir #include <comphelper/processfactory.hxx>
29cdf0e10cSrcweir 
30cdf0e10cSrcweir #include <unotools/calendarwrapper.hxx>
31cdf0e10cSrcweir #include <unotools/localedatawrapper.hxx>
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
34cdf0e10cSrcweir #include <vcl/dialog.hxx>
35cdf0e10cSrcweir #include <vcl/msgbox.hxx>
36cdf0e10cSrcweir #include <vcl/print.hxx>
37cdf0e10cSrcweir #include <vcl/svapp.hxx>
38cdf0e10cSrcweir #include <vcl/help.hxx>
39cdf0e10cSrcweir #include <vcl/fixed.hxx>
40cdf0e10cSrcweir #include <vcl/button.hxx>
41cdf0e10cSrcweir #include <vcl/scrbar.hxx>
42cdf0e10cSrcweir #include <vcl/slider.hxx>
43cdf0e10cSrcweir #include <vcl/group.hxx>
44cdf0e10cSrcweir #include <vcl/toolbox.hxx>
45cdf0e10cSrcweir #include <vcl/status.hxx>
46cdf0e10cSrcweir #include <stdmenu.hxx>
47cdf0e10cSrcweir #include <ctrltool.hxx>
48cdf0e10cSrcweir #include <ctrlbox.hxx>
49cdf0e10cSrcweir #include <tabbar.hxx>
50cdf0e10cSrcweir #include <svtools/valueset.hxx>
51cdf0e10cSrcweir #include <svtools/headbar.hxx>
52cdf0e10cSrcweir #include <prgsbar.hxx>
53cdf0e10cSrcweir #include <calendar.hxx>
54cdf0e10cSrcweir #include <svtools/prnsetup.hxx>
55cdf0e10cSrcweir #include <svtools/printdlg.hxx>
56cdf0e10cSrcweir 
57cdf0e10cSrcweir using namespace ::com::sun::star;
58cdf0e10cSrcweir 
59cdf0e10cSrcweir // -----------------------------------------------------------------------
60cdf0e10cSrcweir 
61cdf0e10cSrcweir class MyApp : public Application
62cdf0e10cSrcweir {
63cdf0e10cSrcweir public:
64cdf0e10cSrcweir 	void Main();
65cdf0e10cSrcweir };
66cdf0e10cSrcweir 
67cdf0e10cSrcweir // -----------------------------------------------------------------------
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class ShowBitmap : public WorkWindow
70cdf0e10cSrcweir {
71cdf0e10cSrcweir 	Bitmap			aBmp;
72cdf0e10cSrcweir 
73cdf0e10cSrcweir public:
74cdf0e10cSrcweir 					ShowBitmap( Window* pParent, const Bitmap& rBmp );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& );
77cdf0e10cSrcweir 	virtual sal_Bool	Close();
78cdf0e10cSrcweir };
79cdf0e10cSrcweir 
80cdf0e10cSrcweir // -----------------------------------------------------------------------
81cdf0e10cSrcweir 
82cdf0e10cSrcweir class ShowFont : public Control
83cdf0e10cSrcweir {
84cdf0e10cSrcweir public:
85cdf0e10cSrcweir 					ShowFont( Window* pParent );
86cdf0e10cSrcweir 
87cdf0e10cSrcweir 	virtual void	Paint( const Rectangle& );
SetFont(const Font & rFont)88cdf0e10cSrcweir 	void			SetFont( const Font& rFont )
89cdf0e10cSrcweir 						{ Invalidate(); Control::SetFont( rFont ); }
90cdf0e10cSrcweir };
91cdf0e10cSrcweir 
92cdf0e10cSrcweir // --- class OrientSlider ------------------------------------------------
93cdf0e10cSrcweir 
94cdf0e10cSrcweir class OrientSlider : public Slider
95cdf0e10cSrcweir {
96cdf0e10cSrcweir public:
97cdf0e10cSrcweir 				OrientSlider( Window* pParent );
98cdf0e10cSrcweir 
GetOrientation() const99cdf0e10cSrcweir 	short		GetOrientation() const { return (short)GetThumbPos(); }
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir // -----------------------------------------------------------------------
103cdf0e10cSrcweir 
OrientSlider(Window * pParent)104cdf0e10cSrcweir OrientSlider::OrientSlider( Window* pParent ) :
105cdf0e10cSrcweir 	Slider( pParent, WB_HORZ | WB_DRAG )
106cdf0e10cSrcweir {
107cdf0e10cSrcweir 	SetThumbPos( 0 );
108cdf0e10cSrcweir 	SetLineSize( 10 );
109cdf0e10cSrcweir 	SetPageSize( 100 );
110cdf0e10cSrcweir 	SetRange( Range( 0, 3600 ) );
111cdf0e10cSrcweir }
112cdf0e10cSrcweir 
113cdf0e10cSrcweir // -----------------------------------------------------------------------
114cdf0e10cSrcweir 
115cdf0e10cSrcweir class MyFontDialog : public ModalDialog
116cdf0e10cSrcweir {
117cdf0e10cSrcweir private:
118cdf0e10cSrcweir 	FontList*		pList;
119cdf0e10cSrcweir 	Font			aCurFont;
120cdf0e10cSrcweir 	Printer 		aPrinter;
121cdf0e10cSrcweir 	FontNameBox 	aFontBox;
122cdf0e10cSrcweir 	FontStyleBox	aStyleBox;
123cdf0e10cSrcweir 	FontSizeBox 	aSizeBox;
124cdf0e10cSrcweir 	ListBox 		aUnderlineBox;
125cdf0e10cSrcweir 	ListBox 		aStrikeoutBox;
126cdf0e10cSrcweir 	CheckBox		aWordLineBox;
127cdf0e10cSrcweir 	CheckBox		aShadowBox;
128cdf0e10cSrcweir 	CheckBox		aOutlineBox;
129cdf0e10cSrcweir 	ColorListBox	aColorBox;
130cdf0e10cSrcweir 	GroupBox		aEffectBox;
131cdf0e10cSrcweir 	OrientSlider	aLineOrientSlider;
132cdf0e10cSrcweir 	ShowFont		aShowFont;
133cdf0e10cSrcweir 	GroupBox		aSampleBox;
134cdf0e10cSrcweir 	FixedText		aMapText;
135cdf0e10cSrcweir 	OKButton		aOKBtn;
136cdf0e10cSrcweir 	CancelButton	aCancelBtn;
137cdf0e10cSrcweir 
138cdf0e10cSrcweir public:
139cdf0e10cSrcweir 					MyFontDialog( Window* pParent );
140cdf0e10cSrcweir 
141cdf0e10cSrcweir 					DECL_LINK( SelectFont, ComboBox* );
142cdf0e10cSrcweir 					DECL_LINK( SelectStyle, ComboBox* );
143cdf0e10cSrcweir 					DECL_LINK( AttrHdl, Window * );
144cdf0e10cSrcweir 	void			SetAttr();
145cdf0e10cSrcweir 	short			Execute();
146cdf0e10cSrcweir };
147cdf0e10cSrcweir 
148cdf0e10cSrcweir // -----------------------------------------------------------------------
149cdf0e10cSrcweir 
150cdf0e10cSrcweir class MyTabBar : public TabBar
151cdf0e10cSrcweir {
152cdf0e10cSrcweir public:
MyTabBar(Window * pParent,WinBits nWinStyle=WB_STDTABBAR)153cdf0e10cSrcweir 					MyTabBar( Window* pParent,
154cdf0e10cSrcweir 							  WinBits nWinStyle = WB_STDTABBAR ) :
155cdf0e10cSrcweir 						TabBar( pParent, nWinStyle ) {}
156cdf0e10cSrcweir 
157cdf0e10cSrcweir 	virtual long	DeactivatePage();
158cdf0e10cSrcweir 	virtual long	AllowRenaming();
159cdf0e10cSrcweir 	virtual void	Split();
160cdf0e10cSrcweir };
161cdf0e10cSrcweir 
162cdf0e10cSrcweir // -----------------------------------------------------------------------
163cdf0e10cSrcweir 
164cdf0e10cSrcweir class MyCalendar : public WorkWindow
165cdf0e10cSrcweir {
166cdf0e10cSrcweir 	MenuBar 	aMenuBar;
167cdf0e10cSrcweir 	PopupMenu	aWeekStartMenu;
168cdf0e10cSrcweir 	PopupMenu	aWeekCountMenu;
169cdf0e10cSrcweir 	Calendar	aCalendar;
170cdf0e10cSrcweir 	Color		aInfoColor;
171cdf0e10cSrcweir 	Color		aHolidayColor;
172cdf0e10cSrcweir 	Color		aFrameColor;
173cdf0e10cSrcweir 
174cdf0e10cSrcweir public:
175cdf0e10cSrcweir 				MyCalendar( Window* pParent );
176cdf0e10cSrcweir 				~MyCalendar();
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 				DECL_LINK( RequestDateInfoHdl, Calendar* );
179cdf0e10cSrcweir 				DECL_LINK( DoubleClickHdl, Calendar* );
180cdf0e10cSrcweir 				DECL_LINK( MenuSelectHdl, Menu* );
181cdf0e10cSrcweir 
182cdf0e10cSrcweir 	void		Resize();
183cdf0e10cSrcweir };
184cdf0e10cSrcweir 
185cdf0e10cSrcweir // -----------------------------------------------------------------------
186cdf0e10cSrcweir 
187cdf0e10cSrcweir class MyWin : public WorkWindow
188cdf0e10cSrcweir {
189cdf0e10cSrcweir private:
190cdf0e10cSrcweir 	Printer 		aPrn;
191cdf0e10cSrcweir 	ToolBox 		aBox;
192cdf0e10cSrcweir 	StatusBar		aBar;
193cdf0e10cSrcweir 	HeaderBar		aHeadBar;
194cdf0e10cSrcweir 	ColorListBox	aColorList;
195cdf0e10cSrcweir 	LineListBox 	aLineList;
196cdf0e10cSrcweir 	ValueSet		aValueSet;
197cdf0e10cSrcweir 	CalendarField	aCalendarField;
198cdf0e10cSrcweir 	CalendarField	aCalendarField2;
199cdf0e10cSrcweir 	MyTabBar		aTabBar;
200cdf0e10cSrcweir 	ProgressBar 	aPrgsBar;
201cdf0e10cSrcweir 	PushButton		aFontBtn;
202cdf0e10cSrcweir 	PushButton		aCalendarBtn;
203cdf0e10cSrcweir 	PushButton		aPrnSetupBtn;
204cdf0e10cSrcweir 	PushButton		aPrnDlgBtn;
205cdf0e10cSrcweir 	Size			aBoxSize;
206cdf0e10cSrcweir 	MyCalendar* 	pCalendar;
207cdf0e10cSrcweir 	PopupMenu*		pMenu;
208cdf0e10cSrcweir 	FontNameMenu*	pNameMenu;
209cdf0e10cSrcweir 	FontStyleMenu*	pStyleMenu;
210cdf0e10cSrcweir 	FontSizeMenu*	pSizeMenu;
211cdf0e10cSrcweir 
212cdf0e10cSrcweir public:
213cdf0e10cSrcweir 					MyWin( Window* pParent, WinBits aWinStyle );
214cdf0e10cSrcweir 					~MyWin();
215cdf0e10cSrcweir 
216cdf0e10cSrcweir 					DECL_LINK( Test, PushButton* );
217cdf0e10cSrcweir 					DECL_LINK( SelectHdl, Window* );
218cdf0e10cSrcweir 					DECL_LINK( CalSelectHdl, CalendarField* );
219cdf0e10cSrcweir 	void			ContextMenu( const Point& rPos );
220cdf0e10cSrcweir 
221cdf0e10cSrcweir 	void			Command( const CommandEvent& rCEvt );
222cdf0e10cSrcweir 	void			MouseButtonDown( const MouseEvent& rMEvt );
223cdf0e10cSrcweir 	void			KeyInput( const KeyEvent& rKEvt );
224cdf0e10cSrcweir 	void			Paint( const Rectangle& rRect );
225cdf0e10cSrcweir 	void			Resize();
226cdf0e10cSrcweir };
227cdf0e10cSrcweir 
228cdf0e10cSrcweir // -----------------------------------------------------------------------
229cdf0e10cSrcweir 
Main()230cdf0e10cSrcweir void MyApp::Main()
231cdf0e10cSrcweir {
232cdf0e10cSrcweir     try
233cdf0e10cSrcweir     {
234cdf0e10cSrcweir         ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
235cdf0e10cSrcweir               xMSF = cppu::createRegistryServiceFactory(
236cdf0e10cSrcweir                   rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "applicat.rdb" ) ), sal_True );
237cdf0e10cSrcweir 
238cdf0e10cSrcweir         ::comphelper::setProcessServiceFactory( xMSF );
239cdf0e10cSrcweir 
240cdf0e10cSrcweir         Help aHelp;
241cdf0e10cSrcweir         SetHelp( &aHelp );
242cdf0e10cSrcweir         Help::EnableContextHelp();
243cdf0e10cSrcweir         Help::EnableExtHelp();
244cdf0e10cSrcweir         Help::EnableBalloonHelp();
245cdf0e10cSrcweir         Help::EnableQuickHelp();
246cdf0e10cSrcweir 
247cdf0e10cSrcweir         MyWin aMainWin( NULL, WinBits( WB_APP | WB_STDWORK | WB_CLIPCHILDREN ) );
248cdf0e10cSrcweir         aMainWin.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "SVTOOLS - Workbench" ) ) );
249cdf0e10cSrcweir         aMainWin.GrabFocus();
250cdf0e10cSrcweir         aMainWin.Show();
251cdf0e10cSrcweir 
252cdf0e10cSrcweir         Execute();
253cdf0e10cSrcweir     }
254cdf0e10cSrcweir     catch ( com::sun::star::uno::Exception & e )
255cdf0e10cSrcweir     {
256cdf0e10cSrcweir         fprintf( stderr, "Error during bootstrapping servicemanager: %s\n" ,
257cdf0e10cSrcweir                  rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_ASCII_US ).getStr() );
258cdf0e10cSrcweir     }
259cdf0e10cSrcweir }
260cdf0e10cSrcweir 
261cdf0e10cSrcweir // -----------------------------------------------------------------------
262cdf0e10cSrcweir 
ShowBitmap(Window * pParent,const Bitmap & rBmp)263cdf0e10cSrcweir ShowBitmap::ShowBitmap( Window* pParent, const Bitmap& rBmp ) :
264cdf0e10cSrcweir 	WorkWindow( pParent, WB_STDWORK ),
265cdf0e10cSrcweir 	aBmp( rBmp )
266cdf0e10cSrcweir {
267cdf0e10cSrcweir 	SetOutputSizePixel( rBmp.GetSizePixel() );
268cdf0e10cSrcweir 	SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Bitmap-Viewer" ) ) );
269cdf0e10cSrcweir 	Show();
270cdf0e10cSrcweir }
271cdf0e10cSrcweir 
272cdf0e10cSrcweir // -----------------------------------------------------------------------
273cdf0e10cSrcweir 
Paint(const Rectangle &)274cdf0e10cSrcweir void ShowBitmap::Paint( const Rectangle& )
275cdf0e10cSrcweir {
276cdf0e10cSrcweir 	DrawBitmap( Point(), GetOutputSizePixel(), aBmp );
277cdf0e10cSrcweir }
278cdf0e10cSrcweir 
279cdf0e10cSrcweir // -----------------------------------------------------------------------
280cdf0e10cSrcweir 
Close()281cdf0e10cSrcweir sal_Bool ShowBitmap::Close()
282cdf0e10cSrcweir {
283cdf0e10cSrcweir 	Hide();
284cdf0e10cSrcweir 	delete this;
285cdf0e10cSrcweir 	return sal_True;
286cdf0e10cSrcweir }
287cdf0e10cSrcweir 
288cdf0e10cSrcweir // -----------------------------------------------------------------------
289cdf0e10cSrcweir 
ShowFont(Window * pParent)290cdf0e10cSrcweir ShowFont::ShowFont( Window* pParent ) :
291cdf0e10cSrcweir 	Control( pParent, WB_BORDER )
292cdf0e10cSrcweir {
293cdf0e10cSrcweir 	SetMapMode( MapMode( MAP_POINT, Point(),
294cdf0e10cSrcweir 						 Fraction( 1, 10 ), Fraction( 1, 10 ) ) );
295cdf0e10cSrcweir 	SetBackground( Wallpaper( Color( COL_WHITE ) ) );
296cdf0e10cSrcweir }
297cdf0e10cSrcweir 
298cdf0e10cSrcweir // -----------------------------------------------------------------------
299cdf0e10cSrcweir 
Paint(const Rectangle &)300cdf0e10cSrcweir void ShowFont::Paint( const Rectangle& )
301cdf0e10cSrcweir {
302cdf0e10cSrcweir 	const Font& rFont = GetFont();
303cdf0e10cSrcweir 	String		aText;
304cdf0e10cSrcweir 	Size		aWindowSize( GetOutputSize() );
305cdf0e10cSrcweir 	long		x,y;
306cdf0e10cSrcweir 
307cdf0e10cSrcweir 	if ( rFont.GetOrientation() )
308cdf0e10cSrcweir 	{
309cdf0e10cSrcweir 		aText.Append( String::CreateFromInt32( rFont.GetOrientation()/10 ) );
310cdf0e10cSrcweir 		aText.AppendAscii( " degree." );
311cdf0e10cSrcweir 
312cdf0e10cSrcweir 		x = aWindowSize.Width()/2;
313cdf0e10cSrcweir 		y = aWindowSize.Height()/2;
314cdf0e10cSrcweir 	}
315cdf0e10cSrcweir 	else
316cdf0e10cSrcweir 	{
317cdf0e10cSrcweir 		aText = rFont.GetName();
318cdf0e10cSrcweir 		if ( !aText.Len() )
319cdf0e10cSrcweir 			aText.AssignAscii( "Sample" );
320cdf0e10cSrcweir 
321cdf0e10cSrcweir 		x = aWindowSize.Width()/2 - GetTextWidth( aText )/2;
322cdf0e10cSrcweir 		y = aWindowSize.Height()/2 - GetTextHeight()/2;
323cdf0e10cSrcweir 	}
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	DrawText( Point( x, y ), aText );
326cdf0e10cSrcweir }
327cdf0e10cSrcweir 
328cdf0e10cSrcweir // -----------------------------------------------------------------------
329cdf0e10cSrcweir 
MyFontDialog(Window * pParent)330cdf0e10cSrcweir MyFontDialog::MyFontDialog( Window* pParent ) :
331cdf0e10cSrcweir 	ModalDialog( pParent, WB_3DLOOK | WB_STDMODAL ),
332cdf0e10cSrcweir 	aFontBox( this ),
333cdf0e10cSrcweir 	aStyleBox( this ),
334cdf0e10cSrcweir 	aSizeBox( this ),
335cdf0e10cSrcweir 	aUnderlineBox( this, WB_DROPDOWN ),
336cdf0e10cSrcweir 	aStrikeoutBox( this, WB_DROPDOWN ),
337cdf0e10cSrcweir 	aWordLineBox( this ),
338cdf0e10cSrcweir 	aShadowBox( this ),
339cdf0e10cSrcweir 	aOutlineBox( this ),
340cdf0e10cSrcweir 	aColorBox( this, WB_DROPDOWN ),
341cdf0e10cSrcweir 	aEffectBox( this ),
342cdf0e10cSrcweir 	aLineOrientSlider( this ),
343cdf0e10cSrcweir 	aShowFont( this ),
344cdf0e10cSrcweir 	aSampleBox( this ),
345cdf0e10cSrcweir 	aMapText( this, WB_LEFT | WB_WORDBREAK ),
346cdf0e10cSrcweir 	aOKBtn( this, WB_DEFBUTTON ),
347cdf0e10cSrcweir 	aCancelBtn( this )
348cdf0e10cSrcweir {
349cdf0e10cSrcweir 	pList = NULL;
350cdf0e10cSrcweir 
351cdf0e10cSrcweir 	aFontBox.EnableWYSIWYG( sal_True );
352cdf0e10cSrcweir 	aFontBox.EnableSymbols( sal_True );
353cdf0e10cSrcweir 	aFontBox.SetPosSizePixel( Point( 10, 10 ), Size( 140, 140 ) );
354cdf0e10cSrcweir 	aFontBox.SetSelectHdl( LINK( this, MyFontDialog, SelectFont ) );
355cdf0e10cSrcweir 	aFontBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectFont ) );
356cdf0e10cSrcweir 	aFontBox.Show();
357cdf0e10cSrcweir 
358cdf0e10cSrcweir 	aStyleBox.SetPosSizePixel( Point( 160, 10 ), Size( 100, 140 ) );
359cdf0e10cSrcweir 	aStyleBox.SetSelectHdl( LINK( this, MyFontDialog, SelectStyle ) );
360cdf0e10cSrcweir 	aStyleBox.SetLoseFocusHdl( LINK( this, MyFontDialog, SelectStyle ) );
361cdf0e10cSrcweir 	aStyleBox.Show();
362cdf0e10cSrcweir 
363cdf0e10cSrcweir 	aSizeBox.SetPosSizePixel( Point( 270, 10 ), Size( 60, 140 ) );
364cdf0e10cSrcweir 	aSizeBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
365cdf0e10cSrcweir 	aSizeBox.SetLoseFocusHdl( LINK( this, MyFontDialog, AttrHdl ) );
366cdf0e10cSrcweir 	aSizeBox.Show();
367cdf0e10cSrcweir 
368cdf0e10cSrcweir 	aUnderlineBox.SetPosSizePixel( Point( 15, 180 ), Size( 130, 100 ) );
369cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_NONE" ) ) );
370cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SINGLE" ) ) );
371cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLE" ) ) );
372cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOTTED" ) ) );
373cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DONTKNOW" ) ) );
374cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASH" ) ) );
375cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_LONGDASH" ) ) );
376cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOT" ) ) );
377cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DASHDOTDOT" ) ) );
378cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_SMALLWAVE" ) ) );
379cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_WAVE" ) ) );
380cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_DOUBLEWAVE" ) ) );
381cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLD" ) ) );
382cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDOTTED" ) ) );
383cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASH" ) ) );
384cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDLONGDASH" ) ) );
385cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOT" ) ) );
386cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDDASHDOTDOT" ) ) );
387cdf0e10cSrcweir 	aUnderlineBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "UNDERLINE_BOLDWAVE" ) ) );
388cdf0e10cSrcweir 	aUnderlineBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
389cdf0e10cSrcweir 	aUnderlineBox.Show();
390cdf0e10cSrcweir 
391cdf0e10cSrcweir 	aStrikeoutBox.SetPosSizePixel( Point( 15, 210 ), Size( 130, 100 ) );
392cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_NONE" ) ) );
393cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SINGLE" ) ) );
394cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DOUBLE" ) ) );
395cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_DONTKNOW" ) ) );
396cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_BOLD" ) ) );
397cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_SLASH" ) ) );
398cdf0e10cSrcweir 	aStrikeoutBox.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "STRIKEOUT_X" ) ) );
399cdf0e10cSrcweir 	aStrikeoutBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
400cdf0e10cSrcweir 	aStrikeoutBox.Show();
401cdf0e10cSrcweir 
402cdf0e10cSrcweir 	aWordLineBox.SetPosSizePixel( Point( 15, 240 ), Size( 130, 19 ) );
403cdf0e10cSrcweir 	aWordLineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Only ~Words" ) ) );
404cdf0e10cSrcweir 	aWordLineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
405cdf0e10cSrcweir 	aWordLineBox.Show();
406cdf0e10cSrcweir 
407cdf0e10cSrcweir 	aShadowBox.SetPosSizePixel( Point( 15, 260 ), Size( 130, 19 ) );
408cdf0e10cSrcweir 	aShadowBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ) );
409cdf0e10cSrcweir 	aShadowBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
410cdf0e10cSrcweir 	aShadowBox.Show();
411cdf0e10cSrcweir 
412cdf0e10cSrcweir 	aOutlineBox.SetPosSizePixel( Point( 15, 280 ), Size( 130, 19 ) );
413cdf0e10cSrcweir 	aOutlineBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ) );
414cdf0e10cSrcweir 	aOutlineBox.SetClickHdl( LINK( this, MyFontDialog, AttrHdl ) );
415cdf0e10cSrcweir 	aOutlineBox.Show();
416cdf0e10cSrcweir 
417cdf0e10cSrcweir 	{
418cdf0e10cSrcweir 	aColorBox.SetPosSizePixel( Point( 15, 305 ), Size( 130, 100 ) );
419cdf0e10cSrcweir 	aColorBox.SetSelectHdl( LINK( this, MyFontDialog, AttrHdl ) );
420cdf0e10cSrcweir 	aColorBox.SetUpdateMode( sal_False );
421cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_BLACK ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
422cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_BLUE ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
423cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_GREEN ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
424cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_CYAN ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
425cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_RED ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
426cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_MAGENTA ),	   XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
427cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_BROWN ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
428cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_GRAY ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
429cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTGRAY ),	   XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
430cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTBLUE ),	   XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
431cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTGREEN ),    XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
432cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTCYAN ),	   XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
433cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTRED ),	   XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
434cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_LIGHTMAGENTA ),  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
435cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_YELLOW ), 	   XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
436cdf0e10cSrcweir 	aColorBox.InsertEntry( Color( COL_WHITE ),		   XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
437cdf0e10cSrcweir 	aColorBox.SetUpdateMode( sal_True );
438cdf0e10cSrcweir 	aColorBox.Show();
439cdf0e10cSrcweir 	}
440cdf0e10cSrcweir 
441cdf0e10cSrcweir 	aEffectBox.SetPosSizePixel( Point( 10, 160 ), Size( 140, 175 ) );
442cdf0e10cSrcweir 	aEffectBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Effects" ) ) );
443cdf0e10cSrcweir 	aEffectBox.Show();
444cdf0e10cSrcweir 
445cdf0e10cSrcweir 	Size aSliderSize = aLineOrientSlider.GetSizePixel();
446cdf0e10cSrcweir 	aLineOrientSlider.SetPosSizePixel( Point( 160, 335-aSliderSize.Height() ),
447cdf0e10cSrcweir 									   Size( 250, aSliderSize.Height() ) );
448cdf0e10cSrcweir 	aLineOrientSlider.SetSlideHdl( LINK( this, MyFontDialog, AttrHdl ) );
449cdf0e10cSrcweir 	aLineOrientSlider.Show();
450cdf0e10cSrcweir 
451cdf0e10cSrcweir 	aShowFont.SetPosSizePixel( Point( 165, 180 ), Size( 240, 70 ) );
452cdf0e10cSrcweir 	aShowFont.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
453cdf0e10cSrcweir 	aShowFont.Show();
454cdf0e10cSrcweir 
455cdf0e10cSrcweir 	aSampleBox.SetPosSizePixel( Point( 160, 160 ), Size( 250, 100 ) );
456cdf0e10cSrcweir 	aSampleBox.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Sample" ) ) );
457cdf0e10cSrcweir 	aSampleBox.Show();
458cdf0e10cSrcweir 
459cdf0e10cSrcweir 	aMapText.SetPosSizePixel( Point( 160, 270 ), Size( 250, 35 ) );
460cdf0e10cSrcweir 	aMapText.Show();
461cdf0e10cSrcweir 
462cdf0e10cSrcweir 	aOKBtn.SetPosSizePixel( Point( 340, 10 ), Size( 70, 25 ) );
463cdf0e10cSrcweir 	aOKBtn.Show();
464cdf0e10cSrcweir 
465cdf0e10cSrcweir 	aCancelBtn.SetPosSizePixel( Point( 340, 40 ), Size( 70, 25 ) );
466cdf0e10cSrcweir 	aCancelBtn.Show();
467cdf0e10cSrcweir 
468cdf0e10cSrcweir 	SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "FontDialog" ) ) );
469cdf0e10cSrcweir 	SetOutputSizePixel( Size( 420, 345 ) );
470cdf0e10cSrcweir }
471cdf0e10cSrcweir 
472cdf0e10cSrcweir // -----------------------------------------------------------------------
473cdf0e10cSrcweir 
IMPL_LINK(MyFontDialog,SelectFont,ComboBox *,EMPTYARG)474cdf0e10cSrcweir IMPL_LINK( MyFontDialog, SelectFont, ComboBox*, EMPTYARG )
475cdf0e10cSrcweir {
476cdf0e10cSrcweir 	aStyleBox.Fill( aFontBox.GetText(), pList );
477cdf0e10cSrcweir 	FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
478cdf0e10cSrcweir 	aSizeBox.Fill( &aInfo, pList );
479cdf0e10cSrcweir 	SetAttr();
480cdf0e10cSrcweir 	return 0;
481cdf0e10cSrcweir }
482cdf0e10cSrcweir 
483cdf0e10cSrcweir // -----------------------------------------------------------------------
484cdf0e10cSrcweir 
IMPL_LINK(MyFontDialog,SelectStyle,ComboBox *,EMPTYARG)485cdf0e10cSrcweir IMPL_LINK( MyFontDialog, SelectStyle, ComboBox*, EMPTYARG )
486cdf0e10cSrcweir {
487cdf0e10cSrcweir 	FontInfo aInfo = pList->Get( aFontBox.GetText(), aStyleBox.GetText() );
488cdf0e10cSrcweir 	aSizeBox.Fill( &aInfo, pList );
489cdf0e10cSrcweir 	SetAttr();
490cdf0e10cSrcweir 	return 0;
491cdf0e10cSrcweir }
492cdf0e10cSrcweir 
493cdf0e10cSrcweir // -----------------------------------------------------------------------
494cdf0e10cSrcweir 
IMPL_LINK(MyFontDialog,AttrHdl,Window *,EMPTYARG)495cdf0e10cSrcweir IMPL_LINK( MyFontDialog, AttrHdl, Window*, EMPTYARG )
496cdf0e10cSrcweir {
497cdf0e10cSrcweir 	SetAttr();
498cdf0e10cSrcweir 	return 0;
499cdf0e10cSrcweir }
500cdf0e10cSrcweir 
501cdf0e10cSrcweir // -----------------------------------------------------------------------
502cdf0e10cSrcweir 
SetAttr()503cdf0e10cSrcweir void MyFontDialog::SetAttr()
504cdf0e10cSrcweir {
505cdf0e10cSrcweir 	FontInfo aFont( pList->Get( aFontBox.GetText(), aStyleBox.GetText() ) );
506cdf0e10cSrcweir 	aFont.SetSize( Size( 0, aSizeBox.GetValue() ) );
507cdf0e10cSrcweir 	aFont.SetUnderline( (FontUnderline)aUnderlineBox.GetSelectEntryPos() );
508cdf0e10cSrcweir 	aFont.SetStrikeout( (FontStrikeout)aStrikeoutBox.GetSelectEntryPos() );
509cdf0e10cSrcweir 	aFont.SetColor( Color( (ColorData)aColorBox.GetSelectEntryPos() ) );
510cdf0e10cSrcweir 	aFont.SetWordLineMode( aWordLineBox.IsChecked() );
511cdf0e10cSrcweir 	aFont.SetShadow( aShadowBox.IsChecked() );
512cdf0e10cSrcweir 	aFont.SetOutline( aOutlineBox.IsChecked() );
513cdf0e10cSrcweir 	aFont.SetOrientation( aLineOrientSlider.GetOrientation() );
514cdf0e10cSrcweir 	aFont.SetTransparent( sal_True );
515cdf0e10cSrcweir 	aMapText.SetText( pList->GetFontMapText( aFont ) );
516cdf0e10cSrcweir 	aShowFont.SetFont( aFont );
517cdf0e10cSrcweir }
518cdf0e10cSrcweir 
519cdf0e10cSrcweir // -----------------------------------------------------------------------
520cdf0e10cSrcweir 
Execute()521cdf0e10cSrcweir short MyFontDialog::Execute()
522cdf0e10cSrcweir {
523cdf0e10cSrcweir 	pList = new FontList( &aPrinter, this );
524cdf0e10cSrcweir 	aFontBox.Fill( pList );
525cdf0e10cSrcweir 	aSizeBox.SetValue( 120 );
526cdf0e10cSrcweir 	aUnderlineBox.SelectEntryPos( 0 );
527cdf0e10cSrcweir 	aStrikeoutBox.SelectEntryPos( 0 );
528cdf0e10cSrcweir 	aColorBox.SelectEntryPos( 0 );
529cdf0e10cSrcweir 	SelectFont( &aFontBox );
530cdf0e10cSrcweir 	short nRet = ModalDialog::Execute();
531cdf0e10cSrcweir 	delete pList;
532cdf0e10cSrcweir 	return nRet;
533cdf0e10cSrcweir }
534cdf0e10cSrcweir 
535cdf0e10cSrcweir // -----------------------------------------------------------------------
536cdf0e10cSrcweir 
DeactivatePage()537cdf0e10cSrcweir long MyTabBar::DeactivatePage()
538cdf0e10cSrcweir {
539cdf0e10cSrcweir 	if ( GetCurPageId() == 6 )
540cdf0e10cSrcweir 	{
541cdf0e10cSrcweir 		QueryBox aQueryBox( this, WB_YES_NO | WB_DEF_YES,
542cdf0e10cSrcweir 							XubString( RTL_CONSTASCII_USTRINGPARAM( "Deactivate" ) ) );
543cdf0e10cSrcweir 		if ( aQueryBox.Execute() == RET_YES )
544cdf0e10cSrcweir 			return sal_True;
545cdf0e10cSrcweir 		else
546cdf0e10cSrcweir 			return sal_False;
547cdf0e10cSrcweir 	}
548cdf0e10cSrcweir 	else
549cdf0e10cSrcweir 		return sal_True;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir // -----------------------------------------------------------------------
553cdf0e10cSrcweir 
AllowRenaming()554cdf0e10cSrcweir long MyTabBar::AllowRenaming()
555cdf0e10cSrcweir {
556cdf0e10cSrcweir 	XubString aStr( RTL_CONSTASCII_USTRINGPARAM( "Allow renaming: " ) );
557cdf0e10cSrcweir 	aStr += GetEditText();
558cdf0e10cSrcweir 	QueryBox aQueryBox( this, WB_YES_NO_CANCEL | WB_DEF_YES, aStr );
559cdf0e10cSrcweir 	long nRet = aQueryBox.Execute();
560cdf0e10cSrcweir 	if ( nRet == RET_YES )
561cdf0e10cSrcweir 		return TAB_RENAMING_YES;
562cdf0e10cSrcweir 	else if ( nRet == RET_NO )
563cdf0e10cSrcweir 		return TAB_RENAMING_NO;
564cdf0e10cSrcweir 	else // ( nRet == RET_CANCEL )
565cdf0e10cSrcweir 		return TAB_RENAMING_CANCEL;
566cdf0e10cSrcweir }
567cdf0e10cSrcweir 
568cdf0e10cSrcweir // -----------------------------------------------------------------------
569cdf0e10cSrcweir 
Split()570cdf0e10cSrcweir void MyTabBar::Split()
571cdf0e10cSrcweir {
572cdf0e10cSrcweir 	Size	aSize = GetSizePixel();
573cdf0e10cSrcweir 	long	nWidth = GetSplitSize();
574cdf0e10cSrcweir 	long	nMaxWidth = GetParent()->GetOutputSizePixel().Width()-50;
575cdf0e10cSrcweir 	if ( nWidth < GetMinSize() )
576cdf0e10cSrcweir 		nWidth = GetMinSize();
577cdf0e10cSrcweir 	else if ( nWidth > nMaxWidth )
578cdf0e10cSrcweir 		nWidth = nMaxWidth;
579cdf0e10cSrcweir 	SetSizePixel( Size( nWidth, aSize.Height() ) );
580cdf0e10cSrcweir }
581cdf0e10cSrcweir 
582cdf0e10cSrcweir // -----------------------------------------------------------------------
583cdf0e10cSrcweir 
MyCalendar(Window * pParent)584cdf0e10cSrcweir MyCalendar::MyCalendar( Window* pParent ) :
585cdf0e10cSrcweir 	WorkWindow( pParent, WB_STDWORK ),
586cdf0e10cSrcweir 	aCalendar( this, WB_TABSTOP | WB_WEEKNUMBER | WB_BOLDTEXT | WB_FRAMEINFO | WB_MULTISELECT ),
587cdf0e10cSrcweir 	aInfoColor( COL_LIGHTBLUE ),
588cdf0e10cSrcweir 	aHolidayColor( COL_LIGHTRED ),
589cdf0e10cSrcweir 	aFrameColor( COL_LIGHTRED )
590cdf0e10cSrcweir {
591cdf0e10cSrcweir     const CalendarWrapper& rCal = aCalendar.GetCalendarWrapper();
592cdf0e10cSrcweir 	aMenuBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Wochen~anfang" ) ) );
593cdf0e10cSrcweir 	aMenuBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Erste Woche" ) ) );
594cdf0e10cSrcweir 	aMenuBar.SetPopupMenu( 1, &aWeekStartMenu );
595cdf0e10cSrcweir 	aMenuBar.SetPopupMenu( 2, &aWeekCountMenu );
596cdf0e10cSrcweir     sal_Int16 nDays = rCal.getNumberOfDaysInWeek();
597cdf0e10cSrcweir     uno::Sequence< i18n::CalendarItem> xItems = rCal.getDays();
598cdf0e10cSrcweir     const i18n::CalendarItem* pArr = xItems.getArray();
599cdf0e10cSrcweir 	for ( sal_Int16 i = 0; i < nDays; i++ )
600cdf0e10cSrcweir 		aWeekStartMenu.InsertItem( 10+(sal_uInt16)i, pArr[i].FullName, MIB_AUTOCHECK | MIB_RADIOCHECK );
601cdf0e10cSrcweir 	aWeekStartMenu.CheckItem( 10+(sal_uInt16)rCal.getFirstDayOfWeek() );
602cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "~1. Januar" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
603cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "~2 days" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
604cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "~3 days" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
605cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 23, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste 4 ~Tage-Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
606cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 24, XubString( RTL_CONSTASCII_USTRINGPARAM( "~5 days" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
607cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 25, XubString( RTL_CONSTASCII_USTRINGPARAM( "~6 days" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
608cdf0e10cSrcweir 	aWeekCountMenu.InsertItem( 26, XubString( RTL_CONSTASCII_USTRINGPARAM( "Erste ~volle Woche" ) ), MIB_AUTOCHECK | MIB_RADIOCHECK );
609cdf0e10cSrcweir 	//was: one of 0, 1, 2;  aWeekCountMenu.CheckItem( 20+(sal_uInt16)rIntn.GetWeekCountStart() );
610cdf0e10cSrcweir 	aWeekCountMenu.CheckItem( 20+(sal_uInt16)rCal.getMinimumNumberOfDaysForFirstWeek() );
611cdf0e10cSrcweir 	aMenuBar.SetSelectHdl( LINK( this, MyCalendar, MenuSelectHdl ) );
612cdf0e10cSrcweir 	SetMenuBar( &aMenuBar );
613cdf0e10cSrcweir 
614cdf0e10cSrcweir 	Date aCurDate = aCalendar.GetCurDate();
615cdf0e10cSrcweir 	aCalendar.SetRequestDateInfoHdl( LINK( this, MyCalendar, RequestDateInfoHdl ) );
616cdf0e10cSrcweir 	aCalendar.SetDoubleClickHdl( LINK( this, MyCalendar, DoubleClickHdl ) );
617cdf0e10cSrcweir 	aCalendar.SetSaturdayColor( Color( COL_LIGHTGREEN ) );
618cdf0e10cSrcweir 	aCalendar.SetSundayColor( aHolidayColor );
619cdf0e10cSrcweir 	aCalendar.AddDateInfo( Date(  1,  1, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Neujahr" ) ), &aHolidayColor, NULL );
620cdf0e10cSrcweir 	aCalendar.AddDateInfo( Date( 24, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Heiligabend" ) ), &aInfoColor, NULL );
621cdf0e10cSrcweir 	aCalendar.AddDateInfo( Date( 25, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "1. Weihnachttag" ) ), &aHolidayColor, NULL );
622cdf0e10cSrcweir 	aCalendar.AddDateInfo( Date( 26, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "2. Weihnachttag" ) ), &aHolidayColor, NULL );
623cdf0e10cSrcweir 	aCalendar.AddDateInfo( Date( 31, 12, 0 ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Silvester" ) ), &aInfoColor, NULL );
624cdf0e10cSrcweir 	aCalendar.SetPosPixel( Point() );
625cdf0e10cSrcweir 	aCalendar.SetFirstDate( Date( 1, 1, aCurDate.GetYear() ) );
626cdf0e10cSrcweir 	aCalendar.Show();
627cdf0e10cSrcweir 
628cdf0e10cSrcweir 	SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
629cdf0e10cSrcweir 	SetOutputSizePixel( aCalendar.CalcWindowSizePixel( 3, 4 ) );
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir // -----------------------------------------------------------------------
633cdf0e10cSrcweir 
~MyCalendar()634cdf0e10cSrcweir MyCalendar::~MyCalendar()
635cdf0e10cSrcweir {
636cdf0e10cSrcweir 	SetMenuBar( NULL );
637cdf0e10cSrcweir 	aMenuBar.SetPopupMenu( 1, NULL );
638cdf0e10cSrcweir 	aMenuBar.SetPopupMenu( 2, NULL );
639cdf0e10cSrcweir }
640cdf0e10cSrcweir 
641cdf0e10cSrcweir // -----------------------------------------------------------------------
642cdf0e10cSrcweir 
IMPL_LINK(MyCalendar,RequestDateInfoHdl,Calendar *,EMPTYARG)643cdf0e10cSrcweir IMPL_LINK( MyCalendar, RequestDateInfoHdl, Calendar*, EMPTYARG )
644cdf0e10cSrcweir {
645cdf0e10cSrcweir 	sal_uInt16 nRequestYear = aCalendar.GetRequestYear();
646cdf0e10cSrcweir 	if ( (nRequestYear >= 1954) && (nRequestYear <= 1989) )
647cdf0e10cSrcweir 		aCalendar.AddDateInfo( Date(  17, 6, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
648cdf0e10cSrcweir 	else if ( nRequestYear >=  1990 )
649cdf0e10cSrcweir 		aCalendar.AddDateInfo( Date(  3, 10, nRequestYear ), XubString( RTL_CONSTASCII_USTRINGPARAM( "Tag der deutschen Einheit" ) ), &aHolidayColor, NULL );
650cdf0e10cSrcweir 	return 0;
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir // -----------------------------------------------------------------------
654cdf0e10cSrcweir 
IMPL_LINK(MyCalendar,DoubleClickHdl,Calendar *,EMPTYARG)655cdf0e10cSrcweir IMPL_LINK( MyCalendar, DoubleClickHdl, Calendar*, EMPTYARG )
656cdf0e10cSrcweir {
657cdf0e10cSrcweir 	Date aDate = aCalendar.GetCurDate();
658cdf0e10cSrcweir 	String aStr( RTL_CONSTASCII_USTRINGPARAM( "Info: " ) );
659cdf0e10cSrcweir 	aStr += Application::GetAppLocaleDataWrapper().getDate( aDate );
660cdf0e10cSrcweir 	aCalendar.AddDateInfo( aDate, aStr, NULL, &aFrameColor, DIB_BOLD );
661cdf0e10cSrcweir 	return 0;
662cdf0e10cSrcweir }
663cdf0e10cSrcweir 
664cdf0e10cSrcweir // -----------------------------------------------------------------------
665cdf0e10cSrcweir 
IMPL_LINK(MyCalendar,MenuSelectHdl,Menu *,pMenu)666cdf0e10cSrcweir IMPL_LINK( MyCalendar, MenuSelectHdl, Menu*, pMenu )
667cdf0e10cSrcweir {
668cdf0e10cSrcweir 	sal_uInt16			nItemId = pMenu->GetCurItemId();
669cdf0e10cSrcweir 
670cdf0e10cSrcweir 	if ( (nItemId >= 10) && (nItemId <= 19) )
671cdf0e10cSrcweir 		aCalendar.SetWeekStart( nItemId-10 );
672cdf0e10cSrcweir 	else if ( (nItemId >= 20) && (nItemId <= 29) )
673cdf0e10cSrcweir 		aCalendar.SetMinimumNumberOfDaysInWeek( nItemId-20 );
674cdf0e10cSrcweir 
675cdf0e10cSrcweir 	return 0;
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir // -----------------------------------------------------------------------
679cdf0e10cSrcweir 
Resize()680cdf0e10cSrcweir void MyCalendar::Resize()
681cdf0e10cSrcweir {
682cdf0e10cSrcweir 	aCalendar.SetSizePixel( GetOutputSizePixel() );
683cdf0e10cSrcweir }
684cdf0e10cSrcweir 
685cdf0e10cSrcweir // -----------------------------------------------------------------------
686cdf0e10cSrcweir 
MyWin(Window * pParent,WinBits aWinStyle)687cdf0e10cSrcweir MyWin::MyWin( Window* pParent, WinBits aWinStyle ) :
688cdf0e10cSrcweir 	WorkWindow(pParent, aWinStyle | WB_3DLOOK ),
689cdf0e10cSrcweir 	aBox( this, WB_BORDER | WB_3DLOOK ),
690cdf0e10cSrcweir 	aBar( this, WB_BORDER | WB_3DLOOK | WB_RIGHT ),
691cdf0e10cSrcweir 	aHeadBar( this, WB_BORDER | WB_3DLOOK | WB_DRAG | WB_BUTTONSTYLE ),
692cdf0e10cSrcweir 	aColorList( this ),
693cdf0e10cSrcweir 	aLineList( this ),
694cdf0e10cSrcweir 	aValueSet( this, WB_TABSTOP | WB_NAMEFIELD | WB_NONEFIELD | WB_BORDER | WB_ITEMBORDER | WB_VSCROLL /* | WB_FLATVALUESET */ ),
695cdf0e10cSrcweir 	aCalendarField( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
696cdf0e10cSrcweir 	aCalendarField2( this, WB_TABSTOP | WB_SPIN | WB_REPEAT | WB_DROPDOWN | WB_BORDER ),
697cdf0e10cSrcweir 	aTabBar( this, WB_BORDER | WB_MULTISELECT | WB_SCROLL | WB_SIZEABLE | WB_DRAG ),
698cdf0e10cSrcweir 	aPrgsBar( this ),
699cdf0e10cSrcweir 	aFontBtn( this ),
700cdf0e10cSrcweir 	aCalendarBtn( this ),
701cdf0e10cSrcweir 	aPrnSetupBtn( this ),
702cdf0e10cSrcweir 	aPrnDlgBtn( this )
703cdf0e10cSrcweir {
704cdf0e10cSrcweir 	SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFaceColor() ) );
705cdf0e10cSrcweir 
706cdf0e10cSrcweir 	pCalendar = NULL;
707cdf0e10cSrcweir 	pMenu = NULL;
708cdf0e10cSrcweir 
709cdf0e10cSrcweir 	Bitmap aBmp;
710cdf0e10cSrcweir 	aBox.InsertItem(  1, aBmp );
711cdf0e10cSrcweir 	aBox.InsertItem(  2, aBmp );
712cdf0e10cSrcweir 	aBox.InsertItem(  3, aBmp );
713cdf0e10cSrcweir 	aBox.InsertItem(  4, aBmp );
714cdf0e10cSrcweir 	aBox.InsertSeparator();
715cdf0e10cSrcweir 	aBox.InsertItem(  5, aBmp );
716cdf0e10cSrcweir 	aBox.InsertItem(  6, aBmp );
717cdf0e10cSrcweir 	aBox.InsertItem(  7, aBmp );
718cdf0e10cSrcweir 	aBox.InsertItem(  8, aBmp );
719cdf0e10cSrcweir 	aBox.InsertSpace();
720cdf0e10cSrcweir 	aBox.InsertItem(  9, aBmp );
721cdf0e10cSrcweir 	aBox.SetPosPixel( Point( 0, 0 ) );
722cdf0e10cSrcweir 	aBoxSize = aBox.GetSizePixel();
723cdf0e10cSrcweir 	aBox.Show();
724cdf0e10cSrcweir 
725cdf0e10cSrcweir 	aBar.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Ready" ) ) );
726cdf0e10cSrcweir 	aBar.InsertItem( 1, 35 );
727cdf0e10cSrcweir 	aBar.InsertItem( 2, 55 );
728cdf0e10cSrcweir 	aBar.InsertItem( 3, 55 );
729cdf0e10cSrcweir 	aBar.SetItemText( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Text" ) ) );
730cdf0e10cSrcweir 	aBar.SetItemText( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "21.01.93" ) ) );
731cdf0e10cSrcweir 	aBar.SetItemText( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "12:00:00" ) ) );
732cdf0e10cSrcweir 	aBar.Show();
733cdf0e10cSrcweir 
734cdf0e10cSrcweir 	long nY = aBox.GetSizePixel().Height()+10;
735cdf0e10cSrcweir 	{
736cdf0e10cSrcweir 	aHeadBar.SetPosPixel( Point( 0, nY ) );
737cdf0e10cSrcweir 	aHeadBar.InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Sender" ) ), 150 );
738cdf0e10cSrcweir 	aHeadBar.InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Subject" ) ), 150, HIB_CENTER | HIB_VCENTER | HIB_CLICKABLE );
739cdf0e10cSrcweir 	aHeadBar.InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Date" ) ), 75 );
740cdf0e10cSrcweir 	aHeadBar.InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Size" ) ), 60, HIB_RIGHT | HIB_VCENTER | HIB_CLICKABLE );
741cdf0e10cSrcweir 	aHeadBar.InsertItem( 9999, String(), HEADERBAR_FULLSIZE, HIB_RIGHT | HIB_VCENTER | HIB_FIXEDPOS );
742cdf0e10cSrcweir 	aHeadBar.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
743cdf0e10cSrcweir 	aHeadBar.Show();
744cdf0e10cSrcweir 	nY += aHeadBar.GetSizePixel().Height() += 10;
745cdf0e10cSrcweir 	}
746cdf0e10cSrcweir 
747cdf0e10cSrcweir 	{
748cdf0e10cSrcweir 	aColorList.SetPosSizePixel( Point( 10, nY ), Size( 130, 180 ) );
749cdf0e10cSrcweir 	aColorList.SetUpdateMode( sal_False );
750cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_BLACK ), 		XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
751cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_BLUE ),			XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
752cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_GREEN ), 		XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
753cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_CYAN ),			XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
754cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_RED ),			XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
755cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_MAGENTA ),		XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
756cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_BROWN ), 		XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
757cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_GRAY ),			XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
758cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTGRAY ), 	XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
759cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTBLUE ), 	XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
760cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTGREEN ),	XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
761cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTCYAN ), 	XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
762cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTRED ),		XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
763cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_LIGHTMAGENTA ),	XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
764cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_YELLOW ),		XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
765cdf0e10cSrcweir 	aColorList.InsertEntry( Color( COL_WHITE ), 		XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
766cdf0e10cSrcweir 	aColorList.SetUpdateMode( sal_True );
767cdf0e10cSrcweir 	aColorList.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
768cdf0e10cSrcweir 	aColorList.Show();
769cdf0e10cSrcweir 	}
770cdf0e10cSrcweir 
771cdf0e10cSrcweir 	{
772cdf0e10cSrcweir 	aLineList.SetPosSizePixel( Point( 150, nY ), Size( 130, 180 ) );
773cdf0e10cSrcweir 	aLineList.SetUnit( FUNIT_POINT );
774cdf0e10cSrcweir 	aLineList.SetSourceUnit( FUNIT_TWIP );
775cdf0e10cSrcweir 	aLineList.InsertEntry( XubString( RTL_CONSTASCII_USTRINGPARAM( "Hairline" ) ) );
776cdf0e10cSrcweir 	aLineList.InsertEntry( 1500 );
777cdf0e10cSrcweir 	aLineList.InsertEntry( 3000 );
778cdf0e10cSrcweir 	aLineList.InsertEntry( 4500 );
779cdf0e10cSrcweir 	aLineList.InsertEntry( 6000 );
780cdf0e10cSrcweir 	aLineList.InsertEntry( 7500 );
781cdf0e10cSrcweir 	aLineList.InsertEntry( 9000 );
782cdf0e10cSrcweir 	aLineList.InsertEntry( 1500, 1500, 1500 );
783cdf0e10cSrcweir 	aLineList.InsertEntry( 3000, 1500, 1500 );
784cdf0e10cSrcweir 	aLineList.InsertEntry( 4500, 1500, 1500 );
785cdf0e10cSrcweir 	aLineList.InsertEntry( 3000, 3000, 1500 );
786cdf0e10cSrcweir 	aLineList.InsertEntry( 4500, 3000, 1500 );
787cdf0e10cSrcweir 	aLineList.InsertEntry( 4500, 4500, 1500 );
788cdf0e10cSrcweir 	aLineList.Show();
789cdf0e10cSrcweir 	}
790cdf0e10cSrcweir 
791cdf0e10cSrcweir 	{
792cdf0e10cSrcweir 	aValueSet.SetPosSizePixel( Point( 290, nY ), Size( 130, 180 ) );
793cdf0e10cSrcweir 	aValueSet.InsertItem(  9, Color( COL_BLACK ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Black" ) ) );
794cdf0e10cSrcweir 	aValueSet.InsertItem( 10, Color( COL_BLUE ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Blue" ) ) );
795cdf0e10cSrcweir 	aValueSet.InsertItem( 11, Color( COL_GREEN ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Green" ) ) );
796cdf0e10cSrcweir 	aValueSet.InsertItem( 12, Color( COL_CYAN ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Cyan" ) ) );
797cdf0e10cSrcweir 	aValueSet.InsertItem( 13, Color( COL_RED ), 		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Red" ) ) );
798cdf0e10cSrcweir 	aValueSet.InsertItem( 14, Color( COL_MAGENTA ), 	  XubString( RTL_CONSTASCII_USTRINGPARAM( "Magenta" ) ) );
799cdf0e10cSrcweir 	aValueSet.InsertItem( 15, Color( COL_BROWN ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Brown" ) ) );
800cdf0e10cSrcweir 	aValueSet.InsertItem( 16, Color( COL_GRAY ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Gray" ) ) );
801cdf0e10cSrcweir 	aValueSet.InsertItem( 17, Color( COL_LIGHTGRAY ),	  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGray" ) ) );
802cdf0e10cSrcweir 	aValueSet.InsertItem( 18, Color( COL_LIGHTBLUE ),	  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightBlue" ) ) );
803cdf0e10cSrcweir 	aValueSet.InsertItem( 19, Color( COL_LIGHTGREEN ),	  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightGreen" ) ) );
804cdf0e10cSrcweir 	aValueSet.InsertItem( 20, Color( COL_LIGHTCYAN ),	  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightCyan" ) ) );
805cdf0e10cSrcweir 	aValueSet.InsertItem( 21, Color( COL_LIGHTRED ),	  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightRed" ) ) );
806cdf0e10cSrcweir 	aValueSet.InsertItem( 22, Color( COL_LIGHTMAGENTA ),  XubString( RTL_CONSTASCII_USTRINGPARAM( "LightMagenta" ) ) );
807cdf0e10cSrcweir 	aValueSet.InsertItem( 23, Color( COL_YELLOW ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "Yellow" ) ) );
808cdf0e10cSrcweir 	aValueSet.InsertItem( 24, Color( COL_WHITE ),		  XubString( RTL_CONSTASCII_USTRINGPARAM( "White" ) ) );
809cdf0e10cSrcweir 	aValueSet.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "None" ) ) );
810cdf0e10cSrcweir 	aValueSet.SetColCount( 4 );
811cdf0e10cSrcweir 	aValueSet.SetLineCount( 4 );
812cdf0e10cSrcweir 	aValueSet.SetSelectHdl( LINK( this, MyWin, SelectHdl ) );
813cdf0e10cSrcweir 	aValueSet.Show();
814cdf0e10cSrcweir 	}
815cdf0e10cSrcweir 
816cdf0e10cSrcweir 	{
817cdf0e10cSrcweir 	aCalendarField.EnableEmptyFieldValue( sal_True );
818cdf0e10cSrcweir 	aCalendarField.SetCalendarStyle( aCalendarField.GetCalendarStyle() | WB_RANGESELECT );
819cdf0e10cSrcweir 	aCalendarField.SetSelectHdl( LINK( this, MyWin, CalSelectHdl ) );
820cdf0e10cSrcweir //	  aCalendarField.SetDate( Date() );
821cdf0e10cSrcweir 	aCalendarField.SetEmptyDate();
822cdf0e10cSrcweir 	aCalendarField.EnableToday();
823cdf0e10cSrcweir 	aCalendarField.EnableNone();
824cdf0e10cSrcweir 	aCalendarField.SetPosSizePixel( Point( 430, nY ), Size( 130, 20 ) );
825cdf0e10cSrcweir 	aCalendarField.Show();
826cdf0e10cSrcweir 	}
827cdf0e10cSrcweir 
828cdf0e10cSrcweir 	{
829cdf0e10cSrcweir 	aCalendarField2.SetDate( Date() );
830cdf0e10cSrcweir 	aCalendarField2.SetPosSizePixel( Point( 570, nY ), Size( 130, 20 ) );
831cdf0e10cSrcweir 	aCalendarField2.Show();
832cdf0e10cSrcweir 	}
833cdf0e10cSrcweir 
834cdf0e10cSrcweir 	nY += 200;
835cdf0e10cSrcweir 	{
836cdf0e10cSrcweir 	aTabBar.SetPosSizePixel( Point( 10, nY ),
837cdf0e10cSrcweir 							 Size( 300, aTabBar.GetSizePixel().Height() ) );
838cdf0e10cSrcweir 	aTabBar.InsertPage(  1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 1" ) ) );
839cdf0e10cSrcweir 	aTabBar.InsertPage(  2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 2" ) ) );
840cdf0e10cSrcweir 	aTabBar.InsertPage(  3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 3" ) ) );
841cdf0e10cSrcweir 	aTabBar.InsertPage(  4, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 4" ) ) );
842cdf0e10cSrcweir 	aTabBar.InsertPage(  5, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 5" ) ) );
843cdf0e10cSrcweir 	aTabBar.InsertPage(  6, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 6" ) ) );
844cdf0e10cSrcweir 	aTabBar.InsertPage(  7, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 7" ) ) );
845cdf0e10cSrcweir 	aTabBar.InsertPage(  8, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 8" ) ) );
846cdf0e10cSrcweir 	aTabBar.InsertPage(  9, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 9" ) ) );
847cdf0e10cSrcweir 	aTabBar.InsertPage( 10, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 10" ) ) );
848cdf0e10cSrcweir 	aTabBar.InsertPage( 11, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 11" ) ) );
849cdf0e10cSrcweir 	aTabBar.InsertPage( 12, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 12" ) ) );
850cdf0e10cSrcweir 	aTabBar.InsertPage( 13, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 13" ) ) );
851cdf0e10cSrcweir 	aTabBar.InsertPage( 14, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 14" ) ) );
852cdf0e10cSrcweir 	aTabBar.InsertPage( 15, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 15" ) ) );
853cdf0e10cSrcweir 	aTabBar.InsertPage( 16, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 16" ) ) );
854cdf0e10cSrcweir 	aTabBar.InsertPage( 17, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 17" ) ) );
855cdf0e10cSrcweir 	aTabBar.InsertPage( 18, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 18" ) ) );
856cdf0e10cSrcweir 	aTabBar.InsertPage( 19, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 19" ) ) );
857cdf0e10cSrcweir 	aTabBar.InsertPage( 20, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 20" ) ) );
858cdf0e10cSrcweir 	aTabBar.InsertPage( 21, XubString( RTL_CONSTASCII_USTRINGPARAM( "This is a long Page Text" ) ) );
859cdf0e10cSrcweir 	aTabBar.InsertPage( 22, XubString( RTL_CONSTASCII_USTRINGPARAM( "Short Text" ) ) );
860cdf0e10cSrcweir 	aTabBar.InsertPage( 23, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very very long Page Text" ) ) );
861cdf0e10cSrcweir 	aTabBar.InsertPage( 24, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 24" ) ) );
862cdf0e10cSrcweir 	aTabBar.InsertPage( 25, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 25" ) ) );
863cdf0e10cSrcweir 	aTabBar.InsertPage( 26, XubString( RTL_CONSTASCII_USTRINGPARAM( "And now a very long Page Text" ) ) );
864cdf0e10cSrcweir 	aTabBar.InsertPage( 27, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 27" ) ) );
865cdf0e10cSrcweir 	aTabBar.InsertPage( 28, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 28" ) ) );
866cdf0e10cSrcweir 	aTabBar.InsertPage( 29, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 29" ) ) );
867cdf0e10cSrcweir 	aTabBar.InsertPage( 30, XubString( RTL_CONSTASCII_USTRINGPARAM( "Page 30" ) ) );
868cdf0e10cSrcweir 	aTabBar.EnableEditMode();
869cdf0e10cSrcweir 	aTabBar.Show();
870cdf0e10cSrcweir 	}
871cdf0e10cSrcweir 
872cdf0e10cSrcweir 	nY += 35;
873cdf0e10cSrcweir 	{
874cdf0e10cSrcweir 	aPrgsBar.SetPosPixel( Point( 10, nY ) );
875cdf0e10cSrcweir 	aPrgsBar.Show();
876cdf0e10cSrcweir 	}
877cdf0e10cSrcweir 
878cdf0e10cSrcweir 	nY += 40;
879cdf0e10cSrcweir 	{
880cdf0e10cSrcweir 	aFontBtn.SetPosSizePixel( Point( 10, nY ), Size( 100, 30 ) );
881cdf0e10cSrcweir 	aFontBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Font..." ) ) );
882cdf0e10cSrcweir 	aFontBtn.SetClickHdl( LINK( this, MyWin, Test ) );
883cdf0e10cSrcweir 	aFontBtn.Show();
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 	aCalendarBtn.SetPosSizePixel( Point( 120, nY ), Size( 100, 30 ) );
886cdf0e10cSrcweir 	aCalendarBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Calendar" ) ) );
887cdf0e10cSrcweir 	aCalendarBtn.SetClickHdl( LINK( this, MyWin, Test ) );
888cdf0e10cSrcweir 	aCalendarBtn.Show();
889cdf0e10cSrcweir 
890cdf0e10cSrcweir 	aPrnSetupBtn.SetPosSizePixel( Point( 230, nY ), Size( 100, 30 ) );
891cdf0e10cSrcweir 	aPrnSetupBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "PrnSetup..." ) ) );
892cdf0e10cSrcweir 	aPrnSetupBtn.SetClickHdl( LINK( this, MyWin, Test ) );
893cdf0e10cSrcweir 	aPrnSetupBtn.Show();
894cdf0e10cSrcweir 
895cdf0e10cSrcweir 	aPrnDlgBtn.SetPosSizePixel( Point( 340, nY ), Size( 100, 30 ) );
896cdf0e10cSrcweir 	aPrnDlgBtn.SetText( XubString( RTL_CONSTASCII_USTRINGPARAM( "Print...." ) ) );
897cdf0e10cSrcweir 	aPrnDlgBtn.SetClickHdl( LINK( this, MyWin, Test ) );
898cdf0e10cSrcweir 	aPrnDlgBtn.Show();
899cdf0e10cSrcweir 	}
900cdf0e10cSrcweir }
901cdf0e10cSrcweir 
902cdf0e10cSrcweir // -----------------------------------------------------------------------
903cdf0e10cSrcweir 
~MyWin()904cdf0e10cSrcweir MyWin::~MyWin()
905cdf0e10cSrcweir {
906cdf0e10cSrcweir 	if ( pCalendar )
907cdf0e10cSrcweir 		delete pCalendar;
908cdf0e10cSrcweir 
909cdf0e10cSrcweir 	if ( pMenu )
910cdf0e10cSrcweir 	{
911cdf0e10cSrcweir 		delete pMenu;
912cdf0e10cSrcweir 		delete pNameMenu;
913cdf0e10cSrcweir 		delete pStyleMenu;
914cdf0e10cSrcweir 		delete pSizeMenu;
915cdf0e10cSrcweir 	}
916cdf0e10cSrcweir }
917cdf0e10cSrcweir 
918cdf0e10cSrcweir // -----------------------------------------------------------------------
919cdf0e10cSrcweir 
IMPL_LINK(MyWin,Test,PushButton *,pBtn)920cdf0e10cSrcweir IMPL_LINK( MyWin, Test, PushButton*, pBtn )
921cdf0e10cSrcweir {
922cdf0e10cSrcweir 	if ( pBtn == &aFontBtn )
923cdf0e10cSrcweir 	{
924cdf0e10cSrcweir 		MyFontDialog* pDlg = new MyFontDialog( this );
925cdf0e10cSrcweir 		pDlg->Execute();
926cdf0e10cSrcweir 		delete pDlg;
927cdf0e10cSrcweir 	}
928cdf0e10cSrcweir 	else if ( pBtn == &aCalendarBtn )
929cdf0e10cSrcweir 	{
930cdf0e10cSrcweir 		if ( !pCalendar )
931cdf0e10cSrcweir 			pCalendar = new MyCalendar( this );
932cdf0e10cSrcweir 		pCalendar->ToTop();
933cdf0e10cSrcweir 		pCalendar->Show();
934cdf0e10cSrcweir 	}
935cdf0e10cSrcweir 	else if ( pBtn == &aPrnSetupBtn )
936cdf0e10cSrcweir 	{
937cdf0e10cSrcweir 		PrinterSetupDialog* pDlg = new PrinterSetupDialog( this );
938cdf0e10cSrcweir 		pDlg->SetPrinter( &aPrn );
939cdf0e10cSrcweir 		pDlg->Execute();
940cdf0e10cSrcweir 		delete pDlg;
941cdf0e10cSrcweir 	}
942cdf0e10cSrcweir 	else if ( pBtn == &aPrnDlgBtn )
943cdf0e10cSrcweir 	{
944cdf0e10cSrcweir         PrintDialog* pDlg = new PrintDialog( this, false );
945cdf0e10cSrcweir 		pDlg->SetPrinter( &aPrn );
946cdf0e10cSrcweir 		pDlg->EnableRange( PRINTDIALOG_ALL );
947cdf0e10cSrcweir 		pDlg->EnableRange( PRINTDIALOG_RANGE );
948cdf0e10cSrcweir 		pDlg->Execute();
949cdf0e10cSrcweir 		delete pDlg;
950cdf0e10cSrcweir 	}
951cdf0e10cSrcweir 
952cdf0e10cSrcweir 	return 0;
953cdf0e10cSrcweir }
954cdf0e10cSrcweir 
955cdf0e10cSrcweir // -----------------------------------------------------------------------
956cdf0e10cSrcweir 
IMPL_LINK(MyWin,SelectHdl,Window *,pCtrl)957cdf0e10cSrcweir IMPL_LINK( MyWin, SelectHdl, Window*, pCtrl )
958cdf0e10cSrcweir {
959cdf0e10cSrcweir 	if ( pCtrl == &aColorList )
960cdf0e10cSrcweir 	{
961cdf0e10cSrcweir 		Color aColor = aColorList.GetSelectEntryColor();
962cdf0e10cSrcweir 		aValueSet.SetColor( aColor );
963cdf0e10cSrcweir 		aLineList.SetColor( aColor );
964cdf0e10cSrcweir 	}
965cdf0e10cSrcweir 	else if ( pCtrl == &aValueSet )
966cdf0e10cSrcweir 	{
967cdf0e10cSrcweir 		sal_uInt16 nId = aValueSet.GetSelectItemId();
968cdf0e10cSrcweir 		if ( nId > 8 )
969cdf0e10cSrcweir 		{
970cdf0e10cSrcweir 			Color aColor = aValueSet.GetItemColor( nId );
971cdf0e10cSrcweir 			aValueSet.SetFillColor( aColor );
972cdf0e10cSrcweir 		}
973cdf0e10cSrcweir 	}
974cdf0e10cSrcweir 	else if ( pCtrl == &aHeadBar )
975cdf0e10cSrcweir 	{
976cdf0e10cSrcweir 		sal_uInt16 nCurItemId = aHeadBar.GetCurItemId();
977cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i < aHeadBar.GetItemCount(); i++ )
978cdf0e10cSrcweir 		{
979cdf0e10cSrcweir 			sal_uInt16 nItemId = aHeadBar.GetItemId( i );
980cdf0e10cSrcweir 			HeaderBarItemBits nBits = aHeadBar.GetItemBits( nItemId );
981cdf0e10cSrcweir 			if ( nItemId == nCurItemId )
982cdf0e10cSrcweir 			{
983cdf0e10cSrcweir 				HeaderBarItemBits nOldBits = nBits;
984cdf0e10cSrcweir 				nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
985cdf0e10cSrcweir 				if ( nOldBits & HIB_DOWNARROW )
986cdf0e10cSrcweir 					nBits |= HIB_UPARROW;
987cdf0e10cSrcweir 				else
988cdf0e10cSrcweir 					nBits |= HIB_DOWNARROW;
989cdf0e10cSrcweir 			}
990cdf0e10cSrcweir 			else
991cdf0e10cSrcweir 				nBits &= ~(HIB_DOWNARROW | HIB_UPARROW);
992cdf0e10cSrcweir 			aHeadBar.SetItemBits( nItemId, nBits );
993cdf0e10cSrcweir 		}
994cdf0e10cSrcweir 	}
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 	return 0;
997cdf0e10cSrcweir }
998cdf0e10cSrcweir 
999cdf0e10cSrcweir // -----------------------------------------------------------------------
1000cdf0e10cSrcweir 
IMPL_LINK(MyWin,CalSelectHdl,CalendarField *,pCtrl)1001cdf0e10cSrcweir IMPL_LINK( MyWin, CalSelectHdl, CalendarField*, pCtrl )
1002cdf0e10cSrcweir {
1003cdf0e10cSrcweir 	if ( pCtrl == &aCalendarField )
1004cdf0e10cSrcweir 	{
1005cdf0e10cSrcweir 		Calendar* l_pCalendar = pCtrl->GetCalendar();
1006cdf0e10cSrcweir 		aCalendarField2.SetDate( l_pCalendar->GetSelectDate( l_pCalendar->GetSelectDateCount()-1 ) );
1007cdf0e10cSrcweir 	}
1008cdf0e10cSrcweir 
1009cdf0e10cSrcweir 	return 0;
1010cdf0e10cSrcweir }
1011cdf0e10cSrcweir 
1012cdf0e10cSrcweir // -----------------------------------------------------------------------
1013cdf0e10cSrcweir 
ContextMenu(const Point & rPos)1014cdf0e10cSrcweir void MyWin::ContextMenu( const Point& rPos )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir 	FontList aList( this );
1017cdf0e10cSrcweir 
1018cdf0e10cSrcweir 	if ( !pMenu )
1019cdf0e10cSrcweir 	{
1020cdf0e10cSrcweir 		pMenu		= new PopupMenu;
1021cdf0e10cSrcweir 		pNameMenu	= new FontNameMenu;
1022cdf0e10cSrcweir 		pStyleMenu	= new FontStyleMenu;
1023cdf0e10cSrcweir 		pSizeMenu	= new FontSizeMenu;
1024cdf0e10cSrcweir 
1025cdf0e10cSrcweir 		pMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "Font" ) ) );
1026cdf0e10cSrcweir 		pMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Attribute" ) ) );
1027cdf0e10cSrcweir 		pMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "Height" ) ) );
1028cdf0e10cSrcweir 		pMenu->SetPopupMenu( 1, pNameMenu );
1029cdf0e10cSrcweir 		pMenu->SetPopupMenu( 2, pStyleMenu );
1030cdf0e10cSrcweir 		pMenu->SetPopupMenu( 3, pSizeMenu );
1031cdf0e10cSrcweir 
1032cdf0e10cSrcweir 		pNameMenu->Fill( &aList );
1033cdf0e10cSrcweir 		pNameMenu->SetCurName( aList.GetFontName( 0 ).GetName() );
1034cdf0e10cSrcweir 
1035cdf0e10cSrcweir 		pStyleMenu->InsertSeparator();
1036cdf0e10cSrcweir 		pStyleMenu->InsertItem( 1, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Underline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
1037cdf0e10cSrcweir 		pStyleMenu->InsertItem( 2, XubString( RTL_CONSTASCII_USTRINGPARAM( "Stri~keout" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
1038cdf0e10cSrcweir 		pStyleMenu->InsertItem( 3, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Shadow" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
1039cdf0e10cSrcweir 		pStyleMenu->InsertItem( 4, XubString( RTL_CONSTASCII_USTRINGPARAM( "~Outline" ) ), MIB_CHECKABLE | MIB_AUTOCHECK );
1040cdf0e10cSrcweir 	}
1041cdf0e10cSrcweir 
1042cdf0e10cSrcweir 	pStyleMenu->Fill( pNameMenu->GetCurName(), &aList );
1043cdf0e10cSrcweir 	pSizeMenu->Fill( aList.Get( pNameMenu->GetCurName(),
1044cdf0e10cSrcweir 								pStyleMenu->GetCurStyle() ), &aList );
1045cdf0e10cSrcweir 
1046cdf0e10cSrcweir 	pMenu->Execute( this, rPos );
1047cdf0e10cSrcweir }
1048cdf0e10cSrcweir 
1049cdf0e10cSrcweir // -----------------------------------------------------------------------
1050cdf0e10cSrcweir 
Command(const CommandEvent & rCEvt)1051cdf0e10cSrcweir void MyWin::Command( const CommandEvent& rCEvt )
1052cdf0e10cSrcweir {
1053cdf0e10cSrcweir 	if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
1054cdf0e10cSrcweir 		ContextMenu( OutputToScreenPixel( rCEvt.GetMousePosPixel() ) );
1055cdf0e10cSrcweir }
1056cdf0e10cSrcweir 
1057cdf0e10cSrcweir // -----------------------------------------------------------------------
1058cdf0e10cSrcweir 
MouseButtonDown(const MouseEvent & rMEvt)1059cdf0e10cSrcweir void MyWin::MouseButtonDown( const MouseEvent& rMEvt )
1060cdf0e10cSrcweir {
1061cdf0e10cSrcweir 	aValueSet.StartSelection();
1062cdf0e10cSrcweir 	WorkWindow::MouseButtonDown( rMEvt );
1063cdf0e10cSrcweir }
1064cdf0e10cSrcweir 
1065cdf0e10cSrcweir // -----------------------------------------------------------------------
1066cdf0e10cSrcweir 
KeyInput(const KeyEvent & rKEvt)1067cdf0e10cSrcweir void MyWin::KeyInput( const KeyEvent& rKEvt )
1068cdf0e10cSrcweir {
1069cdf0e10cSrcweir 	if ( rKEvt.GetKeyCode().GetCode() == KEY_P )
1070cdf0e10cSrcweir 	{
1071cdf0e10cSrcweir 		for ( sal_uInt16 i = 0; i <= 130; i += 2 )
1072cdf0e10cSrcweir 		{
1073cdf0e10cSrcweir 			for ( sal_uInt16 j = 0; j < 6000; j++ )
1074cdf0e10cSrcweir 			{
1075cdf0e10cSrcweir 				aPrgsBar.SetValue( i );
1076cdf0e10cSrcweir 				Application::Reschedule();
1077cdf0e10cSrcweir 			}
1078cdf0e10cSrcweir 		}
1079cdf0e10cSrcweir 	}
1080cdf0e10cSrcweir 	else if ( rKEvt.GetCharCode() == '+' )
1081cdf0e10cSrcweir 		aHeadBar.SetOffset( aHeadBar.GetOffset()+1 );
1082cdf0e10cSrcweir 	else if ( rKEvt.GetCharCode() == '-' )
1083cdf0e10cSrcweir 		aHeadBar.SetOffset( aHeadBar.GetOffset()-1 );
1084cdf0e10cSrcweir 
1085cdf0e10cSrcweir 	WorkWindow::KeyInput( rKEvt );
1086cdf0e10cSrcweir }
1087cdf0e10cSrcweir 
1088cdf0e10cSrcweir // -----------------------------------------------------------------------
1089cdf0e10cSrcweir 
Paint(const Rectangle & rRect)1090cdf0e10cSrcweir void MyWin::Paint( const Rectangle& rRect )
1091cdf0e10cSrcweir {
1092cdf0e10cSrcweir 	WorkWindow::Paint( rRect );
1093cdf0e10cSrcweir }
1094cdf0e10cSrcweir 
1095cdf0e10cSrcweir // -----------------------------------------------------------------------
1096cdf0e10cSrcweir 
Resize()1097cdf0e10cSrcweir void MyWin::Resize()
1098cdf0e10cSrcweir {
1099cdf0e10cSrcweir 	Size aWinSize = GetOutputSizePixel();
1100cdf0e10cSrcweir 
1101cdf0e10cSrcweir 	aBox.SetSizePixel( Size( aWinSize.Width(), aBoxSize.Height() ) );
1102cdf0e10cSrcweir 
1103cdf0e10cSrcweir 	Size aSize = aBar.GetSizePixel();
1104cdf0e10cSrcweir 	aBar.SetPosSizePixel( Point( 0, aWinSize.Height()-aSize.Height() ),
1105cdf0e10cSrcweir 						  Size( aWinSize.Width(), aSize.Height() ) );
1106cdf0e10cSrcweir 
1107cdf0e10cSrcweir 	Size aBarSize = aSize;
1108cdf0e10cSrcweir 	Point aPos = aHeadBar.GetPosPixel();
1109cdf0e10cSrcweir 	aSize = aHeadBar.GetSizePixel();
1110cdf0e10cSrcweir 	aHeadBar.SetSizePixel( Size( aWinSize.Width(), aSize.Height() ) );
1111cdf0e10cSrcweir 	aHeadBar.SetDragSize( aWinSize.Height() - aSize.Height() - aPos.Y() - aBarSize.Height() );
1112cdf0e10cSrcweir 
1113cdf0e10cSrcweir 	aPos = aPrgsBar.GetPosPixel();
1114cdf0e10cSrcweir 	aSize = aPrgsBar.GetSizePixel();
1115cdf0e10cSrcweir 	if ( aPos.X() < aWinSize.Width()-10 )
1116cdf0e10cSrcweir 		aPrgsBar.SetSizePixel( Size( aWinSize.Width()-aPos.X()-10, aSize.Height() ) );
1117cdf0e10cSrcweir }
1118cdf0e10cSrcweir 
1119cdf0e10cSrcweir // -----------------------------------------------------------------------
1120cdf0e10cSrcweir 
1121cdf0e10cSrcweir MyApp aMyApp;
1122