Update ooo320-m1
[ooovba.git] / sw / source / ui / dbui / mmmergepage.cxx
blobe57d4028ac4cc2b0d4ec3a6da4450fa8601a5fb5
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: mmmergepage.cxx,v $
10 * $Revision: 1.12 $
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"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
35 #endif
36 #include <mmmergepage.hxx>
37 #include <mailmergewizard.hxx>
38 #include <mmconfigitem.hxx>
39 #include <swtypes.hxx>
40 #ifndef _VIEW_HXX
41 #include <view.hxx>
42 #endif
43 #include <dbui.hrc>
44 #include <mmmergepage.hrc>
45 #include <svx/srchitem.hxx>
46 #include <sfx2/dispatch.hxx>
47 #include <svtools/eitem.hxx>
48 #include <swabstdlg.hxx>
50 /*-- 02.04.2004 16:38:45---------------------------------------------------
52 -----------------------------------------------------------------------*/
53 SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
54 svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
55 #ifdef MSC
56 #pragma warning (disable : 4355)
57 #endif
58 m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
59 m_aEditFI(this, SW_RES( FI_EDIT )),
60 m_aEditPB(this, SW_RES( PB_EDIT )),
61 m_aFindFL(this, SW_RES( FL_FIND )),
62 m_aFineFT(this, SW_RES( FT_FIND )),
63 m_aFindED(this, SW_RES( ED_FIND )),
64 m_aFindPB(this, SW_RES( PB_FIND )),
65 m_aWholeWordsCB(this, SW_RES( CB_WHOLEWORDS)),
66 m_aBackwardsCB(this, SW_RES( CB_BACKWARDS )),
67 m_aMatchCaseCB(this, SW_RES( CB_MATCHCASE )),
68 #ifdef MSC
69 #pragma warning (default : 4355)
70 #endif
71 m_pWizard(_pParent)
73 FreeResource();
74 String sTemp(m_aEditFI.GetText());
75 sTemp.SearchAndReplace(String::CreateFromAscii("%1"), m_aEditPB.GetText());
76 m_aEditFI.SetText(sTemp);
77 m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
78 m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
80 m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
83 /*-- 02.04.2004 16:38:45---------------------------------------------------
85 -----------------------------------------------------------------------*/
86 SwMailMergeMergePage::~SwMailMergeMergePage()
89 /*-- 25.05.2004 16:14:49---------------------------------------------------
91 -----------------------------------------------------------------------*/
92 IMPL_LINK( SwMailMergeMergePage, EditDocumentHdl_Impl, PushButton*, EMPTYARG)
94 m_pWizard->SetRestartPage(MM_MERGEPAGE);
95 m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
96 return 0;
98 /*-- 25.05.2004 16:14:49---------------------------------------------------
100 -----------------------------------------------------------------------*/
101 IMPL_LINK( SwMailMergeMergePage, FindHdl_Impl, PushButton*, EMPTYARG)
103 SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
105 SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
106 aSearchItem.SetSearchString(m_aFindED.GetText());
108 aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
109 aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
110 aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
112 SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
113 DBG_ASSERT(pTargetView, "no target view exists");
114 if(pTargetView)
116 pTargetView->GetViewFrame()->GetDispatcher()->Execute(
117 FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
120 return 0;
122 IMPL_LINK( SwMailMergeMergePage, EnteredFindStringHdl_Impl, void*, EMPTYARG )
124 m_aFindPB.GetClickHdl().Call( &m_aFindPB );
125 return 0;