1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 33*cdf0e10cSrcweir #endif 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include "hintids.hxx" 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR 39*cdf0e10cSrcweir #include <svl/svstdarr.hxx> 40*cdf0e10cSrcweir #include <svx/htmlmode.hxx> 41*cdf0e10cSrcweir #ifndef _SVX_SVXIDS_HRC //autogen 42*cdf0e10cSrcweir #include <svx/svxids.hrc> 43*cdf0e10cSrcweir #endif 44*cdf0e10cSrcweir #include <sfx2/app.hxx> 45*cdf0e10cSrcweir #include <vcl/msgbox.hxx> 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir #include "swtypes.hxx" 48*cdf0e10cSrcweir #include "wrtsh.hxx" 49*cdf0e10cSrcweir #include "viewopt.hxx" 50*cdf0e10cSrcweir #include "macassgn.hxx" 51*cdf0e10cSrcweir #include "swevent.hxx" 52*cdf0e10cSrcweir #include "docsh.hxx" 53*cdf0e10cSrcweir #include "globals.hrc" 54*cdf0e10cSrcweir #include "view.hxx" 55*cdf0e10cSrcweir #include <sfx2/viewfrm.hxx> 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir #include <svx/svxdlg.hxx> 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #include <doc.hxx> 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir using ::com::sun::star::uno::Reference; 62*cdf0e10cSrcweir using ::com::sun::star::frame::XFrame; 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) 65*cdf0e10cSrcweir { 66*cdf0e10cSrcweir // const SfxItemSet& rSet = rPg.GetItemSet(); 67*cdf0e10cSrcweir SfxEventNamesItem aItem(SID_EVENTCONFIG); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir sal_Bool bHtmlMode = sal_False; 70*cdf0e10cSrcweir sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); 71*cdf0e10cSrcweir bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir switch( eType ) 74*cdf0e10cSrcweir { 75*cdf0e10cSrcweir case MACASSGN_TEXTBAUST: // Textbausteine 76*cdf0e10cSrcweir // rPg.SetGetRangeLink( &_GetRangeHdl ); 77*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), String(), 78*cdf0e10cSrcweir SW_EVENT_START_INS_GLOSSARY ); 79*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), String(), 80*cdf0e10cSrcweir SW_EVENT_END_INS_GLOSSARY); 81*cdf0e10cSrcweir // damit der neue Handler aktiv wird! 82*cdf0e10cSrcweir // rPg.Reset( rSet ); 83*cdf0e10cSrcweir break; 84*cdf0e10cSrcweir case MACASSGN_ALLFRM: 85*cdf0e10cSrcweir case MACASSGN_GRAPHIC: // Grafiken 86*cdf0e10cSrcweir { 87*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), String(), 88*cdf0e10cSrcweir SVX_EVENT_IMAGE_ERROR); 89*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), String(), 90*cdf0e10cSrcweir SVX_EVENT_IMAGE_ABORT); 91*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), String(), 92*cdf0e10cSrcweir SVX_EVENT_IMAGE_LOAD); 93*cdf0e10cSrcweir } 94*cdf0e10cSrcweir // kein break; 95*cdf0e10cSrcweir case MACASSGN_FRMURL: // Frm - URL-Attribute 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir if( !bHtmlMode && 98*cdf0e10cSrcweir (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType)) 99*cdf0e10cSrcweir { 100*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), String(), 101*cdf0e10cSrcweir SW_EVENT_FRM_KEYINPUT_ALPHA ); 102*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), String(), 103*cdf0e10cSrcweir SW_EVENT_FRM_KEYINPUT_NOALPHA ); 104*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), String(), 105*cdf0e10cSrcweir SW_EVENT_FRM_RESIZE ); 106*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), String(), 107*cdf0e10cSrcweir SW_EVENT_FRM_MOVE ); 108*cdf0e10cSrcweir } 109*cdf0e10cSrcweir } 110*cdf0e10cSrcweir // kein break; 111*cdf0e10cSrcweir case MACASSGN_OLE: // OLE 112*cdf0e10cSrcweir { 113*cdf0e10cSrcweir if( !bHtmlMode ) 114*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), String(), 115*cdf0e10cSrcweir SW_EVENT_OBJECT_SELECT ); 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir // kein break; 118*cdf0e10cSrcweir case MACASSGN_INETFMT: // INetFmt-Attribute 119*cdf0e10cSrcweir { 120*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), String(), 121*cdf0e10cSrcweir SFX_EVENT_MOUSEOVER_OBJECT ); 122*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), String(), 123*cdf0e10cSrcweir SFX_EVENT_MOUSECLICK_OBJECT); 124*cdf0e10cSrcweir aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), String(), 125*cdf0e10cSrcweir SFX_EVENT_MOUSEOUT_OBJECT); 126*cdf0e10cSrcweir } 127*cdf0e10cSrcweir break; 128*cdf0e10cSrcweir } 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir return aItem; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir sal_Bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, 135*cdf0e10cSrcweir SvxMacroItem*& rpINetItem ) 136*cdf0e10cSrcweir { 137*cdf0e10cSrcweir sal_Bool bRet = sal_False; 138*cdf0e10cSrcweir SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); 139*cdf0e10cSrcweir SvxMacroItem aItem( RES_FRMMACRO ); 140*cdf0e10cSrcweir if( !rpINetItem ) 141*cdf0e10cSrcweir rpINetItem = new SvxMacroItem( RES_FRMMACRO ); 142*cdf0e10cSrcweir else 143*cdf0e10cSrcweir aItem.SetMacroTable( rpINetItem->GetMacroTable() ); 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir aSet.Put( aItem ); 146*cdf0e10cSrcweir aSet.Put( AddEvents( MACASSGN_INETFMT ) ); 147*cdf0e10cSrcweir 148*cdf0e10cSrcweir SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 149*cdf0e10cSrcweir SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, 150*cdf0e10cSrcweir rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), 151*cdf0e10cSrcweir SID_EVENTCONFIG ); 152*cdf0e10cSrcweir if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); 155*cdf0e10cSrcweir const SfxPoolItem* pItem; 156*cdf0e10cSrcweir if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, sal_False, &pItem )) 157*cdf0e10cSrcweir { 158*cdf0e10cSrcweir rpINetItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() ); 159*cdf0e10cSrcweir bRet = sal_True; 160*cdf0e10cSrcweir } 161*cdf0e10cSrcweir } 162*cdf0e10cSrcweir return bRet; 163*cdf0e10cSrcweir } 164