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