1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 // MARKER(update_precomp.py): autogen include statement, do not remove 25 #include "precompiled_sw.hxx" 26 27 #ifdef SW_DLLIMPLEMENTATION 28 #undef SW_DLLIMPLEMENTATION 29 #endif 30 31 32 #include "hintids.hxx" 33 34 #define _SVSTDARR_STRINGSDTOR 35 #include <svl/svstdarr.hxx> 36 #include <svx/htmlmode.hxx> 37 #ifndef _SVX_SVXIDS_HRC //autogen 38 #include <svx/svxids.hrc> 39 #endif 40 #include <sfx2/app.hxx> 41 #include <vcl/msgbox.hxx> 42 43 #include "swtypes.hxx" 44 #include "wrtsh.hxx" 45 #include "viewopt.hxx" 46 #include "macassgn.hxx" 47 #include "swevent.hxx" 48 #include "docsh.hxx" 49 #include "globals.hrc" 50 #include "view.hxx" 51 #include <sfx2/viewfrm.hxx> 52 53 #include <svx/svxdlg.hxx> 54 55 #include <doc.hxx> 56 57 using ::com::sun::star::uno::Reference; 58 using ::com::sun::star::frame::XFrame; 59 60 SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType ) 61 { 62 // const SfxItemSet& rSet = rPg.GetItemSet(); 63 SfxEventNamesItem aItem(SID_EVENTCONFIG); 64 65 sal_Bool bHtmlMode = sal_False; 66 sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); 67 bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; 68 69 switch( eType ) 70 { 71 case MACASSGN_TEXTBAUST: // Textbausteine 72 // rPg.SetGetRangeLink( &_GetRangeHdl ); 73 aItem.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY) ), String(), 74 SW_EVENT_START_INS_GLOSSARY ); 75 aItem.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY) ), String(), 76 SW_EVENT_END_INS_GLOSSARY); 77 // damit der neue Handler aktiv wird! 78 // rPg.Reset( rSet ); 79 break; 80 case MACASSGN_ALLFRM: 81 case MACASSGN_GRAPHIC: // Grafiken 82 { 83 aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR) ), String(), 84 SVX_EVENT_IMAGE_ERROR); 85 aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT) ), String(), 86 SVX_EVENT_IMAGE_ABORT); 87 aItem.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD) ), String(), 88 SVX_EVENT_IMAGE_LOAD); 89 } 90 // kein break; 91 case MACASSGN_FRMURL: // Frm - URL-Attribute 92 { 93 if( !bHtmlMode && 94 (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType)) 95 { 96 aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A ) ), String(), 97 SW_EVENT_FRM_KEYINPUT_ALPHA ); 98 aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA ) ), String(), 99 SW_EVENT_FRM_KEYINPUT_NOALPHA ); 100 aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE ) ), String(), 101 SW_EVENT_FRM_RESIZE ); 102 aItem.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE ) ), String(), 103 SW_EVENT_FRM_MOVE ); 104 } 105 } 106 // kein break; 107 case MACASSGN_OLE: // OLE 108 { 109 if( !bHtmlMode ) 110 aItem.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT) ), String(), 111 SW_EVENT_OBJECT_SELECT ); 112 } 113 // kein break; 114 case MACASSGN_INETFMT: // INetFmt-Attribute 115 { 116 aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT) ), String(), 117 SFX_EVENT_MOUSEOVER_OBJECT ); 118 aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT) ), String(), 119 SFX_EVENT_MOUSECLICK_OBJECT); 120 aItem.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT) ), String(), 121 SFX_EVENT_MOUSEOUT_OBJECT); 122 } 123 break; 124 } 125 126 return aItem; 127 } 128 129 130 sal_Bool SwMacroAssignDlg::INetFmtDlg( Window* pParent, SwWrtShell& rSh, 131 SvxMacroItem*& rpINetItem ) 132 { 133 sal_Bool bRet = sal_False; 134 SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMMACRO, RES_FRMMACRO, SID_EVENTCONFIG, SID_EVENTCONFIG, 0 ); 135 SvxMacroItem aItem( RES_FRMMACRO ); 136 if( !rpINetItem ) 137 rpINetItem = new SvxMacroItem( RES_FRMMACRO ); 138 else 139 aItem.SetMacroTable( rpINetItem->GetMacroTable() ); 140 141 aSet.Put( aItem ); 142 aSet.Put( AddEvents( MACASSGN_INETFMT ) ); 143 144 SvxAbstractDialogFactory* pFact = SvxAbstractDialogFactory::Create(); 145 SfxAbstractDialog* pMacroDlg = pFact->CreateSfxDialog( pParent, aSet, 146 rSh.GetView().GetViewFrame()->GetFrame().GetFrameInterface(), 147 SID_EVENTCONFIG ); 148 if ( pMacroDlg && pMacroDlg->Execute() == RET_OK ) 149 { 150 const SfxItemSet* pOutSet = pMacroDlg->GetOutputItemSet(); 151 const SfxPoolItem* pItem; 152 if( SFX_ITEM_SET == pOutSet->GetItemState( RES_FRMMACRO, sal_False, &pItem )) 153 { 154 rpINetItem->SetMacroTable( ((SvxMacroItem*)pItem)->GetMacroTable() ); 155 bRet = sal_True; 156 } 157 } 158 return bRet; 159 } 160