Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #include <mmmergepage.hxx>
21 : #include <mailmergewizard.hxx>
22 : #include <mmconfigitem.hxx>
23 : #include <swtypes.hxx>
24 : #include <view.hxx>
25 : #include <dbui.hrc>
26 : #include <mmmergepage.hrc>
27 : #include <svl/srchitem.hxx>
28 : #include <sfx2/dispatch.hxx>
29 : #include <svl/eitem.hxx>
30 : #include <swabstdlg.hxx>
31 :
32 0 : SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
33 : svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
34 : #ifdef MSC
35 : #pragma warning (disable : 4355)
36 : #endif
37 : m_aHeaderFI(this, SW_RES( FI_HEADER ) ),
38 : m_aEditFI(this, SW_RES( FI_EDIT )),
39 : m_aEditPB(this, SW_RES( PB_EDIT )),
40 : m_aFindFL(this, SW_RES( FL_FIND )),
41 : m_aFineFT(this, SW_RES( FT_FIND )),
42 : m_aFindED(this, SW_RES( ED_FIND )),
43 : m_aFindPB(this, SW_RES( PB_FIND )),
44 : m_aWholeWordsCB(this, SW_RES( CB_WHOLEWORDS)),
45 : m_aBackwardsCB(this, SW_RES( CB_BACKWARDS )),
46 : m_aMatchCaseCB(this, SW_RES( CB_MATCHCASE )),
47 : #ifdef MSC
48 : #pragma warning (default : 4355)
49 : #endif
50 0 : m_pWizard(_pParent)
51 : {
52 0 : FreeResource();
53 0 : String sTemp(m_aEditFI.GetText());
54 0 : sTemp.SearchAndReplace(rtl::OUString("%1"), m_aEditPB.GetText());
55 0 : m_aEditFI.SetText(sTemp);
56 0 : m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
57 0 : m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
58 :
59 0 : m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
60 :
61 0 : }
62 :
63 0 : SwMailMergeMergePage::~SwMailMergeMergePage()
64 : {
65 0 : }
66 :
67 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl)
68 : {
69 0 : m_pWizard->SetRestartPage(MM_MERGEPAGE);
70 0 : m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
71 0 : return 0;
72 : }
73 :
74 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, FindHdl_Impl)
75 : {
76 0 : SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
77 :
78 0 : SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
79 0 : aSearchItem.SetSearchString(m_aFindED.GetText());
80 :
81 0 : aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
82 0 : aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
83 0 : aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
84 :
85 0 : SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
86 : OSL_ENSURE(pTargetView, "no target view exists");
87 0 : if(pTargetView)
88 : {
89 : pTargetView->GetViewFrame()->GetDispatcher()->Execute(
90 0 : FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
91 : }
92 :
93 0 : return 0;
94 : }
95 :
96 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EnteredFindStringHdl_Impl)
97 : {
98 0 : m_aFindPB.GetClickHdl().Call( &m_aFindPB );
99 0 : return 0;
100 0 : }
101 :
102 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|