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 <svl/srchitem.hxx>
27 : #include <sfx2/dispatch.hxx>
28 : #include <svl/eitem.hxx>
29 : #include <swabstdlg.hxx>
30 :
31 0 : SwMailMergeMergePage::SwMailMergeMergePage(SwMailMergeWizard* _pParent)
32 : : svt::OWizardPage(_pParent, "MMMergePage",
33 : "modules/swriter/ui/mmmergepage.ui")
34 0 : , m_pWizard(_pParent)
35 : {
36 0 : get(m_pEditFI, "helplabel");
37 0 : get(m_pEditPB, "edit");
38 0 : get(m_pFindPB, "find");
39 0 : get(m_pWholeWordsCB, "wholewords");
40 0 : get(m_pBackwardsCB, "backwards");
41 0 : get(m_pMatchCaseCB, "matchcase");
42 0 : get(m_pFindED, "entry");
43 0 : OUString sTemp(m_pEditFI->GetText());
44 0 : sTemp = sTemp.replaceFirst("%1", m_pEditPB->GetText());
45 0 : m_pEditFI->SetText(sTemp);
46 0 : m_pEditPB->SetClickHdl( LINK( this, SwMailMergeMergePage, EditDocumentHdl_Impl));
47 0 : m_pFindPB->SetClickHdl( LINK( this, SwMailMergeMergePage, FindHdl_Impl ));
48 :
49 0 : m_pFindED->SetReturnActionLink( LINK(this, SwMailMergeMergePage, EnteredFindStringHdl_Impl ));
50 :
51 0 : }
52 :
53 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl)
54 : {
55 0 : m_pWizard->SetRestartPage(MM_MERGEPAGE);
56 0 : m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
57 0 : return 0;
58 : }
59 :
60 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, FindHdl_Impl)
61 : {
62 0 : SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
63 :
64 0 : SfxBoolItem aQuiet( SID_SEARCH_QUIET, false );
65 0 : aSearchItem.SetSearchString(m_pFindED->GetText());
66 :
67 0 : aSearchItem.SetWordOnly(m_pWholeWordsCB->IsChecked());
68 0 : aSearchItem.SetExact(m_pMatchCaseCB->IsChecked());
69 0 : aSearchItem.SetBackward(m_pBackwardsCB->IsChecked());
70 :
71 0 : SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
72 : OSL_ENSURE(pTargetView, "no target view exists");
73 0 : if(pTargetView)
74 : {
75 : pTargetView->GetViewFrame()->GetDispatcher()->Execute(
76 0 : FID_SEARCH_NOW, SFX_CALLMODE_SYNCHRON, &aSearchItem, &aQuiet, 0L );
77 : }
78 :
79 0 : return 0;
80 : }
81 :
82 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EnteredFindStringHdl_Impl)
83 : {
84 0 : m_pFindPB->GetClickHdl().Call(m_pFindPB);
85 0 : return 0;
86 0 : }
87 :
88 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|