LCOV - code coverage report
Current view: top level - vcl/source/window - msgbox.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 309 0.0 %
Date: 2014-04-11 Functions: 0 32 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <tools/rc.h>
      21             : 
      22             : #include <svids.hrc>
      23             : #include <svdata.hxx>
      24             : #include <brdwin.hxx>
      25             : #include <window.h>
      26             : 
      27             : #include <vcl/metric.hxx>
      28             : #include <vcl/svapp.hxx>
      29             : #include <vcl/wrkwin.hxx>
      30             : #include <vcl/fixed.hxx>
      31             : #include <vcl/vclmedit.hxx>
      32             : #include <vcl/msgbox.hxx>
      33             : #include <vcl/button.hxx>
      34             : #include <vcl/mnemonic.hxx>
      35             : #include <vcl/settings.hxx>
      36             : 
      37           0 : static void ImplInitMsgBoxImageList()
      38             : {
      39           0 :     ImplSVData* pSVData = ImplGetSVData();
      40           0 :     if ( !pSVData->maWinData.mpMsgBoxImgList )
      41             :     {
      42           0 :         ResMgr* pResMgr = ImplGetResMgr();
      43           0 :         pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
      44           0 :         if( pResMgr )
      45             :         {
      46           0 :             Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
      47             :             pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
      48           0 :                 ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask );
      49             :         }
      50             :     }
      51           0 : }
      52             : 
      53           0 : void MessBox::ImplInitMessBoxData()
      54             : {
      55           0 :     mpVCLMultiLineEdit  = NULL;
      56           0 :     mpFixedImage        = NULL;
      57           0 :     mbHelpBtn           = false;
      58           0 :     mpCheckBox          = NULL;
      59           0 :     mbCheck             = false;
      60           0 : }
      61             : 
      62           0 : void MessBox::ImplInitButtons()
      63             : {
      64           0 :     WinBits nStyle = GetStyle();
      65           0 :     sal_uInt16  nOKFlags = BUTTONDIALOG_OKBUTTON;
      66           0 :     sal_uInt16  nCancelFlags = BUTTONDIALOG_CANCELBUTTON;
      67           0 :     sal_uInt16  nRetryFlags = 0;
      68           0 :     sal_uInt16  nYesFlags = 0;
      69           0 :     sal_uInt16  nNoFlags = 0;
      70             : 
      71           0 :     if ( nStyle & WB_OK_CANCEL )
      72             :     {
      73           0 :         if ( nStyle & WB_DEF_CANCEL )
      74           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      75             :         else // WB_DEF_OK
      76           0 :             nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      77             : 
      78           0 :         AddButton( BUTTON_OK, RET_OK, nOKFlags );
      79           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
      80             :     }
      81           0 :     else if ( nStyle & WB_YES_NO )
      82             :     {
      83           0 :         if ( nStyle & WB_DEF_YES )
      84           0 :             nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      85             :         else // WB_DEF_NO
      86           0 :             nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      87           0 :         nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
      88             : 
      89           0 :         AddButton( BUTTON_YES, RET_YES, nYesFlags );
      90           0 :         AddButton( BUTTON_NO, RET_NO, nNoFlags );
      91             :     }
      92           0 :     else if ( nStyle & WB_YES_NO_CANCEL )
      93             :     {
      94           0 :         if ( nStyle & WB_DEF_YES )
      95           0 :             nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      96           0 :         else if ( nStyle & WB_DEF_NO )
      97           0 :             nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      98             :         else
      99           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     100             : 
     101           0 :         AddButton( BUTTON_YES, RET_YES, nYesFlags );
     102           0 :         AddButton( BUTTON_NO, RET_NO, nNoFlags );
     103           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
     104             :     }
     105           0 :     else if ( nStyle & WB_RETRY_CANCEL )
     106             :     {
     107           0 :         if ( nStyle & WB_DEF_CANCEL )
     108           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     109             :         else // WB_DEF_RETRY
     110           0 :             nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     111             : 
     112           0 :         AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
     113           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
     114             :     }
     115           0 :     else if ( nStyle & WB_ABORT_RETRY_IGNORE )
     116             :     {
     117           0 :         sal_uInt16 nAbortFlags = 0;
     118           0 :         sal_uInt16 nIgnoreFlags = 0;
     119             : 
     120           0 :         if ( nStyle & WB_DEF_CANCEL )
     121           0 :             nAbortFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     122           0 :         else if ( nStyle & WB_DEF_RETRY )
     123           0 :             nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     124           0 :         else if ( nStyle & WB_DEF_IGNORE )
     125           0 :             nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     126             : 
     127           0 :         AddButton( BUTTON_ABORT, RET_CANCEL, nAbortFlags );
     128           0 :         AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
     129           0 :         AddButton( BUTTON_IGNORE, RET_IGNORE, nIgnoreFlags );
     130             :     }
     131           0 :     else if ( nStyle & WB_OK )
     132             :     {
     133           0 :         nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     134             : 
     135           0 :         AddButton( BUTTON_OK, RET_OK, nOKFlags );
     136             :     }
     137           0 : }
     138             : 
     139           0 : MessBox::MessBox( Window* pParent, WinBits nStyle,
     140             :                   const OUString& rTitle, const OUString& rMessage ) :
     141             :     ButtonDialog( WINDOW_MESSBOX ),
     142           0 :     maMessText( rMessage )
     143             : {
     144           0 :     ImplInitMessBoxData();
     145           0 :     ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
     146           0 :     ImplInitButtons();
     147             : 
     148           0 :     if ( !rTitle.isEmpty() )
     149           0 :         SetText( rTitle );
     150           0 : }
     151             : 
     152           0 : MessBox::MessBox( Window* pParent, const ResId& rResId ) :
     153           0 :     ButtonDialog( WINDOW_MESSBOX )
     154             : {
     155           0 :     ImplInitMessBoxData();
     156             : 
     157           0 :     GetRes( rResId.SetRT( RSC_MESSBOX ) );
     158           0 :     sal_uInt16 nHiButtons   = ReadShortRes();
     159           0 :     sal_uInt16 nLoButtons   = ReadShortRes();
     160           0 :     sal_uInt16 nHiDefButton = ReadShortRes();
     161           0 :     sal_uInt16 nLoDefButton = ReadShortRes();
     162           0 :     OString aHelpId( ReadByteStringRes() );
     163           0 :     /* sal_uInt16 bSysModal = */ ReadShortRes();
     164           0 :     SetHelpId( aHelpId );
     165           0 :     WinBits nBits = (((sal_uLong)nHiButtons << 16) + nLoButtons) |
     166           0 :                     (((sal_uLong)nHiDefButton << 16) + nLoDefButton);
     167           0 :     ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
     168             : 
     169           0 :     ImplLoadRes( rResId );
     170           0 :     ImplInitButtons();
     171           0 : }
     172             : 
     173           0 : void MessBox::ImplLoadRes( const ResId& )
     174             : {
     175           0 :     SetText(     ReadStringRes() );
     176           0 :     SetMessText( ReadStringRes() );
     177           0 :     SetHelpText( ReadStringRes() );
     178           0 : }
     179             : 
     180           0 : MessBox::~MessBox()
     181             : {
     182           0 :     delete mpVCLMultiLineEdit;
     183           0 :     delete mpFixedImage;
     184           0 :     delete mpCheckBox;
     185           0 : }
     186             : 
     187           0 : void MessBox::ImplPosControls()
     188             : {
     189           0 :     if ( !GetHelpId().isEmpty() )
     190             :     {
     191           0 :         if ( !mbHelpBtn )
     192             :         {
     193           0 :             AddButton( BUTTON_HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
     194           0 :             mbHelpBtn = true;
     195             :         }
     196             :     }
     197             :     else
     198             :     {
     199           0 :         if ( mbHelpBtn )
     200             :         {
     201           0 :             RemoveButton( RET_HELP );
     202           0 :             mbHelpBtn = false;
     203             :         }
     204             :     }
     205             : 
     206           0 :     TextRectInfo    aTextInfo;
     207           0 :     Rectangle       aRect( 0, 0, 30000, 30000 );
     208           0 :     Rectangle       aFormatRect;
     209           0 :     Point           aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y );
     210           0 :     Size            aImageSize;
     211           0 :     Size            aPageSize;
     212           0 :     Size            aMEditSize;
     213             :     long            nTitleWidth;
     214           0 :     long            nButtonSize = ImplGetButtonSize();
     215           0 :     long            nMaxWidth = GetDesktopRectPixel().GetWidth()-8;
     216             :     long            nMaxLineWidth;
     217             :     long            nWidth;
     218           0 :     WinBits         nWinStyle = WB_LEFT | WB_NOLABEL;
     219           0 :     sal_uInt16          nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
     220             : 
     221           0 :     delete mpVCLMultiLineEdit;
     222           0 :     if ( mpFixedImage )
     223             :     {
     224           0 :         delete mpFixedImage;
     225           0 :         mpFixedImage = NULL;
     226             :     }
     227           0 :     if ( mpCheckBox )
     228             :     {
     229           0 :         mbCheck = mpCheckBox->IsChecked();
     230           0 :         delete mpCheckBox;
     231           0 :         mpCheckBox = NULL;
     232             :     }
     233             : 
     234             :     // Clean up message text with tabs
     235           0 :     OUString aMessText(maMessText.replaceAll("\t", "    "));
     236             : 
     237             :     //If window too small, we make dialog box be wider
     238           0 :     if ( mpWindowImpl->mbFrame )
     239             :     {
     240           0 :         nMaxWidth = 630 * GetDPIScaleFactor();
     241             :     }
     242           0 :     else if ( nMaxWidth < 120 )
     243           0 :         nMaxWidth = 120;
     244             : 
     245           0 :     nMaxWidth -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder+4;
     246             : 
     247             :     // MessagBox should be at least as wide as to see the title
     248             :     // Extra-Width for Closer, because Closer is set after this call
     249           0 :     nTitleWidth = CalcTitleWidth();
     250           0 :     nTitleWidth += mpWindowImpl->mnTopBorder;
     251             : 
     252           0 :     nMaxWidth -= (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
     253             : 
     254             :     // for an image, get its size, create a suitable control and position it
     255           0 :     aImageSize = maImage.GetSizePixel();
     256           0 :     if ( aImageSize.Width() )
     257             :     {
     258           0 :         aImageSize.Width()  += 4;
     259           0 :         aImageSize.Height() += 4;
     260           0 :         aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
     261           0 :         mpFixedImage = new FixedImage( this );
     262             :         mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
     263             :                                               IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
     264           0 :                                        aImageSize );
     265           0 :         mpFixedImage->SetImage( maImage );
     266           0 :         mpFixedImage->Show();
     267           0 :         nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
     268             :     }
     269             :     else
     270           0 :         aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X;
     271             : 
     272             :     // Determine maximum line length without wordbreak
     273           0 :     aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     274           0 :     nMaxLineWidth = aFormatRect.GetWidth();
     275           0 :     nTextStyle |= TEXT_DRAW_WORDBREAK;
     276             : 
     277             :     // Determine the width for text formatting
     278           0 :     if ( nMaxLineWidth > 450 )
     279           0 :         nWidth = 450;
     280           0 :     else if ( nMaxLineWidth > 300 )
     281           0 :         nWidth = nMaxLineWidth+5;
     282             :     else
     283           0 :         nWidth = 300;
     284             : 
     285           0 :     nWidth *= GetDPIScaleFactor();
     286             : 
     287           0 :     if ( nButtonSize > nWidth )
     288           0 :         nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET);
     289           0 :     if ( nWidth > nMaxWidth )
     290           0 :         nWidth = nMaxWidth;
     291             : 
     292           0 :     aRect.Right() = nWidth;
     293           0 :     aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     294           0 :     if ( aTextInfo.GetMaxLineWidth() > nWidth )
     295             :     {
     296           0 :         nWidth = aTextInfo.GetMaxLineWidth()+8;
     297           0 :         aRect.Right() = nWidth;
     298           0 :         aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     299             :     }
     300             : 
     301             :     // get Style for VCLMultiLineEdit
     302           0 :     aMEditSize.Width()  = aTextInfo.GetMaxLineWidth()+1;
     303           0 :     aMEditSize.Height() = aFormatRect.GetHeight();
     304           0 :     aPageSize.Width()   = aImageSize.Width();
     305           0 :     if ( aMEditSize.Height() < aImageSize.Height() )
     306             :     {
     307           0 :         nWinStyle |= WB_VCENTER;
     308           0 :         aPageSize.Height()  = aImageSize.Height();
     309           0 :         aMEditSize.Height() = aImageSize.Height();
     310             :     }
     311             :     else
     312             :     {
     313           0 :         nWinStyle |= WB_TOP;
     314           0 :         aPageSize.Height()  = aMEditSize.Height();
     315             :     }
     316           0 :     if ( aImageSize.Width() )
     317           0 :         aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE;
     318           0 :     aPageSize.Width()  += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
     319           0 :     aPageSize.Width()  += aMEditSize.Width()+1;
     320           0 :     aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     321             : 
     322           0 :     if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH )
     323           0 :         aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH;
     324           0 :     if ( aPageSize.Width() < nTitleWidth )
     325           0 :         aPageSize.Width() = nTitleWidth;
     326             : 
     327           0 :     if ( !maCheckBoxText.isEmpty() )
     328             :     {
     329           0 :         Size aMinCheckboxSize ( aMEditSize );
     330           0 :         if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
     331             :         {
     332           0 :             aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH+80;
     333           0 :             aMinCheckboxSize.Width() += 80;
     334             :         }
     335             : 
     336             :         // #104492# auto mnemonics for CJK strings may increase the length, so measure the
     337             :         // checkbox length including a temporary mnemonic, the correct auto mnemonic will be
     338             :         // generated later in the dialog (see init_show)
     339             : 
     340           0 :         OUString aMnemonicString( maCheckBoxText );
     341           0 :         if( GetSettings().GetStyleSettings().GetAutoMnemonic() )
     342             :         {
     343           0 :             if( aMnemonicString == GetNonMnemonicString( maCheckBoxText ) )
     344             :             {
     345             :                 // no mnemonic found -> create one
     346           0 :                 MnemonicGenerator aMnemonicGenerator;
     347           0 :                 aMnemonicString = aMnemonicGenerator.CreateMnemonic( aMnemonicString );
     348             :             }
     349             :         }
     350             : 
     351           0 :         mpCheckBox = new CheckBox( this );
     352           0 :         mpCheckBox->Check( mbCheck );
     353           0 :         mpCheckBox->SetText( aMnemonicString );
     354           0 :         mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK );
     355           0 :         mpCheckBox->SetHelpId( GetHelpId() );   // DR: Check box and dialog have same HID
     356             : 
     357             :         // align checkbox with message text
     358           0 :         Size aSize = mpCheckBox->CalcMinimumSize( aMinCheckboxSize.Width() );
     359             : 
     360             :         // now set the original non-mnemonic string
     361           0 :         mpCheckBox->SetText( maCheckBoxText );
     362             : 
     363           0 :         Point aPos( aTextPos );
     364           0 :         aPos.Y() += aMEditSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     365             : 
     366             :         // increase messagebox
     367           0 :         aPageSize.Height() += aSize.Height() + (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     368             : 
     369           0 :         mpCheckBox->SetPosSizePixel( aPos, aSize );
     370           0 :         mpCheckBox->Show();
     371             :     }
     372             : 
     373           0 :     mpVCLMultiLineEdit = new VclMultiLineEdit( this, nWinStyle );
     374           0 :     mpVCLMultiLineEdit->SetText( aMessText );
     375           0 :     mpVCLMultiLineEdit->SetPosSizePixel( aTextPos, aMEditSize );
     376           0 :     mpVCLMultiLineEdit->Show();
     377           0 :     mpVCLMultiLineEdit->SetPaintTransparent(true);
     378           0 :     mpVCLMultiLineEdit->EnableCursor(false);
     379           0 :     SetPageSizePixel( aPageSize );
     380           0 : }
     381             : 
     382           0 : void MessBox::StateChanged( StateChangedType nType )
     383             : {
     384           0 :     if ( nType == STATE_CHANGE_INITSHOW )
     385             :     {
     386           0 :         ImplPosControls();
     387             :     }
     388           0 :     ButtonDialog::StateChanged( nType );
     389           0 : }
     390             : 
     391           0 : bool MessBox::GetCheckBoxState() const
     392             : {
     393           0 :     return mpCheckBox ? mpCheckBox->IsChecked() : mbCheck;
     394             : }
     395             : 
     396           0 : void MessBox::SetCheckBoxState( bool bCheck )
     397             : {
     398           0 :     if( mpCheckBox ) mpCheckBox->Check( bCheck );
     399           0 :     mbCheck = bCheck;
     400           0 : }
     401             : 
     402           0 : Size MessBox::GetOptimalSize() const
     403             : {
     404             :     // FIXME: base me on the font size ?
     405           0 :     return Size( 250, 100 );
     406             : }
     407             : 
     408           0 : void InfoBox::ImplInitInfoBoxData()
     409             : {
     410             :     // Default Text is the display title from the application
     411           0 :     if ( GetText().isEmpty() )
     412           0 :         SetText( Application::GetDisplayName() );
     413             : 
     414           0 :     SetImage( InfoBox::GetStandardImage() );
     415           0 : }
     416             : 
     417           0 : InfoBox::InfoBox( Window* pParent, const OUString& rMessage ) :
     418           0 :     MessBox( pParent, WB_OK | WB_DEF_OK, OUString(), rMessage )
     419             : {
     420           0 :     ImplInitInfoBoxData();
     421           0 : }
     422             : 
     423           0 : InfoBox::InfoBox( Window* pParent, const ResId & rResId ) :
     424           0 :     MessBox( pParent, rResId.SetRT( RSC_INFOBOX ) )
     425             : {
     426           0 :     ImplInitInfoBoxData();
     427           0 : }
     428             : 
     429           0 : InfoBox::InfoBox( Window* pParent, WinBits nStyle, const OUString& rMessage ) :
     430           0 :     MessBox( pParent, nStyle, OUString(), rMessage )
     431             : {
     432           0 :     ImplInitInfoBoxData();
     433           0 : }
     434             : 
     435           0 : Image InfoBox::GetStandardImage()
     436             : {
     437           0 :     ImplInitMsgBoxImageList();
     438           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
     439             : }
     440             : 
     441           0 : void WarningBox::ImplInitWarningBoxData()
     442             : {
     443             :     // Default Text is the display title from the application
     444           0 :     if ( GetText().isEmpty() )
     445           0 :         SetText( Application::GetDisplayName() );
     446             : 
     447           0 :     SetImage( WarningBox::GetStandardImage() );
     448           0 : }
     449             : 
     450           0 : WarningBox::WarningBox( Window* pParent, WinBits nStyle,
     451             :                         const OUString& rMessage ) :
     452           0 :     MessBox( pParent, nStyle, OUString(), rMessage )
     453             : {
     454           0 :     ImplInitWarningBoxData();
     455           0 : }
     456             : 
     457           0 : WarningBox::WarningBox( Window* pParent, const ResId& rResId ) :
     458           0 :     MessBox( pParent, rResId.SetRT( RSC_WARNINGBOX ) )
     459             : {
     460           0 :     ImplInitWarningBoxData();
     461           0 : }
     462             : 
     463           0 : void WarningBox::SetDefaultCheckBoxText()
     464             : {
     465           0 :     ResMgr* pResMgr = ImplGetResMgr();
     466           0 :     if( pResMgr )
     467           0 :         maCheckBoxText = ResId(SV_STDTEXT_DONTWARNAGAIN, *pResMgr).toString();
     468           0 : }
     469             : 
     470           0 : Image WarningBox::GetStandardImage()
     471             : {
     472           0 :     ImplInitMsgBoxImageList();
     473           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
     474             : }
     475             : 
     476           0 : void ErrorBox::ImplInitErrorBoxData()
     477             : {
     478             :     // Default Text is the display title from the application
     479           0 :     if ( GetText().isEmpty() )
     480           0 :         SetText( Application::GetDisplayName() );
     481             : 
     482           0 :     SetImage( ErrorBox::GetStandardImage() );
     483           0 : }
     484             : 
     485           0 : ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
     486             :                     const OUString& rMessage ) :
     487           0 :     MessBox( pParent, nStyle, OUString(), rMessage )
     488             : {
     489           0 :     ImplInitErrorBoxData();
     490           0 : }
     491             : 
     492           0 : ErrorBox::ErrorBox( Window* pParent, const ResId& rResId ) :
     493           0 :     MessBox( pParent, rResId.SetRT( RSC_ERRORBOX ) )
     494             : {
     495           0 :     ImplInitErrorBoxData();
     496           0 : }
     497             : 
     498           0 : Image ErrorBox::GetStandardImage()
     499             : {
     500             :     try
     501             :     {
     502           0 :         ImplInitMsgBoxImageList();
     503             :     }
     504           0 :     catch (const ::com::sun::star::uno::Exception &)
     505             :     {
     506             :         // During early bootstrap we can have no initialized
     507             :         // ucb and hence no ability to get this image, so nop.
     508           0 :         return Image();
     509             :     }
     510           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
     511             : }
     512             : 
     513           0 : void QueryBox::ImplInitQueryBoxData()
     514             : {
     515             :     // Default Text is the display title from the application
     516           0 :     if ( GetText().isEmpty() )
     517           0 :         SetText( Application::GetDisplayName() );
     518             : 
     519           0 :     SetImage( QueryBox::GetStandardImage() );
     520           0 : }
     521             : 
     522           0 : QueryBox::QueryBox( Window* pParent, WinBits nStyle, const OUString& rMessage ) :
     523           0 :     MessBox( pParent, nStyle, OUString(), rMessage )
     524             : {
     525           0 :     ImplInitQueryBoxData();
     526           0 : }
     527             : 
     528           0 : QueryBox::QueryBox( Window* pParent, const ResId& rResId ) :
     529           0 :     MessBox( pParent, rResId.SetRT( RSC_QUERYBOX ) )
     530             : {
     531           0 :     ImplInitQueryBoxData();
     532           0 : }
     533             : 
     534           0 : void QueryBox::SetDefaultCheckBoxText()
     535             : {
     536           0 :     ResMgr* pResMgr = ImplGetResMgr();
     537           0 :     if( pResMgr )
     538           0 :         maCheckBoxText = ResId(SV_STDTEXT_DONTASKAGAIN, *pResMgr).toString();
     539           0 : }
     540             : 
     541           0 : Image QueryBox::GetStandardImage()
     542             : {
     543           0 :     ImplInitMsgBoxImageList();
     544           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
     545             : }
     546             : 
     547             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10