xref: /aoo4110/main/sw/source/ui/dbui/mmmergepage.cxx (revision b1cdbd2c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sw.hxx"
26 #ifdef SW_DLLIMPLEMENTATION
27 #undef SW_DLLIMPLEMENTATION
28 #endif
29 #include <mmmergepage.hxx>
30 #include <mailmergewizard.hxx>
31 #include <mmconfigitem.hxx>
32 #include <swtypes.hxx>
33 #ifndef _VIEW_HXX
34 #include <view.hxx>
35 #endif
36 #include <dbui.hrc>
37 #include <mmmergepage.hrc>
38 #include <svl/srchitem.hxx>
39 #include <sfx2/dispatch.hxx>
40 #include <svl/eitem.hxx>
41 #include <swabstdlg.hxx>
42 
43 /*-- 02.04.2004 16:38:45---------------------------------------------------
44 
45   -----------------------------------------------------------------------*/
SwMailMergeMergePage(SwMailMergeWizard * _pParent)46 SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
47     svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
48 #ifdef MSC
49 #pragma warning (disable : 4355)
50 #endif
51     m_aHeaderFI(this,           SW_RES(  FI_HEADER           ) ),
52     m_aEditFI(this, SW_RES(           FI_EDIT )),
53     m_aEditPB(this, SW_RES(           PB_EDIT )),
54     m_aFindFL(this, SW_RES(           FL_FIND )),
55     m_aFineFT(this, SW_RES(           FT_FIND )),
56     m_aFindED(this, SW_RES(           ED_FIND )),
57     m_aFindPB(this, SW_RES(           PB_FIND )),
58     m_aWholeWordsCB(this, SW_RES(     CB_WHOLEWORDS)),
59     m_aBackwardsCB(this, SW_RES(      CB_BACKWARDS )),
60     m_aMatchCaseCB(this, SW_RES(      CB_MATCHCASE )),
61 #ifdef MSC
62 #pragma warning (default : 4355)
63 #endif
64     m_pWizard(_pParent)
65 {
66     FreeResource();
67     String sTemp(m_aEditFI.GetText());
68     sTemp.SearchAndReplace(String::CreateFromAscii("%1"), m_aEditPB.GetText());
69     m_aEditFI.SetText(sTemp);
70     m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
71     m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
72 
73     m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
74 
75 }
76 /*-- 02.04.2004 16:38:45---------------------------------------------------
77 
78   -----------------------------------------------------------------------*/
~SwMailMergeMergePage()79 SwMailMergeMergePage::~SwMailMergeMergePage()
80 {
81 }
82 /*-- 25.05.2004 16:14:49---------------------------------------------------
83 
84   -----------------------------------------------------------------------*/
IMPL_LINK(SwMailMergeMergePage,EditDocumentHdl_Impl,PushButton *,EMPTYARG)85 IMPL_LINK( SwMailMergeMergePage, EditDocumentHdl_Impl, PushButton*, EMPTYARG)
86 {
87     m_pWizard->SetRestartPage(MM_MERGEPAGE);
88     m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
89     return 0;
90 }
91 /*-- 25.05.2004 16:14:49---------------------------------------------------
92 
93   -----------------------------------------------------------------------*/
IMPL_LINK(SwMailMergeMergePage,FindHdl_Impl,PushButton *,EMPTYARG)94 IMPL_LINK( SwMailMergeMergePage, FindHdl_Impl, PushButton*, EMPTYARG)
95 {
96     SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
97 
98     SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
99     aSearchItem.SetSearchString(m_aFindED.GetText());
100 
101     aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
102     aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
103     aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
104 
105     SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
106     DBG_ASSERT(pTargetView, "no target view exists");
107     if(pTargetView)
108     {
109         pTargetView->GetViewFrame()->GetDispatcher()->Execute(
110             FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
111     }
112 
113     return 0;
114 }
IMPL_LINK(SwMailMergeMergePage,EnteredFindStringHdl_Impl,void *,EMPTYARG)115 IMPL_LINK( SwMailMergeMergePage, EnteredFindStringHdl_Impl, void*, EMPTYARG )
116 {
117     m_aFindPB.GetClickHdl().Call( &m_aFindPB );
118     return 0;
119 }
120