update credits
[LibreOffice.git] / sw / source / ui / dbui / mmmergepage.cxx
blob8864d327015d0ef3bf4dbb8274e28b814362fba0
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
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>
32 SwMailMergeMergePage::SwMailMergeMergePage( SwMailMergeWizard* _pParent) :
33 svt::OWizardPage(_pParent, SW_RES(DLG_MM_MERGE_PAGE)),
34 #ifdef _MSC_VER
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_VER
48 #pragma warning (default : 4355)
49 #endif
50 m_pWizard(_pParent)
52 FreeResource();
53 String sTemp(m_aEditFI.GetText());
54 sTemp.SearchAndReplace(OUString("%1"), m_aEditPB.GetText());
55 m_aEditFI.SetText(sTemp);
56 m_aEditPB.SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
57 m_aFindPB.SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
59 m_aFindED.SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
63 SwMailMergeMergePage::~SwMailMergeMergePage()
67 IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl)
69 m_pWizard->SetRestartPage(MM_MERGEPAGE);
70 m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
71 return 0;
74 IMPL_LINK_NOARG(SwMailMergeMergePage, FindHdl_Impl)
76 SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
78 SfxBoolItem aQuiet( SID_SEARCH_QUIET, sal_False );
79 aSearchItem.SetSearchString(m_aFindED.GetText());
81 aSearchItem.SetWordOnly(m_aWholeWordsCB.IsChecked());
82 aSearchItem.SetExact(m_aMatchCaseCB.IsChecked());
83 aSearchItem.SetBackward(m_aBackwardsCB.IsChecked());
85 SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
86 OSL_ENSURE(pTargetView, "no target view exists");
87 if(pTargetView)
89 pTargetView->GetViewFrame()->GetDispatcher()->Execute(
90 FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
93 return 0;
96 IMPL_LINK_NOARG(SwMailMergeMergePage, EnteredFindStringHdl_Impl)
98 m_aFindPB.GetClickHdl().Call( &m_aFindPB );
99 return 0;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */