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 : SwMailMergeMergePage::~SwMailMergeMergePage()
54 : {
55 0 : disposeOnce();
56 0 : }
57 :
58 0 : void SwMailMergeMergePage::dispose()
59 : {
60 0 : m_pEditFI.clear();
61 0 : m_pEditPB.clear();
62 0 : m_pFindED.clear();
63 0 : m_pFindPB.clear();
64 0 : m_pWholeWordsCB.clear();
65 0 : m_pBackwardsCB.clear();
66 0 : m_pMatchCaseCB.clear();
67 0 : m_pWizard.clear();
68 0 : svt::OWizardPage::dispose();
69 0 : }
70 :
71 :
72 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EditDocumentHdl_Impl)
73 : {
74 0 : m_pWizard->SetRestartPage(MM_MERGEPAGE);
75 0 : m_pWizard->EndDialog(RET_EDIT_RESULT_DOC);
76 0 : return 0;
77 : }
78 :
79 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, FindHdl_Impl)
80 : {
81 0 : SvxSearchItem aSearchItem( SID_SEARCH_ITEM );
82 :
83 0 : SfxBoolItem aQuiet( SID_SEARCH_QUIET, false );
84 0 : aSearchItem.SetSearchString(m_pFindED->GetText());
85 :
86 0 : aSearchItem.SetWordOnly(m_pWholeWordsCB->IsChecked());
87 0 : aSearchItem.SetExact(m_pMatchCaseCB->IsChecked());
88 0 : aSearchItem.SetBackward(m_pBackwardsCB->IsChecked());
89 :
90 0 : SwView* pTargetView = m_pWizard->GetConfigItem().GetTargetView();
91 : OSL_ENSURE(pTargetView, "no target view exists");
92 0 : if(pTargetView)
93 : {
94 : pTargetView->GetViewFrame()->GetDispatcher()->Execute(
95 0 : FID_SEARCH_NOW, SfxCallMode::SYNCHRON, &aSearchItem, &aQuiet, 0L );
96 : }
97 :
98 0 : return 0;
99 : }
100 :
101 0 : IMPL_LINK_NOARG(SwMailMergeMergePage, EnteredFindStringHdl_Impl)
102 : {
103 0 : m_pFindPB->GetClickHdl().Call(m_pFindPB);
104 0 : return 0;
105 0 : }
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|