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