xref: /AOO41X/main/sw/source/ui/dbui/mmmergepage.cxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_sw.hxx"
30*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION
31*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION
32*cdf0e10cSrcweir #endif
33*cdf0e10cSrcweir #include <mmmergepage.hxx>
34*cdf0e10cSrcweir #include <mailmergewizard.hxx>
35*cdf0e10cSrcweir #include <mmconfigitem.hxx>
36*cdf0e10cSrcweir #include <swtypes.hxx>
37*cdf0e10cSrcweir #ifndef _VIEW_HXX
38*cdf0e10cSrcweir #include <view.hxx>
39*cdf0e10cSrcweir #endif
40*cdf0e10cSrcweir #include <dbui.hrc>
41*cdf0e10cSrcweir #include <mmmergepage.hrc>
42*cdf0e10cSrcweir #include <svl/srchitem.hxx>
43*cdf0e10cSrcweir #include <sfx2/dispatch.hxx>
44*cdf0e10cSrcweir #include <svl/eitem.hxx>
45*cdf0e10cSrcweir #include <swabstdlg.hxx>
46*cdf0e10cSrcweir 
47*cdf0e10cSrcweir /*-- 02.04.2004 16:38:45---------------------------------------------------
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
50*cdf0e10cSrcweir SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
51*cdf0e10cSrcweir     svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
52*cdf0e10cSrcweir #ifdef MSC
53*cdf0e10cSrcweir #pragma warning (disable : 4355)
54*cdf0e10cSrcweir #endif
55*cdf0e10cSrcweir     m_aHeaderFI(this,           SW_RES(  FI_HEADER           ) ),
56*cdf0e10cSrcweir     m_aEditFI(this, SW_RES(           FI_EDIT )),
57*cdf0e10cSrcweir     m_aEditPB(this, SW_RES(           PB_EDIT )),
58*cdf0e10cSrcweir     m_aFindFL(this, SW_RES(           FL_FIND )),
59*cdf0e10cSrcweir     m_aFineFT(this, SW_RES(           FT_FIND )),
60*cdf0e10cSrcweir     m_aFindED(this, SW_RES(           ED_FIND )),
61*cdf0e10cSrcweir     m_aFindPB(this, SW_RES(           PB_FIND )),
62*cdf0e10cSrcweir     m_aWholeWordsCB(this, SW_RES(     CB_WHOLEWORDS)),
63*cdf0e10cSrcweir     m_aBackwardsCB(this, SW_RES(      CB_BACKWARDS )),
64*cdf0e10cSrcweir     m_aMatchCaseCB(this, SW_RES(      CB_MATCHCASE )),
65*cdf0e10cSrcweir #ifdef MSC
66*cdf0e10cSrcweir #pragma warning (default : 4355)
67*cdf0e10cSrcweir #endif
68*cdf0e10cSrcweir     m_pWizard(_pParent)
69*cdf0e10cSrcweir {
70*cdf0e10cSrcweir     FreeResource();
71*cdf0e10cSrcweir     String sTemp(m_aEditFI.GetText());
72*cdf0e10cSrcweir     sTemp.SearchAndReplace(String::CreateFromAscii("%1"), m_aEditPB.GetText());
73*cdf0e10cSrcweir     m_aEditFI.SetText(sTemp);
74*cdf0e10cSrcweir     m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
75*cdf0e10cSrcweir     m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir     m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir }
80*cdf0e10cSrcweir /*-- 02.04.2004 16:38:45---------------------------------------------------
81*cdf0e10cSrcweir 
82*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
83*cdf0e10cSrcweir SwMailMergeMergePage::~SwMailMergeMergePage()
84*cdf0e10cSrcweir {
85*cdf0e10cSrcweir }
86*cdf0e10cSrcweir /*-- 25.05.2004 16:14:49---------------------------------------------------
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
89*cdf0e10cSrcweir IMPL_LINK( SwMailMergeMergePage, EditDocumentHdl_Impl, PushButton*, EMPTYARG)
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir     m_pWizard->SetRestartPage(MM_MERGEPAGE);
92*cdf0e10cSrcweir     m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
93*cdf0e10cSrcweir     return 0;
94*cdf0e10cSrcweir }
95*cdf0e10cSrcweir /*-- 25.05.2004 16:14:49---------------------------------------------------
96*cdf0e10cSrcweir 
97*cdf0e10cSrcweir   -----------------------------------------------------------------------*/
98*cdf0e10cSrcweir IMPL_LINK( SwMailMergeMergePage, FindHdl_Impl, PushButton*, EMPTYARG)
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir     SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
103*cdf0e10cSrcweir     aSearchItem.SetSearchString(m_aFindED.GetText());
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir     aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
106*cdf0e10cSrcweir     aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
107*cdf0e10cSrcweir     aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
110*cdf0e10cSrcweir     DBG_ASSERT(pTargetView, "no target view exists");
111*cdf0e10cSrcweir     if(pTargetView)
112*cdf0e10cSrcweir     {
113*cdf0e10cSrcweir         pTargetView->GetViewFrame()->GetDispatcher()->Execute(
114*cdf0e10cSrcweir             FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
115*cdf0e10cSrcweir     }
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir     return 0;
118*cdf0e10cSrcweir }
119*cdf0e10cSrcweir IMPL_LINK( SwMailMergeMergePage, EnteredFindStringHdl_Impl, void*, EMPTYARG )
120*cdf0e10cSrcweir {
121*cdf0e10cSrcweir     m_aFindPB.GetClickHdl().Call( &m_aFindPB );
122*cdf0e10cSrcweir     return 0;
123*cdf0e10cSrcweir }
124