xref: /aoo41x/main/vcl/source/window/msgbox.cxx (revision ae642d40)
19f62ea84SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
39f62ea84SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
49f62ea84SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
59f62ea84SAndrew Rist  * distributed with this work for additional information
69f62ea84SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
79f62ea84SAndrew Rist  * to you under the Apache License, Version 2.0 (the
89f62ea84SAndrew Rist  * "License"); you may not use this file except in compliance
99f62ea84SAndrew Rist  * with the License.  You may obtain a copy of the License at
109f62ea84SAndrew Rist  *
119f62ea84SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
129f62ea84SAndrew Rist  *
139f62ea84SAndrew Rist  * Unless required by applicable law or agreed to in writing,
149f62ea84SAndrew Rist  * software distributed under the License is distributed on an
159f62ea84SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
169f62ea84SAndrew Rist  * KIND, either express or implied.  See the License for the
179f62ea84SAndrew Rist  * specific language governing permissions and limitations
189f62ea84SAndrew Rist  * under the License.
199f62ea84SAndrew Rist  *
209f62ea84SAndrew Rist  *************************************************************/
219f62ea84SAndrew Rist 
229f62ea84SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_vcl.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <tools/rc.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include <svids.hrc>
30cdf0e10cSrcweir #include <svdata.hxx>
31cdf0e10cSrcweir #include <brdwin.hxx>
32cdf0e10cSrcweir #include <window.h>
33cdf0e10cSrcweir 
34cdf0e10cSrcweir #include <vcl/metric.hxx>
35cdf0e10cSrcweir #include <vcl/svapp.hxx>
36cdf0e10cSrcweir #include <vcl/wrkwin.hxx>
37cdf0e10cSrcweir #include <vcl/fixed.hxx>
38cdf0e10cSrcweir #include <vcl/sound.hxx>
39cdf0e10cSrcweir #include <vcl/msgbox.hxx>
40cdf0e10cSrcweir #include <vcl/button.hxx>
41cdf0e10cSrcweir #include <vcl/mnemonic.hxx>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir 
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // =======================================================================
46cdf0e10cSrcweir 
ImplInitMsgBoxImageList()47cdf0e10cSrcweir static void ImplInitMsgBoxImageList()
48cdf0e10cSrcweir {
49cdf0e10cSrcweir 	ImplSVData* pSVData = ImplGetSVData();
50cdf0e10cSrcweir 	if ( !pSVData->maWinData.mpMsgBoxImgList )
51cdf0e10cSrcweir 	{
52cdf0e10cSrcweir         ResMgr* pResMgr = ImplGetResMgr();
53cdf0e10cSrcweir 		pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
54cdf0e10cSrcweir 		pSVData->maWinData.mpMsgBoxHCImgList = new ImageList(4);
55cdf0e10cSrcweir         if( pResMgr )
56cdf0e10cSrcweir         {
57cdf0e10cSrcweir             Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
58cdf0e10cSrcweir             pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
59cdf0e10cSrcweir                 ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask );
60cdf0e10cSrcweir             pSVData->maWinData.mpMsgBoxHCImgList->InsertFromHorizontalBitmap
61cdf0e10cSrcweir                 ( ResId( SV_RESID_BITMAP_MSGBOX_HC, *pResMgr ), 4, &aNonAlphaMask );
62cdf0e10cSrcweir         }
63cdf0e10cSrcweir 	}
64cdf0e10cSrcweir }
65cdf0e10cSrcweir 
66cdf0e10cSrcweir // =======================================================================
67cdf0e10cSrcweir 
ImplInitMessBoxData()68cdf0e10cSrcweir void MessBox::ImplInitMessBoxData()
69cdf0e10cSrcweir {
70cdf0e10cSrcweir 	mpFixedText 		= NULL;
71cdf0e10cSrcweir 	mpFixedImage		= NULL;
72cdf0e10cSrcweir 	mnSoundType 		= 0;
73cdf0e10cSrcweir 	mbHelpBtn			= sal_False;
74cdf0e10cSrcweir 	mbSound 			= sal_True;
75cdf0e10cSrcweir     mpCheckBox          = NULL;
76cdf0e10cSrcweir     mbCheck             = sal_False;
77cdf0e10cSrcweir }
78cdf0e10cSrcweir 
79cdf0e10cSrcweir // -----------------------------------------------------------------------
80cdf0e10cSrcweir 
ImplInitButtons()81cdf0e10cSrcweir void MessBox::ImplInitButtons()
82cdf0e10cSrcweir {
83cdf0e10cSrcweir 	WinBits nStyle = GetStyle();
84cdf0e10cSrcweir 	sal_uInt16	nOKFlags = BUTTONDIALOG_OKBUTTON;
85cdf0e10cSrcweir 	sal_uInt16	nCancelFlags = BUTTONDIALOG_CANCELBUTTON;
86cdf0e10cSrcweir 	sal_uInt16	nRetryFlags = 0;
87cdf0e10cSrcweir 	sal_uInt16	nYesFlags = 0;
88cdf0e10cSrcweir 	sal_uInt16	nNoFlags = 0;
89cdf0e10cSrcweir 
90cdf0e10cSrcweir 	if ( nStyle & WB_OK_CANCEL )
91cdf0e10cSrcweir 	{
92cdf0e10cSrcweir 		if ( nStyle & WB_DEF_CANCEL )
93cdf0e10cSrcweir 			nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
94cdf0e10cSrcweir 		else // WB_DEF_OK
95cdf0e10cSrcweir 			nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 		AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
98cdf0e10cSrcweir 		AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
99cdf0e10cSrcweir 	}
100cdf0e10cSrcweir 	else if ( nStyle & WB_YES_NO )
101cdf0e10cSrcweir 	{
102cdf0e10cSrcweir 		if ( nStyle & WB_DEF_YES )
103cdf0e10cSrcweir 			nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
104cdf0e10cSrcweir 		else // WB_DEF_NO
105cdf0e10cSrcweir 			nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
106cdf0e10cSrcweir 		nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
107cdf0e10cSrcweir 
108cdf0e10cSrcweir 		AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
109cdf0e10cSrcweir 		AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
110cdf0e10cSrcweir 	}
111cdf0e10cSrcweir 	else if ( nStyle & WB_YES_NO_CANCEL )
112cdf0e10cSrcweir 	{
113cdf0e10cSrcweir 		if ( nStyle & WB_DEF_YES )
114cdf0e10cSrcweir 			nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
115cdf0e10cSrcweir 		else if ( nStyle & WB_DEF_NO )
116cdf0e10cSrcweir 			nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
117cdf0e10cSrcweir 		else
118cdf0e10cSrcweir 			nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
119cdf0e10cSrcweir 
120cdf0e10cSrcweir 		AddButton( BUTTON_YES, BUTTONID_YES, nYesFlags );
121cdf0e10cSrcweir 		AddButton( BUTTON_NO, BUTTONID_NO, nNoFlags );
122cdf0e10cSrcweir 		AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
123cdf0e10cSrcweir 	}
124cdf0e10cSrcweir 	else if ( nStyle & WB_RETRY_CANCEL )
125cdf0e10cSrcweir 	{
126cdf0e10cSrcweir 		if ( nStyle & WB_DEF_CANCEL )
127cdf0e10cSrcweir 			nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
128cdf0e10cSrcweir 		else // WB_DEF_RETRY
129cdf0e10cSrcweir 			nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 		AddButton( BUTTON_RETRY, BUTTONID_RETRY, nRetryFlags );
132cdf0e10cSrcweir 		AddButton( BUTTON_CANCEL, BUTTONID_CANCEL, nCancelFlags );
133cdf0e10cSrcweir 	}
134cdf0e10cSrcweir     else if ( nStyle & WB_ABORT_RETRY_IGNORE )
135cdf0e10cSrcweir     {
136cdf0e10cSrcweir         sal_uInt16 nAbortFlags = 0;
137cdf0e10cSrcweir         sal_uInt16 nIgnoreFlags = 0;
138cdf0e10cSrcweir 
139cdf0e10cSrcweir         if ( nStyle & WB_DEF_CANCEL )
140cdf0e10cSrcweir             nAbortFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
141cdf0e10cSrcweir         else if ( nStyle & WB_DEF_RETRY )
142cdf0e10cSrcweir             nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
143cdf0e10cSrcweir         else if ( nStyle & WB_DEF_IGNORE )
144cdf0e10cSrcweir             nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
145cdf0e10cSrcweir 
146cdf0e10cSrcweir         AddButton( BUTTON_ABORT, BUTTONID_CANCEL, nAbortFlags );
147cdf0e10cSrcweir         AddButton( BUTTON_RETRY, BUTTONID_RETRY, nRetryFlags );
148cdf0e10cSrcweir         AddButton( BUTTON_IGNORE, BUTTONID_IGNORE, nIgnoreFlags );
149cdf0e10cSrcweir     }
150cdf0e10cSrcweir 	else if ( nStyle & WB_OK )
151cdf0e10cSrcweir 	{
152cdf0e10cSrcweir 		nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir 		AddButton( BUTTON_OK, BUTTONID_OK, nOKFlags );
155cdf0e10cSrcweir 	}
156cdf0e10cSrcweir }
157cdf0e10cSrcweir 
158cdf0e10cSrcweir // -----------------------------------------------------------------------
159cdf0e10cSrcweir 
MessBox(WindowType)160cdf0e10cSrcweir MessBox::MessBox( WindowType ) :
161cdf0e10cSrcweir 	ButtonDialog( WINDOW_MESSBOX )
162cdf0e10cSrcweir {
163cdf0e10cSrcweir 	ImplInitMessBoxData();
164cdf0e10cSrcweir }
165cdf0e10cSrcweir 
166cdf0e10cSrcweir // -----------------------------------------------------------------------
167cdf0e10cSrcweir 
MessBox(Window * pParent,WinBits nStyle,const XubString & rTitle,const XubString & rMessage)168cdf0e10cSrcweir MessBox::MessBox( Window* pParent, WinBits nStyle,
169cdf0e10cSrcweir 				  const XubString& rTitle, const XubString& rMessage ) :
170cdf0e10cSrcweir 	ButtonDialog( WINDOW_MESSBOX ),
171cdf0e10cSrcweir 	maMessText( rMessage )
172cdf0e10cSrcweir {
173cdf0e10cSrcweir 	ImplInitMessBoxData();
174cdf0e10cSrcweir 	ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
175cdf0e10cSrcweir 	ImplInitButtons();
176cdf0e10cSrcweir 
177cdf0e10cSrcweir 	if ( rTitle.Len() )
178cdf0e10cSrcweir 		SetText( rTitle );
179cdf0e10cSrcweir }
180cdf0e10cSrcweir 
181cdf0e10cSrcweir // -----------------------------------------------------------------------
182cdf0e10cSrcweir 
MessBox(Window * pParent,const ResId & rResId)183cdf0e10cSrcweir MessBox::MessBox( Window* pParent, const ResId& rResId ) :
184cdf0e10cSrcweir 	ButtonDialog( WINDOW_MESSBOX )
185cdf0e10cSrcweir {
186cdf0e10cSrcweir 	ImplInitMessBoxData();
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	GetRes( rResId.SetRT( RSC_MESSBOX ) );
189cdf0e10cSrcweir 	sal_uInt16 nHiButtons	= ReadShortRes();
190cdf0e10cSrcweir 	sal_uInt16 nLoButtons	= ReadShortRes();
191cdf0e10cSrcweir 	sal_uInt16 nHiDefButton = ReadShortRes();
192cdf0e10cSrcweir 	sal_uInt16 nLoDefButton = ReadShortRes();
193cdf0e10cSrcweir 	rtl::OString aHelpId( ReadByteStringRes() );
194cdf0e10cSrcweir 	/* sal_uInt16 bSysModal	= */ ReadShortRes();
195cdf0e10cSrcweir 	SetHelpId( aHelpId );
196cdf0e10cSrcweir 	WinBits nBits = (((sal_uLong)nHiButtons << 16) + nLoButtons) |
197cdf0e10cSrcweir 					(((sal_uLong)nHiDefButton << 16) + nLoDefButton);
198cdf0e10cSrcweir 	ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
199cdf0e10cSrcweir 
200cdf0e10cSrcweir 	ImplLoadRes( rResId );
201cdf0e10cSrcweir 	ImplInitButtons();
202cdf0e10cSrcweir }
203cdf0e10cSrcweir 
204cdf0e10cSrcweir // -----------------------------------------------------------------------
205cdf0e10cSrcweir 
ImplLoadRes(const ResId &)206cdf0e10cSrcweir void MessBox::ImplLoadRes( const ResId& )
207cdf0e10cSrcweir {
208cdf0e10cSrcweir 	SetText( ReadStringRes() );
209cdf0e10cSrcweir 	SetMessText( ReadStringRes() );
210cdf0e10cSrcweir 	SetHelpText( ReadStringRes() );
211cdf0e10cSrcweir }
212cdf0e10cSrcweir 
213cdf0e10cSrcweir // -----------------------------------------------------------------------
214cdf0e10cSrcweir 
~MessBox()215cdf0e10cSrcweir MessBox::~MessBox()
216cdf0e10cSrcweir {
217cdf0e10cSrcweir 	if ( mpFixedText )
218cdf0e10cSrcweir 		delete mpFixedText;
219cdf0e10cSrcweir 	if ( mpFixedImage )
220cdf0e10cSrcweir 		delete mpFixedImage;
221cdf0e10cSrcweir     if ( mpCheckBox )
222cdf0e10cSrcweir         delete mpCheckBox;
223cdf0e10cSrcweir }
224cdf0e10cSrcweir 
225cdf0e10cSrcweir // -----------------------------------------------------------------------
226cdf0e10cSrcweir 
ImplPosControls()227cdf0e10cSrcweir void MessBox::ImplPosControls()
228cdf0e10cSrcweir {
229cdf0e10cSrcweir 	if ( GetHelpId().getLength() )
230cdf0e10cSrcweir 	{
231cdf0e10cSrcweir 		if ( !mbHelpBtn )
232cdf0e10cSrcweir 		{
233cdf0e10cSrcweir 			AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
234cdf0e10cSrcweir 			mbHelpBtn = sal_True;
235cdf0e10cSrcweir 		}
236cdf0e10cSrcweir 	}
237cdf0e10cSrcweir 	else
238cdf0e10cSrcweir 	{
239cdf0e10cSrcweir 		if ( mbHelpBtn )
240cdf0e10cSrcweir 		{
241cdf0e10cSrcweir 			RemoveButton( BUTTONID_HELP );
242cdf0e10cSrcweir 			mbHelpBtn = sal_False;
243cdf0e10cSrcweir 		}
244cdf0e10cSrcweir 	}
245cdf0e10cSrcweir 
246cdf0e10cSrcweir 	XubString		aMessText( maMessText );
247cdf0e10cSrcweir 	TextRectInfo	aTextInfo;
248cdf0e10cSrcweir 	Rectangle		aRect( 0, 0, 30000, 30000 );
249cdf0e10cSrcweir 	Rectangle		aFormatRect;
250cdf0e10cSrcweir 	Point			aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y );
251cdf0e10cSrcweir 	Size			aImageSize;
252cdf0e10cSrcweir 	Size			aPageSize;
253cdf0e10cSrcweir 	Size			aFixedSize;
254cdf0e10cSrcweir 	long			nTitleWidth;
255cdf0e10cSrcweir 	long			nButtonSize = ImplGetButtonSize();
256cdf0e10cSrcweir 	long			nMaxWidth = GetDesktopRectPixel().GetWidth()-8;
257cdf0e10cSrcweir 	long			nMaxLineWidth;
258cdf0e10cSrcweir 	long			nWidth;
259cdf0e10cSrcweir 	WinBits 		nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL | WB_INFO;
260cdf0e10cSrcweir 	sal_uInt16			nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
261cdf0e10cSrcweir 
262cdf0e10cSrcweir 	if ( mpFixedText )
263cdf0e10cSrcweir 		delete mpFixedText;
264cdf0e10cSrcweir 	if ( mpFixedImage )
265cdf0e10cSrcweir 	{
266cdf0e10cSrcweir 		delete mpFixedImage;
267cdf0e10cSrcweir 		mpFixedImage = NULL;
268cdf0e10cSrcweir 	}
269cdf0e10cSrcweir     if ( mpCheckBox )
270cdf0e10cSrcweir     {
271cdf0e10cSrcweir         mbCheck = mpCheckBox->IsChecked();
272cdf0e10cSrcweir         delete mpCheckBox;
273cdf0e10cSrcweir         mpCheckBox = NULL;
274cdf0e10cSrcweir     }
275cdf0e10cSrcweir 
276cdf0e10cSrcweir 
277cdf0e10cSrcweir 	// Message-Text um Tabs bereinigen
278cdf0e10cSrcweir 	XubString	aTabStr( RTL_CONSTASCII_USTRINGPARAM( "    " ) );
279cdf0e10cSrcweir 	sal_uInt16		nIndex = 0;
280cdf0e10cSrcweir 	while ( nIndex != STRING_NOTFOUND )
281cdf0e10cSrcweir 		nIndex = aMessText.SearchAndReplace( '\t', aTabStr, nIndex );
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	// Wenn Fenster zu schmall, machen wir Dialog auch breiter
284cdf0e10cSrcweir 	if ( mpWindowImpl->mbFrame )
285cdf0e10cSrcweir 		nMaxWidth = 630;
286cdf0e10cSrcweir 	else if ( nMaxWidth < 120 )
287cdf0e10cSrcweir 		nMaxWidth = 120;
288cdf0e10cSrcweir 
289cdf0e10cSrcweir 	nMaxWidth -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder+4;
290cdf0e10cSrcweir 
291cdf0e10cSrcweir 	// MessageBox sollte min. so breit sein, das auch Title sichtbar ist
292cdf0e10cSrcweir 	// Extra-Width for Closer, because Closer is set after this call
293cdf0e10cSrcweir 	nTitleWidth = CalcTitleWidth();
294cdf0e10cSrcweir 	nTitleWidth += mpWindowImpl->mnTopBorder;
295cdf0e10cSrcweir 
296cdf0e10cSrcweir 	nMaxWidth -= (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
297cdf0e10cSrcweir 
298cdf0e10cSrcweir 	// Wenn wir ein Image haben, dann deren Groesse ermitteln und das
299cdf0e10cSrcweir 	// entsprechende Control anlegen und positionieren
300cdf0e10cSrcweir 	aImageSize = maImage.GetSizePixel();
301cdf0e10cSrcweir 	if ( aImageSize.Width() )
302cdf0e10cSrcweir 	{
303cdf0e10cSrcweir 		aImageSize.Width()	+= 4;
304cdf0e10cSrcweir 		aImageSize.Height() += 4;
305cdf0e10cSrcweir 		aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
306cdf0e10cSrcweir 		mpFixedImage = new FixedImage( this );
307cdf0e10cSrcweir 		mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
308cdf0e10cSrcweir 											  IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
309cdf0e10cSrcweir 									   aImageSize );
310cdf0e10cSrcweir 		mpFixedImage->SetImage( maImage );
311cdf0e10cSrcweir 		// forward the HC image
312cdf0e10cSrcweir 		if( !!maImageHC )
313cdf0e10cSrcweir 			mpFixedImage->SetModeImage( maImageHC, BMP_COLOR_HIGHCONTRAST );
314cdf0e10cSrcweir 		mpFixedImage->Show();
315cdf0e10cSrcweir 		nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
316cdf0e10cSrcweir 	}
317cdf0e10cSrcweir 	else
318cdf0e10cSrcweir 		aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X;
319cdf0e10cSrcweir 
320cdf0e10cSrcweir 	// Maximale Zeilenlaenge ohne Wordbreak ermitteln
321cdf0e10cSrcweir 	aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
322cdf0e10cSrcweir 	nMaxLineWidth = aFormatRect.GetWidth();
323cdf0e10cSrcweir 	nTextStyle |= TEXT_DRAW_WORDBREAK;
324cdf0e10cSrcweir 
325cdf0e10cSrcweir 	// Breite fuer Textformatierung ermitteln
326cdf0e10cSrcweir 	if ( nMaxLineWidth > 450 )
327cdf0e10cSrcweir 		nWidth = 450;
328cdf0e10cSrcweir 	else if ( nMaxLineWidth > 300 )
329cdf0e10cSrcweir 		nWidth = nMaxLineWidth+5;
330cdf0e10cSrcweir 	else
331cdf0e10cSrcweir 		nWidth = 300;
332cdf0e10cSrcweir 	if ( nButtonSize > nWidth )
333cdf0e10cSrcweir 		nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET);
334cdf0e10cSrcweir 	if ( nWidth > nMaxWidth )
335cdf0e10cSrcweir 		nWidth = nMaxWidth;
336cdf0e10cSrcweir 
337cdf0e10cSrcweir 	aRect.Right() = nWidth;
338cdf0e10cSrcweir 	aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
339cdf0e10cSrcweir 	if ( aTextInfo.GetMaxLineWidth() > nWidth )
340cdf0e10cSrcweir 	{
341cdf0e10cSrcweir 		nWidth = aTextInfo.GetMaxLineWidth()+8;
342cdf0e10cSrcweir 		aRect.Right() = nWidth;
343cdf0e10cSrcweir 		aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
344cdf0e10cSrcweir 	}
345cdf0e10cSrcweir 
346cdf0e10cSrcweir 	// Style fuer FixedText ermitteln
347cdf0e10cSrcweir 	aPageSize.Width()	= aImageSize.Width();
348cdf0e10cSrcweir 	aFixedSize.Width()	= aTextInfo.GetMaxLineWidth()+1;
349cdf0e10cSrcweir 	aFixedSize.Height() = aFormatRect.GetHeight();
350cdf0e10cSrcweir 	if ( aFixedSize.Height() < aImageSize.Height() )
351cdf0e10cSrcweir 	{
352cdf0e10cSrcweir 		nWinStyle |= WB_VCENTER;
353cdf0e10cSrcweir 		aPageSize.Height()	= aImageSize.Height();
354cdf0e10cSrcweir 		aFixedSize.Height() = aImageSize.Height();
355cdf0e10cSrcweir 	}
356cdf0e10cSrcweir 	else
357cdf0e10cSrcweir 	{
358cdf0e10cSrcweir 		nWinStyle |= WB_TOP;
359cdf0e10cSrcweir 		aPageSize.Height()	= aFixedSize.Height();
360cdf0e10cSrcweir 	}
361cdf0e10cSrcweir 	if ( aImageSize.Width() )
362cdf0e10cSrcweir 		aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE;
363cdf0e10cSrcweir 	aPageSize.Width()  += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
364cdf0e10cSrcweir 	aPageSize.Width()  += aFixedSize.Width()+1;
365cdf0e10cSrcweir 	aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
366cdf0e10cSrcweir 
367cdf0e10cSrcweir 	if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH )
368cdf0e10cSrcweir 		aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH;
369cdf0e10cSrcweir 	if ( aPageSize.Width() < nTitleWidth )
370cdf0e10cSrcweir 		aPageSize.Width() = nTitleWidth;
371cdf0e10cSrcweir 
372cdf0e10cSrcweir     if ( maCheckBoxText.Len() )
373cdf0e10cSrcweir     {
374cdf0e10cSrcweir         Size aMinCheckboxSize ( aFixedSize );
375cdf0e10cSrcweir         if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
376cdf0e10cSrcweir         {
377cdf0e10cSrcweir 		    aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH+80;
378cdf0e10cSrcweir             aMinCheckboxSize.Width() += 80;
379cdf0e10cSrcweir         }
380cdf0e10cSrcweir 
381cdf0e10cSrcweir         // #104492# auto mnemonics for CJK strings may increase the length, so measure the
382cdf0e10cSrcweir         // checkbox length including a temporary mnemonic, the correct auto mnemonic will be
383cdf0e10cSrcweir         // generated later in the dialog (see init_show)
384cdf0e10cSrcweir 
385cdf0e10cSrcweir         String aMnemonicString( maCheckBoxText );
386cdf0e10cSrcweir         if( GetSettings().GetStyleSettings().GetAutoMnemonic() )
387cdf0e10cSrcweir         {
388cdf0e10cSrcweir             if( aMnemonicString == GetNonMnemonicString( maCheckBoxText ) )
389cdf0e10cSrcweir             {
390cdf0e10cSrcweir                 // no mnemonic found -> create one
391cdf0e10cSrcweir                 MnemonicGenerator aMnemonicGenerator;
392cdf0e10cSrcweir                 aMnemonicGenerator.CreateMnemonic( aMnemonicString );
393cdf0e10cSrcweir             }
394cdf0e10cSrcweir         }
395cdf0e10cSrcweir 
396cdf0e10cSrcweir         mpCheckBox = new CheckBox( this );
397cdf0e10cSrcweir         mpCheckBox->Check( mbCheck );
398cdf0e10cSrcweir         mpCheckBox->SetText( aMnemonicString );
399cdf0e10cSrcweir         mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK );
400cdf0e10cSrcweir         mpCheckBox->SetHelpId( GetHelpId() );   // DR: Check box and dialog have same HID
401cdf0e10cSrcweir 
402cdf0e10cSrcweir         // align checkbox with message text
403cdf0e10cSrcweir         Size aSize = mpCheckBox->CalcMinimumSize( aMinCheckboxSize.Width() );
404cdf0e10cSrcweir 
405cdf0e10cSrcweir         // now set the original non-mnemonic string
406cdf0e10cSrcweir         mpCheckBox->SetText( maCheckBoxText );
407cdf0e10cSrcweir 
408cdf0e10cSrcweir         Point aPos( aTextPos );
409cdf0e10cSrcweir         aPos.Y() += aFixedSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
410cdf0e10cSrcweir 
411cdf0e10cSrcweir         // increase messagebox
412cdf0e10cSrcweir         aPageSize.Height() += aSize.Height() + (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
413cdf0e10cSrcweir 
414cdf0e10cSrcweir         mpCheckBox->SetPosSizePixel( aPos, aSize );
415cdf0e10cSrcweir         mpCheckBox->Show();
416cdf0e10cSrcweir     }
417cdf0e10cSrcweir 
418cdf0e10cSrcweir 	mpFixedText = new FixedText( this, nWinStyle );
419cdf0e10cSrcweir 	if( mpFixedText->GetStyle() & WB_EXTRAOFFSET ) // TODO: use CalcMinimumSize() instead
420cdf0e10cSrcweir 		aFixedSize.Width() += 2;
421cdf0e10cSrcweir 	mpFixedText->SetPosSizePixel( aTextPos, aFixedSize );
422cdf0e10cSrcweir 	mpFixedText->SetText( aMessText );
423cdf0e10cSrcweir 	mpFixedText->Show();
424cdf0e10cSrcweir 	SetPageSizePixel( aPageSize );
425cdf0e10cSrcweir }
426cdf0e10cSrcweir 
427cdf0e10cSrcweir // -----------------------------------------------------------------------
428cdf0e10cSrcweir 
StateChanged(StateChangedType nType)429cdf0e10cSrcweir void MessBox::StateChanged( StateChangedType nType )
430cdf0e10cSrcweir {
431cdf0e10cSrcweir 	if ( nType == STATE_CHANGE_INITSHOW )
432cdf0e10cSrcweir 	{
433cdf0e10cSrcweir 		ImplPosControls();
434cdf0e10cSrcweir 		if ( mbSound && mnSoundType )
435cdf0e10cSrcweir 			Sound::Beep( (SoundType)(mnSoundType-1), this );
436cdf0e10cSrcweir 	}
437cdf0e10cSrcweir 	ButtonDialog::StateChanged( nType );
438cdf0e10cSrcweir }
439cdf0e10cSrcweir 
440cdf0e10cSrcweir // -----------------------------------------------------------------------
441cdf0e10cSrcweir 
GetCheckBoxState() const442cdf0e10cSrcweir sal_Bool MessBox::GetCheckBoxState() const
443cdf0e10cSrcweir {
444cdf0e10cSrcweir     return mpCheckBox ? mpCheckBox->IsChecked() : mbCheck;
445cdf0e10cSrcweir }
446cdf0e10cSrcweir 
447cdf0e10cSrcweir // -----------------------------------------------------------------------
448cdf0e10cSrcweir 
SetCheckBoxState(sal_Bool bCheck)449cdf0e10cSrcweir void MessBox::SetCheckBoxState( sal_Bool bCheck )
450cdf0e10cSrcweir {
451cdf0e10cSrcweir     if( mpCheckBox ) mpCheckBox->Check( bCheck );
452cdf0e10cSrcweir     mbCheck = bCheck;
453cdf0e10cSrcweir }
454cdf0e10cSrcweir 
455cdf0e10cSrcweir // -----------------------------------------------------------------------
456cdf0e10cSrcweir 
SetDefaultCheckBoxText()457cdf0e10cSrcweir void MessBox::SetDefaultCheckBoxText()
458cdf0e10cSrcweir {
459cdf0e10cSrcweir     ResMgr* pResMgr = ImplGetResMgr();
460cdf0e10cSrcweir     if( pResMgr )
461cdf0e10cSrcweir         maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTHINTAGAIN, *pResMgr ) );
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir // -----------------------------------------------------------------------
465cdf0e10cSrcweir 
SetModeImage(const Image & rImage,BmpColorMode eMode)466cdf0e10cSrcweir sal_Bool MessBox::SetModeImage( const Image& rImage, BmpColorMode eMode )
467cdf0e10cSrcweir {
468cdf0e10cSrcweir     if( eMode == BMP_COLOR_NORMAL )
469cdf0e10cSrcweir         SetImage( rImage );
470cdf0e10cSrcweir     else if( eMode == BMP_COLOR_HIGHCONTRAST )
471cdf0e10cSrcweir 		maImageHC = rImage;
472cdf0e10cSrcweir     else
473cdf0e10cSrcweir         return sal_False;
474cdf0e10cSrcweir     return sal_True;
475cdf0e10cSrcweir }
476cdf0e10cSrcweir 
477cdf0e10cSrcweir // -----------------------------------------------------------------------
478cdf0e10cSrcweir 
GetModeImage(BmpColorMode eMode) const479cdf0e10cSrcweir const Image& MessBox::GetModeImage( BmpColorMode eMode ) const
480cdf0e10cSrcweir {
481cdf0e10cSrcweir     if( eMode == BMP_COLOR_HIGHCONTRAST )
482cdf0e10cSrcweir         return maImageHC;
483cdf0e10cSrcweir     else
484cdf0e10cSrcweir         return maImage;
485cdf0e10cSrcweir }
486cdf0e10cSrcweir 
487cdf0e10cSrcweir // -----------------------------------------------------------------------
488cdf0e10cSrcweir 
ImplInitInfoBoxData()489cdf0e10cSrcweir void InfoBox::ImplInitInfoBoxData()
490cdf0e10cSrcweir {
491cdf0e10cSrcweir 	// Default Text is the display title from the application
492cdf0e10cSrcweir 	if ( !GetText().Len() )
493cdf0e10cSrcweir 		SetText( Application::GetDisplayName() );
494cdf0e10cSrcweir 
495cdf0e10cSrcweir 	SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
496cdf0e10cSrcweir                 InfoBox::GetStandardImageHC() : InfoBox::GetStandardImage() );
497cdf0e10cSrcweir 	mnSoundType = ((sal_uInt16)SOUND_INFO)+1;
498cdf0e10cSrcweir }
499cdf0e10cSrcweir 
500cdf0e10cSrcweir // -----------------------------------------------------------------------
501cdf0e10cSrcweir 
InfoBox(Window * pParent,const XubString & rMessage)502cdf0e10cSrcweir InfoBox::InfoBox( Window* pParent, const XubString& rMessage ) :
503cdf0e10cSrcweir 	MessBox( pParent, WB_OK | WB_DEF_OK, ImplGetSVEmptyStr(), rMessage )
504cdf0e10cSrcweir {
505cdf0e10cSrcweir 	ImplInitInfoBoxData();
506cdf0e10cSrcweir }
507cdf0e10cSrcweir 
508cdf0e10cSrcweir // -----------------------------------------------------------------------
509cdf0e10cSrcweir 
InfoBox(Window * pParent,const ResId & rResId)510cdf0e10cSrcweir InfoBox::InfoBox( Window* pParent, const ResId & rResId ) :
511cdf0e10cSrcweir 	MessBox( pParent, rResId.SetRT( RSC_INFOBOX ) )
512cdf0e10cSrcweir {
513cdf0e10cSrcweir 	ImplInitInfoBoxData();
514cdf0e10cSrcweir }
515cdf0e10cSrcweir 
516cdf0e10cSrcweir // -----------------------------------------------------------------------
517cdf0e10cSrcweir 
InfoBox(Window * pParent,WinBits nStyle,const XubString & rMessage)518*ae642d40SHerbert Dürr InfoBox::InfoBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
519*ae642d40SHerbert Dürr 	MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
520*ae642d40SHerbert Dürr {
521*ae642d40SHerbert Dürr 	ImplInitInfoBoxData();
522*ae642d40SHerbert Dürr }
523*ae642d40SHerbert Dürr 
524*ae642d40SHerbert Dürr // -----------------------------------------------------------------------
525*ae642d40SHerbert Dürr 
GetStandardImage()526cdf0e10cSrcweir Image InfoBox::GetStandardImage()
527cdf0e10cSrcweir {
528cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
529cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
530cdf0e10cSrcweir }
531cdf0e10cSrcweir 
532cdf0e10cSrcweir // -----------------------------------------------------------------------
533cdf0e10cSrcweir 
GetStandardImageHC()534cdf0e10cSrcweir Image InfoBox::GetStandardImageHC()
535cdf0e10cSrcweir {
536cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
537cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 4 );
538cdf0e10cSrcweir }
539cdf0e10cSrcweir 
540cdf0e10cSrcweir // -----------------------------------------------------------------------
541cdf0e10cSrcweir 
ImplInitWarningBoxData()542cdf0e10cSrcweir void WarningBox::ImplInitWarningBoxData()
543cdf0e10cSrcweir {
544cdf0e10cSrcweir 	// Default Text is the display title from the application
545cdf0e10cSrcweir 	if ( !GetText().Len() )
546cdf0e10cSrcweir 		SetText( Application::GetDisplayName() );
547cdf0e10cSrcweir 
548cdf0e10cSrcweir 	SetImage( WarningBox::GetStandardImage() );
549cdf0e10cSrcweir 	mnSoundType = ((sal_uInt16)SOUND_WARNING)+1;
550cdf0e10cSrcweir }
551cdf0e10cSrcweir 
552cdf0e10cSrcweir // -----------------------------------------------------------------------
553cdf0e10cSrcweir 
WarningBox(Window * pParent,WinBits nStyle,const XubString & rMessage)554cdf0e10cSrcweir WarningBox::WarningBox( Window* pParent, WinBits nStyle,
555cdf0e10cSrcweir 						const XubString& rMessage ) :
556cdf0e10cSrcweir 	MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
557cdf0e10cSrcweir {
558cdf0e10cSrcweir 	ImplInitWarningBoxData();
559cdf0e10cSrcweir }
560cdf0e10cSrcweir 
561cdf0e10cSrcweir // -----------------------------------------------------------------------
562cdf0e10cSrcweir 
WarningBox(Window * pParent,const ResId & rResId)563cdf0e10cSrcweir WarningBox::WarningBox( Window* pParent, const ResId& rResId ) :
564cdf0e10cSrcweir 	MessBox( pParent, rResId.SetRT( RSC_WARNINGBOX ) )
565cdf0e10cSrcweir {
566cdf0e10cSrcweir 	ImplInitWarningBoxData();
567cdf0e10cSrcweir }
568cdf0e10cSrcweir 
569cdf0e10cSrcweir // -----------------------------------------------------------------------
570cdf0e10cSrcweir 
SetDefaultCheckBoxText()571cdf0e10cSrcweir void WarningBox::SetDefaultCheckBoxText()
572cdf0e10cSrcweir {
573cdf0e10cSrcweir     ResMgr* pResMgr = ImplGetResMgr();
574cdf0e10cSrcweir     if( pResMgr )
575cdf0e10cSrcweir         maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTWARNAGAIN, *pResMgr ) );
576cdf0e10cSrcweir }
577cdf0e10cSrcweir 
578cdf0e10cSrcweir // -----------------------------------------------------------------------
579cdf0e10cSrcweir 
GetStandardImage()580cdf0e10cSrcweir Image WarningBox::GetStandardImage()
581cdf0e10cSrcweir {
582cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
583cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
584cdf0e10cSrcweir }
585cdf0e10cSrcweir 
586cdf0e10cSrcweir // -----------------------------------------------------------------------
587cdf0e10cSrcweir 
ImplInitErrorBoxData()588cdf0e10cSrcweir void ErrorBox::ImplInitErrorBoxData()
589cdf0e10cSrcweir {
590cdf0e10cSrcweir 	// Default Text is the display title from the application
591cdf0e10cSrcweir 	if ( !GetText().Len() )
592cdf0e10cSrcweir 		SetText( Application::GetDisplayName() );
593cdf0e10cSrcweir 
594cdf0e10cSrcweir 	SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
595cdf0e10cSrcweir         ErrorBox::GetStandardImageHC() : ErrorBox::GetStandardImage() );
596cdf0e10cSrcweir 	mnSoundType = ((sal_uInt16)SOUND_ERROR)+1;
597cdf0e10cSrcweir }
598cdf0e10cSrcweir 
599cdf0e10cSrcweir // -----------------------------------------------------------------------
600cdf0e10cSrcweir 
ErrorBox(Window * pParent,WinBits nStyle,const XubString & rMessage)601cdf0e10cSrcweir ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
602cdf0e10cSrcweir 					const XubString& rMessage ) :
603cdf0e10cSrcweir 	MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
604cdf0e10cSrcweir {
605cdf0e10cSrcweir 	ImplInitErrorBoxData();
606cdf0e10cSrcweir }
607cdf0e10cSrcweir 
608cdf0e10cSrcweir // -----------------------------------------------------------------------
609cdf0e10cSrcweir 
ErrorBox(Window * pParent,const ResId & rResId)610cdf0e10cSrcweir ErrorBox::ErrorBox( Window* pParent, const ResId& rResId ) :
611cdf0e10cSrcweir 	MessBox( pParent, rResId.SetRT( RSC_ERRORBOX ) )
612cdf0e10cSrcweir {
613cdf0e10cSrcweir 	ImplInitErrorBoxData();
614cdf0e10cSrcweir }
615cdf0e10cSrcweir 
616cdf0e10cSrcweir // -----------------------------------------------------------------------
617cdf0e10cSrcweir 
GetStandardImage()618cdf0e10cSrcweir Image ErrorBox::GetStandardImage()
619cdf0e10cSrcweir {
620cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
621cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
622cdf0e10cSrcweir }
623cdf0e10cSrcweir 
624cdf0e10cSrcweir // -----------------------------------------------------------------------
625cdf0e10cSrcweir 
GetStandardImageHC()626cdf0e10cSrcweir Image ErrorBox::GetStandardImageHC()
627cdf0e10cSrcweir {
628cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
629cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 1 );
630cdf0e10cSrcweir }
631cdf0e10cSrcweir 
632cdf0e10cSrcweir // -----------------------------------------------------------------------
633cdf0e10cSrcweir 
ImplInitQueryBoxData()634cdf0e10cSrcweir void QueryBox::ImplInitQueryBoxData()
635cdf0e10cSrcweir {
636cdf0e10cSrcweir 	// Default Text is the display title from the application
637cdf0e10cSrcweir 	if ( !GetText().Len() )
638cdf0e10cSrcweir 		SetText( Application::GetDisplayName() );
639cdf0e10cSrcweir 
640cdf0e10cSrcweir 	SetImage( GetSettings().GetStyleSettings().GetHighContrastMode() ?
641cdf0e10cSrcweir         QueryBox::GetStandardImageHC() : QueryBox::GetStandardImage() );
642cdf0e10cSrcweir 	mnSoundType = ((sal_uInt16)SOUND_QUERY)+1;
643cdf0e10cSrcweir }
644cdf0e10cSrcweir 
645cdf0e10cSrcweir // -----------------------------------------------------------------------
646cdf0e10cSrcweir 
QueryBox(Window * pParent,WinBits nStyle,const XubString & rMessage)647cdf0e10cSrcweir QueryBox::QueryBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
648cdf0e10cSrcweir 	MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
649cdf0e10cSrcweir {
650cdf0e10cSrcweir 	ImplInitQueryBoxData();
651cdf0e10cSrcweir }
652cdf0e10cSrcweir 
653cdf0e10cSrcweir // -----------------------------------------------------------------------
654cdf0e10cSrcweir 
QueryBox(Window * pParent,const ResId & rResId)655cdf0e10cSrcweir QueryBox::QueryBox( Window* pParent, const ResId& rResId ) :
656cdf0e10cSrcweir 	MessBox( pParent, rResId.SetRT( RSC_QUERYBOX ) )
657cdf0e10cSrcweir {
658cdf0e10cSrcweir 	ImplInitQueryBoxData();
659cdf0e10cSrcweir }
660cdf0e10cSrcweir 
661cdf0e10cSrcweir // -----------------------------------------------------------------------
662cdf0e10cSrcweir 
SetDefaultCheckBoxText()663cdf0e10cSrcweir void QueryBox::SetDefaultCheckBoxText()
664cdf0e10cSrcweir {
665cdf0e10cSrcweir     ResMgr* pResMgr = ImplGetResMgr();
666cdf0e10cSrcweir     if( pResMgr )
667cdf0e10cSrcweir         maCheckBoxText = XubString( ResId( SV_STDTEXT_DONTASKAGAIN, *pResMgr ) );
668cdf0e10cSrcweir }
669cdf0e10cSrcweir 
670cdf0e10cSrcweir // -----------------------------------------------------------------------
671cdf0e10cSrcweir 
GetStandardImage()672cdf0e10cSrcweir Image QueryBox::GetStandardImage()
673cdf0e10cSrcweir {
674cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
675cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
678cdf0e10cSrcweir // -----------------------------------------------------------------------
679cdf0e10cSrcweir 
GetStandardImageHC()680cdf0e10cSrcweir Image QueryBox::GetStandardImageHC()
681cdf0e10cSrcweir {
682cdf0e10cSrcweir 	ImplInitMsgBoxImageList();
683cdf0e10cSrcweir 	return ImplGetSVData()->maWinData.mpMsgBoxHCImgList->GetImage( 2 );
684cdf0e10cSrcweir }
685cdf0e10cSrcweir 
686cdf0e10cSrcweir // -----------------------------------------------------------------------
687cdf0e10cSrcweir 
GetOptimalSize(WindowSizeType eType) const688cdf0e10cSrcweir Size MessBox::GetOptimalSize(WindowSizeType eType) const
689cdf0e10cSrcweir {
690cdf0e10cSrcweir     switch( eType ) {
691cdf0e10cSrcweir     case WINDOWSIZE_MINIMUM:
692cdf0e10cSrcweir         // FIXME: base me on the font size ?
693cdf0e10cSrcweir         return Size( 250, 100 );
694cdf0e10cSrcweir     default:
695cdf0e10cSrcweir         return Window::GetOptimalSize( eType );
696cdf0e10cSrcweir     }
697cdf0e10cSrcweir }
698