LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/vcl/source/window - msgbox.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 309 0.3 %
Date: 2013-07-09 Functions: 2 33 6.1 %
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             : 
      21             : #include <tools/rc.h>
      22             : 
      23             : #include <svids.hrc>
      24             : #include <svdata.hxx>
      25             : #include <brdwin.hxx>
      26             : #include <window.h>
      27             : 
      28             : #include <vcl/metric.hxx>
      29             : #include <vcl/svapp.hxx>
      30             : #include <vcl/wrkwin.hxx>
      31             : #include <vcl/fixed.hxx>
      32             : #include <vcl/vclmedit.hxx>
      33             : #include <vcl/msgbox.hxx>
      34             : #include <vcl/button.hxx>
      35             : #include <vcl/mnemonic.hxx>
      36             : 
      37             : 
      38             : 
      39             : // =======================================================================
      40             : 
      41           0 : static void ImplInitMsgBoxImageList()
      42             : {
      43           0 :     ImplSVData* pSVData = ImplGetSVData();
      44           0 :     if ( !pSVData->maWinData.mpMsgBoxImgList )
      45             :     {
      46           0 :         ResMgr* pResMgr = ImplGetResMgr();
      47           0 :         pSVData->maWinData.mpMsgBoxImgList = new ImageList(4);
      48           0 :         if( pResMgr )
      49             :         {
      50           0 :             Color aNonAlphaMask( 0xC0, 0xC0, 0xC0 );
      51             :             pSVData->maWinData.mpMsgBoxImgList->InsertFromHorizontalBitmap
      52           0 :                 ( ResId( SV_RESID_BITMAP_MSGBOX, *pResMgr ), 4, &aNonAlphaMask );
      53             :         }
      54             :     }
      55           0 : }
      56             : 
      57             : // =======================================================================
      58             : 
      59           0 : void MessBox::ImplInitMessBoxData()
      60             : {
      61           0 :     mpVCLMultiLineEdit  = NULL;
      62           0 :     mpFixedImage        = NULL;
      63           0 :     mbHelpBtn           = sal_False;
      64           0 :     mpCheckBox          = NULL;
      65           0 :     mbCheck             = sal_False;
      66           0 : }
      67             : 
      68             : // -----------------------------------------------------------------------
      69             : 
      70           0 : void MessBox::ImplInitButtons()
      71             : {
      72           0 :     WinBits nStyle = GetStyle();
      73           0 :     sal_uInt16  nOKFlags = BUTTONDIALOG_OKBUTTON;
      74           0 :     sal_uInt16  nCancelFlags = BUTTONDIALOG_CANCELBUTTON;
      75           0 :     sal_uInt16  nRetryFlags = 0;
      76           0 :     sal_uInt16  nYesFlags = 0;
      77           0 :     sal_uInt16  nNoFlags = 0;
      78             : 
      79           0 :     if ( nStyle & WB_OK_CANCEL )
      80             :     {
      81           0 :         if ( nStyle & WB_DEF_CANCEL )
      82           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      83             :         else // WB_DEF_OK
      84           0 :             nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      85             : 
      86           0 :         AddButton( BUTTON_OK, RET_OK, nOKFlags );
      87           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
      88             :     }
      89           0 :     else if ( nStyle & WB_YES_NO )
      90             :     {
      91           0 :         if ( nStyle & WB_DEF_YES )
      92           0 :             nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      93             :         else // WB_DEF_NO
      94           0 :             nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
      95           0 :         nNoFlags |= BUTTONDIALOG_CANCELBUTTON;
      96             : 
      97           0 :         AddButton( BUTTON_YES, RET_YES, nYesFlags );
      98           0 :         AddButton( BUTTON_NO, RET_NO, nNoFlags );
      99             :     }
     100           0 :     else if ( nStyle & WB_YES_NO_CANCEL )
     101             :     {
     102           0 :         if ( nStyle & WB_DEF_YES )
     103           0 :             nYesFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     104           0 :         else if ( nStyle & WB_DEF_NO )
     105           0 :             nNoFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     106             :         else
     107           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     108             : 
     109           0 :         AddButton( BUTTON_YES, RET_YES, nYesFlags );
     110           0 :         AddButton( BUTTON_NO, RET_NO, nNoFlags );
     111           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
     112             :     }
     113           0 :     else if ( nStyle & WB_RETRY_CANCEL )
     114             :     {
     115           0 :         if ( nStyle & WB_DEF_CANCEL )
     116           0 :             nCancelFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     117             :         else // WB_DEF_RETRY
     118           0 :             nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     119             : 
     120           0 :         AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
     121           0 :         AddButton( BUTTON_CANCEL, RET_CANCEL, nCancelFlags );
     122             :     }
     123           0 :     else if ( nStyle & WB_ABORT_RETRY_IGNORE )
     124             :     {
     125           0 :         sal_uInt16 nAbortFlags = 0;
     126           0 :         sal_uInt16 nIgnoreFlags = 0;
     127             : 
     128           0 :         if ( nStyle & WB_DEF_CANCEL )
     129           0 :             nAbortFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     130           0 :         else if ( nStyle & WB_DEF_RETRY )
     131           0 :             nRetryFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     132           0 :         else if ( nStyle & WB_DEF_IGNORE )
     133           0 :             nIgnoreFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     134             : 
     135           0 :         AddButton( BUTTON_ABORT, RET_CANCEL, nAbortFlags );
     136           0 :         AddButton( BUTTON_RETRY, RET_RETRY, nRetryFlags );
     137           0 :         AddButton( BUTTON_IGNORE, RET_IGNORE, nIgnoreFlags );
     138             :     }
     139           0 :     else if ( nStyle & WB_OK )
     140             :     {
     141           0 :         nOKFlags |= BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_FOCUSBUTTON;
     142             : 
     143           0 :         AddButton( BUTTON_OK, RET_OK, nOKFlags );
     144             :     }
     145           0 : }
     146             : 
     147             : // -----------------------------------------------------------------------
     148             : 
     149           0 : MessBox::MessBox( Window* pParent, WinBits nStyle,
     150             :                   const XubString& rTitle, const XubString& rMessage ) :
     151             :     ButtonDialog( WINDOW_MESSBOX ),
     152           0 :     maMessText( rMessage )
     153             : {
     154           0 :     ImplInitMessBoxData();
     155           0 :     ImplInit( pParent, nStyle | WB_MOVEABLE | WB_HORZ | WB_CENTER );
     156           0 :     ImplInitButtons();
     157             : 
     158           0 :     if ( rTitle.Len() )
     159           0 :         SetText( rTitle );
     160           0 : }
     161             : 
     162             : // -----------------------------------------------------------------------
     163             : 
     164           0 : MessBox::MessBox( Window* pParent, const ResId& rResId ) :
     165           0 :     ButtonDialog( WINDOW_MESSBOX )
     166             : {
     167           0 :     ImplInitMessBoxData();
     168             : 
     169           0 :     GetRes( rResId.SetRT( RSC_MESSBOX ) );
     170           0 :     sal_uInt16 nHiButtons   = ReadShortRes();
     171           0 :     sal_uInt16 nLoButtons   = ReadShortRes();
     172           0 :     sal_uInt16 nHiDefButton = ReadShortRes();
     173           0 :     sal_uInt16 nLoDefButton = ReadShortRes();
     174           0 :     OString aHelpId( ReadByteStringRes() );
     175           0 :     /* sal_uInt16 bSysModal = */ ReadShortRes();
     176           0 :     SetHelpId( aHelpId );
     177           0 :     WinBits nBits = (((sal_uLong)nHiButtons << 16) + nLoButtons) |
     178           0 :                     (((sal_uLong)nHiDefButton << 16) + nLoDefButton);
     179           0 :     ImplInit( pParent, nBits | WB_MOVEABLE | WB_HORZ | WB_CENTER );
     180             : 
     181           0 :     ImplLoadRes( rResId );
     182           0 :     ImplInitButtons();
     183           0 : }
     184             : 
     185             : // -----------------------------------------------------------------------
     186             : 
     187           0 : void MessBox::ImplLoadRes( const ResId& )
     188             : {
     189           0 :     SetText(     ReadStringRes() );
     190           0 :     SetMessText( ReadStringRes() );
     191           0 :     SetHelpText( ReadStringRes() );
     192           0 : }
     193             : 
     194             : // -----------------------------------------------------------------------
     195             : 
     196           0 : MessBox::~MessBox()
     197             : {
     198           0 :     delete mpVCLMultiLineEdit;
     199           0 :     delete mpFixedImage;
     200           0 :     delete mpCheckBox;
     201           0 : }
     202             : 
     203             : // -----------------------------------------------------------------------
     204             : 
     205           0 : void MessBox::ImplPosControls()
     206             : {
     207           0 :     if ( !GetHelpId().isEmpty() )
     208             :     {
     209           0 :         if ( !mbHelpBtn )
     210             :         {
     211           0 :             AddButton( BUTTON_HELP, RET_HELP, BUTTONDIALOG_HELPBUTTON, 3 );
     212           0 :             mbHelpBtn = sal_True;
     213             :         }
     214             :     }
     215             :     else
     216             :     {
     217           0 :         if ( mbHelpBtn )
     218             :         {
     219           0 :             RemoveButton( RET_HELP );
     220           0 :             mbHelpBtn = sal_False;
     221             :         }
     222             :     }
     223             : 
     224           0 :     XubString       aMessText( maMessText );
     225           0 :     TextRectInfo    aTextInfo;
     226           0 :     Rectangle       aRect( 0, 0, 30000, 30000 );
     227           0 :     Rectangle       aFormatRect;
     228           0 :     Point           aTextPos( IMPL_DIALOG_OFFSET, IMPL_DIALOG_OFFSET+IMPL_MSGBOX_OFFSET_EXTRA_Y );
     229           0 :     Size            aImageSize;
     230           0 :     Size            aPageSize;
     231           0 :     Size            aMEditSize;
     232             :     long            nTitleWidth;
     233           0 :     long            nButtonSize = ImplGetButtonSize();
     234           0 :     long            nMaxWidth = GetDesktopRectPixel().GetWidth()-8;
     235             :     long            nMaxLineWidth;
     236             :     long            nWidth;
     237           0 :     WinBits         nWinStyle = WB_LEFT | WB_WORDBREAK | WB_NOLABEL;
     238           0 :     sal_uInt16          nTextStyle = TEXT_DRAW_MULTILINE | TEXT_DRAW_TOP | TEXT_DRAW_LEFT;
     239             : 
     240           0 :     delete mpVCLMultiLineEdit;
     241           0 :     if ( mpFixedImage )
     242             :     {
     243           0 :         delete mpFixedImage;
     244           0 :         mpFixedImage = NULL;
     245             :     }
     246           0 :     if ( mpCheckBox )
     247             :     {
     248           0 :         mbCheck = mpCheckBox->IsChecked();
     249           0 :         delete mpCheckBox;
     250           0 :         mpCheckBox = NULL;
     251             :     }
     252             : 
     253             : 
     254             :     // Message-Text um Tabs bereinigen
     255           0 :     OUString   aTabStr("    ");
     256           0 :     sal_uInt16      nIndex = 0;
     257           0 :     while ( nIndex != STRING_NOTFOUND )
     258           0 :         nIndex = aMessText.SearchAndReplace( OUString('\t'), aTabStr, nIndex );
     259             : 
     260             :     // Wenn Fenster zu schmall, machen wir Dialog auch breiter
     261           0 :     if ( mpWindowImpl->mbFrame )
     262           0 :         nMaxWidth = 630;
     263           0 :     else if ( nMaxWidth < 120 )
     264           0 :         nMaxWidth = 120;
     265             : 
     266           0 :     nMaxWidth -= mpWindowImpl->mnLeftBorder+mpWindowImpl->mnRightBorder+4;
     267             : 
     268             :     // MessageBox sollte min. so breit sein, das auch Title sichtbar ist
     269             :     // Extra-Width for Closer, because Closer is set after this call
     270           0 :     nTitleWidth = CalcTitleWidth();
     271           0 :     nTitleWidth += mpWindowImpl->mnTopBorder;
     272             : 
     273           0 :     nMaxWidth -= (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
     274             : 
     275             :     // Wenn wir ein Image haben, dann deren Groesse ermitteln und das
     276             :     // entsprechende Control anlegen und positionieren
     277           0 :     aImageSize = maImage.GetSizePixel();
     278           0 :     if ( aImageSize.Width() )
     279             :     {
     280           0 :         aImageSize.Width()  += 4;
     281           0 :         aImageSize.Height() += 4;
     282           0 :         aTextPos.X() += aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
     283           0 :         mpFixedImage = new FixedImage( this );
     284             :         mpFixedImage->SetPosSizePixel( Point( IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_X,
     285             :                                               IMPL_DIALOG_OFFSET-2+IMPL_MSGBOX_OFFSET_EXTRA_Y ),
     286           0 :                                        aImageSize );
     287           0 :         mpFixedImage->SetImage( maImage );
     288           0 :         mpFixedImage->Show();
     289           0 :         nMaxWidth -= aImageSize.Width()+IMPL_SEP_MSGBOX_IMAGE;
     290             :     }
     291             :     else
     292           0 :         aTextPos.X() += IMPL_MSGBOX_OFFSET_EXTRA_X;
     293             : 
     294             :     // Maximale Zeilenlaenge ohne Wordbreak ermitteln
     295           0 :     aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     296           0 :     nMaxLineWidth = aFormatRect.GetWidth();
     297           0 :     nTextStyle |= TEXT_DRAW_WORDBREAK;
     298             : 
     299             :     // Breite fuer Textformatierung ermitteln
     300           0 :     if ( nMaxLineWidth > 450 )
     301           0 :         nWidth = 450;
     302           0 :     else if ( nMaxLineWidth > 300 )
     303           0 :         nWidth = nMaxLineWidth+5;
     304             :     else
     305           0 :         nWidth = 300;
     306           0 :     if ( nButtonSize > nWidth )
     307           0 :         nWidth = nButtonSize-(aTextPos.X()-IMPL_DIALOG_OFFSET);
     308           0 :     if ( nWidth > nMaxWidth )
     309           0 :         nWidth = nMaxWidth;
     310             : 
     311           0 :     aRect.Right() = nWidth;
     312           0 :     aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     313           0 :     if ( aTextInfo.GetMaxLineWidth() > nWidth )
     314             :     {
     315           0 :         nWidth = aTextInfo.GetMaxLineWidth()+8;
     316           0 :         aRect.Right() = nWidth;
     317           0 :         aFormatRect = GetTextRect( aRect, aMessText, nTextStyle, &aTextInfo );
     318             :     }
     319             : 
     320             :     // Style fuer VCLMultiLineEdit ermitteln
     321           0 :     aMEditSize.Width()  = aTextInfo.GetMaxLineWidth()+1;
     322           0 :     aMEditSize.Height() = aFormatRect.GetHeight();
     323           0 :     aPageSize.Width()   = aImageSize.Width();
     324           0 :     if ( aMEditSize.Height() < aImageSize.Height() )
     325             :     {
     326           0 :         nWinStyle |= WB_VCENTER;
     327           0 :         aPageSize.Height()  = aImageSize.Height();
     328           0 :         aMEditSize.Height() = aImageSize.Height();
     329             :     }
     330             :     else
     331             :     {
     332           0 :         nWinStyle |= WB_TOP;
     333           0 :         aPageSize.Height()  = aMEditSize.Height();
     334             :     }
     335           0 :     if ( aImageSize.Width() )
     336           0 :         aPageSize.Width() += IMPL_SEP_MSGBOX_IMAGE;
     337           0 :     aPageSize.Width()  += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_X*2);
     338           0 :     aPageSize.Width()  += aMEditSize.Width()+1;
     339           0 :     aPageSize.Height() += (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     340             : 
     341           0 :     if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH )
     342           0 :         aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH;
     343           0 :     if ( aPageSize.Width() < nTitleWidth )
     344           0 :         aPageSize.Width() = nTitleWidth;
     345             : 
     346           0 :     if ( maCheckBoxText.Len() )
     347             :     {
     348           0 :         Size aMinCheckboxSize ( aMEditSize );
     349           0 :         if ( aPageSize.Width() < IMPL_MINSIZE_MSGBOX_WIDTH+80 )
     350             :         {
     351           0 :             aPageSize.Width() = IMPL_MINSIZE_MSGBOX_WIDTH+80;
     352           0 :             aMinCheckboxSize.Width() += 80;
     353             :         }
     354             : 
     355             :         // #104492# auto mnemonics for CJK strings may increase the length, so measure the
     356             :         // checkbox length including a temporary mnemonic, the correct auto mnemonic will be
     357             :         // generated later in the dialog (see init_show)
     358             : 
     359           0 :         String aMnemonicString( maCheckBoxText );
     360           0 :         if( GetSettings().GetStyleSettings().GetAutoMnemonic() )
     361             :         {
     362           0 :             if( aMnemonicString == GetNonMnemonicString( maCheckBoxText ) )
     363             :             {
     364             :                 // no mnemonic found -> create one
     365           0 :                 MnemonicGenerator aMnemonicGenerator;
     366           0 :                 aMnemonicGenerator.CreateMnemonic( aMnemonicString );
     367             :             }
     368             :         }
     369             : 
     370           0 :         mpCheckBox = new CheckBox( this );
     371           0 :         mpCheckBox->Check( mbCheck );
     372           0 :         mpCheckBox->SetText( aMnemonicString );
     373           0 :         mpCheckBox->SetStyle( mpCheckBox->GetStyle() | WB_WORDBREAK );
     374           0 :         mpCheckBox->SetHelpId( GetHelpId() );   // DR: Check box and dialog have same HID
     375             : 
     376             :         // align checkbox with message text
     377           0 :         Size aSize = mpCheckBox->CalcMinimumSize( aMinCheckboxSize.Width() );
     378             : 
     379             :         // now set the original non-mnemonic string
     380           0 :         mpCheckBox->SetText( maCheckBoxText );
     381             : 
     382           0 :         Point aPos( aTextPos );
     383           0 :         aPos.Y() += aMEditSize.Height() + (IMPL_DIALOG_OFFSET)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     384             : 
     385             :         // increase messagebox
     386           0 :         aPageSize.Height() += aSize.Height() + (IMPL_DIALOG_OFFSET*2)+(IMPL_MSGBOX_OFFSET_EXTRA_Y*2);
     387             : 
     388           0 :         mpCheckBox->SetPosSizePixel( aPos, aSize );
     389           0 :         mpCheckBox->Show();
     390             :     }
     391             : 
     392           0 :     mpVCLMultiLineEdit = new VclMultiLineEdit( this, nWinStyle );
     393           0 :     mpVCLMultiLineEdit->SetText( aMessText );
     394           0 :     mpVCLMultiLineEdit->SetPosSizePixel( aTextPos, aMEditSize );
     395           0 :     mpVCLMultiLineEdit->Show();
     396           0 :     mpVCLMultiLineEdit->SetPaintTransparent(sal_True);
     397           0 :     mpVCLMultiLineEdit->EnableCursor(sal_False);
     398           0 :     SetPageSizePixel( aPageSize );
     399           0 : }
     400             : 
     401             : // -----------------------------------------------------------------------
     402             : 
     403           0 : void MessBox::StateChanged( StateChangedType nType )
     404             : {
     405           0 :     if ( nType == STATE_CHANGE_INITSHOW )
     406             :     {
     407           0 :         ImplPosControls();
     408             :     }
     409           0 :     ButtonDialog::StateChanged( nType );
     410           0 : }
     411             : 
     412             : // -----------------------------------------------------------------------
     413             : 
     414           0 : sal_Bool MessBox::GetCheckBoxState() const
     415             : {
     416           0 :     return mpCheckBox ? mpCheckBox->IsChecked() : mbCheck;
     417             : }
     418             : 
     419             : // -----------------------------------------------------------------------
     420             : 
     421           0 : void MessBox::SetCheckBoxState( sal_Bool bCheck )
     422             : {
     423           0 :     if( mpCheckBox ) mpCheckBox->Check( bCheck );
     424           0 :     mbCheck = bCheck;
     425           0 : }
     426             : 
     427             : // -----------------------------------------------------------------------
     428             : 
     429           0 : Size MessBox::GetOptimalSize() const
     430             : {
     431             :     // FIXME: base me on the font size ?
     432           0 :     return Size( 250, 100 );
     433             : }
     434             : 
     435             : // ============================================================================
     436             : 
     437           0 : void InfoBox::ImplInitInfoBoxData()
     438             : {
     439             :     // Default Text is the display title from the application
     440           0 :     if ( GetText().isEmpty() )
     441           0 :         SetText( Application::GetDisplayName() );
     442             : 
     443           0 :     SetImage( InfoBox::GetStandardImage() );
     444           0 : }
     445             : 
     446             : // -----------------------------------------------------------------------
     447             : 
     448           0 : InfoBox::InfoBox( Window* pParent, const OUString& rMessage ) :
     449           0 :     MessBox( pParent, WB_OK | WB_DEF_OK, ImplGetSVEmptyStr(), rMessage )
     450             : {
     451           0 :     ImplInitInfoBoxData();
     452           0 : }
     453             : 
     454             : // -----------------------------------------------------------------------
     455             : 
     456           0 : InfoBox::InfoBox( Window* pParent, const ResId & rResId ) :
     457           0 :     MessBox( pParent, rResId.SetRT( RSC_INFOBOX ) )
     458             : {
     459           0 :     ImplInitInfoBoxData();
     460           0 : }
     461             : 
     462             : // -----------------------------------------------------------------------
     463             : 
     464           0 : Image InfoBox::GetStandardImage()
     465             : {
     466           0 :     ImplInitMsgBoxImageList();
     467           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 4 );
     468             : }
     469             : 
     470             : // ============================================================================
     471             : 
     472           0 : void WarningBox::ImplInitWarningBoxData()
     473             : {
     474             :     // Default Text is the display title from the application
     475           0 :     if ( GetText().isEmpty() )
     476           0 :         SetText( Application::GetDisplayName() );
     477             : 
     478           0 :     SetImage( WarningBox::GetStandardImage() );
     479           0 : }
     480             : 
     481             : // -----------------------------------------------------------------------
     482             : 
     483           0 : WarningBox::WarningBox( Window* pParent, WinBits nStyle,
     484             :                         const XubString& rMessage ) :
     485           0 :     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
     486             : {
     487           0 :     ImplInitWarningBoxData();
     488           0 : }
     489             : 
     490             : // -----------------------------------------------------------------------
     491             : 
     492           0 : WarningBox::WarningBox( Window* pParent, const ResId& rResId ) :
     493           0 :     MessBox( pParent, rResId.SetRT( RSC_WARNINGBOX ) )
     494             : {
     495           0 :     ImplInitWarningBoxData();
     496           0 : }
     497             : 
     498             : // -----------------------------------------------------------------------
     499             : 
     500           0 : void WarningBox::SetDefaultCheckBoxText()
     501             : {
     502           0 :     ResMgr* pResMgr = ImplGetResMgr();
     503           0 :     if( pResMgr )
     504           0 :         maCheckBoxText = ResId(SV_STDTEXT_DONTWARNAGAIN, *pResMgr).toString();
     505           0 : }
     506             : 
     507             : // -----------------------------------------------------------------------
     508             : 
     509           0 : Image WarningBox::GetStandardImage()
     510             : {
     511           0 :     ImplInitMsgBoxImageList();
     512           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 3 );
     513             : }
     514             : 
     515             : // ============================================================================
     516             : 
     517           0 : void ErrorBox::ImplInitErrorBoxData()
     518             : {
     519             :     // Default Text is the display title from the application
     520           0 :     if ( GetText().isEmpty() )
     521           0 :         SetText( Application::GetDisplayName() );
     522             : 
     523           0 :     SetImage( ErrorBox::GetStandardImage() );
     524           0 : }
     525             : 
     526             : // -----------------------------------------------------------------------
     527             : 
     528           0 : ErrorBox::ErrorBox( Window* pParent, WinBits nStyle,
     529             :                     const XubString& rMessage ) :
     530           0 :     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
     531             : {
     532           0 :     ImplInitErrorBoxData();
     533           0 : }
     534             : 
     535             : // -----------------------------------------------------------------------
     536             : 
     537           0 : ErrorBox::ErrorBox( Window* pParent, const ResId& rResId ) :
     538           0 :     MessBox( pParent, rResId.SetRT( RSC_ERRORBOX ) )
     539             : {
     540           0 :     ImplInitErrorBoxData();
     541           0 : }
     542             : 
     543             : // -----------------------------------------------------------------------
     544             : 
     545           0 : Image ErrorBox::GetStandardImage()
     546             : {
     547             :     try
     548             :     {
     549           0 :         ImplInitMsgBoxImageList();
     550             :     }
     551           0 :     catch (const ::com::sun::star::uno::Exception &)
     552             :     {
     553             :         // During early bootstrap we can have no initialized
     554             :         // ucb and hence no ability to get this image, so nop.
     555           0 :         return Image();
     556             :     }
     557           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 1 );
     558             : }
     559             : 
     560             : // ============================================================================
     561             : 
     562           0 : void QueryBox::ImplInitQueryBoxData()
     563             : {
     564             :     // Default Text is the display title from the application
     565           0 :     if ( GetText().isEmpty() )
     566           0 :         SetText( Application::GetDisplayName() );
     567             : 
     568           0 :     SetImage( QueryBox::GetStandardImage() );
     569           0 : }
     570             : 
     571             : // -----------------------------------------------------------------------
     572             : 
     573           0 : QueryBox::QueryBox( Window* pParent, WinBits nStyle, const XubString& rMessage ) :
     574           0 :     MessBox( pParent, nStyle, ImplGetSVEmptyStr(), rMessage )
     575             : {
     576           0 :     ImplInitQueryBoxData();
     577           0 : }
     578             : 
     579             : // -----------------------------------------------------------------------
     580             : 
     581           0 : QueryBox::QueryBox( Window* pParent, const ResId& rResId ) :
     582           0 :     MessBox( pParent, rResId.SetRT( RSC_QUERYBOX ) )
     583             : {
     584           0 :     ImplInitQueryBoxData();
     585           0 : }
     586             : 
     587             : // -----------------------------------------------------------------------
     588             : 
     589           0 : void QueryBox::SetDefaultCheckBoxText()
     590             : {
     591           0 :     ResMgr* pResMgr = ImplGetResMgr();
     592           0 :     if( pResMgr )
     593           0 :         maCheckBoxText = ResId(SV_STDTEXT_DONTASKAGAIN, *pResMgr).toString();
     594           0 : }
     595             : 
     596             : // -----------------------------------------------------------------------
     597             : 
     598           0 : Image QueryBox::GetStandardImage()
     599             : {
     600           0 :     ImplInitMsgBoxImageList();
     601           0 :     return ImplGetSVData()->maWinData.mpMsgBoxImgList->GetImage( 2 );
     602         465 : }
     603             : 
     604             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10