Update ooo320-m1
[ooovba.git] / sw / source / ui / dbui / mmoutputtypepage.cxx
blob276749ae73698ee77863e4ff2025d32f74584f93
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: mmoutputtypepage.cxx,v $
10 * $Revision: 1.10 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
36 #endif
39 #include <mmoutputtypepage.hxx>
40 #include <mailmergewizard.hxx>
41 #include <mmconfigitem.hxx>
42 #include <vcl/msgbox.hxx>
43 #ifndef _DBUI_HRC
44 #include <dbui.hrc>
45 #endif
46 #include <swtypes.hxx>
47 #include <mmoutputtypepage.hrc>
48 #include <dbui.hrc>
50 /*-- 02.04.2004 11:06:55---------------------------------------------------
52 -----------------------------------------------------------------------*/
53 SwMailMergeOutputTypePage::SwMailMergeOutputTypePage( SwMailMergeWizard* _pParent) :
54 svt::OWizardPage( _pParent, SW_RES(DLG_MM_OUTPUTTYPE_PAGE)),
55 #ifdef MSC
56 #pragma warning (disable : 4355)
57 #endif
58 m_aHeaderFI( this, SW_RES( FI_HEADER )),
59 m_aTypeFT( this, SW_RES( FT_TYPE )),
60 m_aLetterRB( this, SW_RES( RB_LETTER )),
61 m_aMailRB( this, SW_RES( RB_MAIL )),
62 m_aHintHeaderFI(this, SW_RES( FI_HINTHEADER)),
63 m_aHintFI( this, SW_RES( FI_HINT)),
64 m_aNoMailHintFI(this, SW_RES( FT_NOMAILHINT)),
65 #ifdef MSC
66 #pragma warning (default : 4355)
67 #endif
68 m_sLetterHintHeader( SW_RES( ST_LETTERHINTHEADER)),
69 m_sMailHintHeader( SW_RES( ST_MAILHINTHEADER)),
70 m_sLetterHint( SW_RES( ST_LETTERHINT)),
71 m_sMailHint( SW_RES( ST_MAILHINT)),
72 m_pWizard(_pParent)
74 FreeResource();
75 Link aLink = LINK(this, SwMailMergeOutputTypePage, TypeHdl_Impl);
76 m_aLetterRB.SetClickHdl(aLink);
77 m_aMailRB.SetClickHdl(aLink);
79 SwMailMergeConfigItem& rConfigItem = m_pWizard->GetConfigItem();
80 m_pWizard->EnterWait();
81 bool bMailAvailable = rConfigItem.IsMailAvailable();
82 m_pWizard->LeaveWait();
83 if(rConfigItem.IsOutputToLetter())
84 m_aLetterRB.Check();
85 else
86 m_aMailRB.Check();
87 if(!bMailAvailable)
89 m_aNoMailHintFI.Show();
90 m_aMailRB.Enable(sal_False);
91 m_aLetterRB.Check();
93 TypeHdl_Impl(&m_aLetterRB);
96 /*-- 02.04.2004 11:06:55---------------------------------------------------
98 -----------------------------------------------------------------------*/
99 SwMailMergeOutputTypePage::~SwMailMergeOutputTypePage()
102 /*-- 14.04.2004 14:44:07---------------------------------------------------
104 -----------------------------------------------------------------------*/
105 IMPL_LINK( SwMailMergeOutputTypePage, TypeHdl_Impl, RadioButton*, EMPTYARG )
107 bool bLetter = m_aLetterRB.IsChecked();
108 m_aHintHeaderFI.SetText(bLetter ? m_sLetterHintHeader : m_sMailHintHeader);
109 m_aHintFI.SetText(bLetter ? m_sLetterHint : m_sMailHint);
110 m_pWizard->GetConfigItem().SetOutputToLetter(bLetter);
111 m_pWizard->updateRoadmapItemLabel( MM_ADDRESSBLOCKPAGE );
112 m_pWizard->UpdateRoadmap();
113 return 0;