1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: macassgn.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
34 #ifdef SW_DLLIMPLEMENTATION
35 #undef SW_DLLIMPLEMENTATION
39 #include "hintids.hxx"
41 #define _SVSTDARR_STRINGSDTOR
42 #include <svtools/svstdarr.hxx>
43 #include <svx/htmlmode.hxx>
44 #ifndef _SVX_SVXIDS_HRC //autogen
45 #include <svx/svxids.hrc>
47 #include <sfx2/app.hxx>
48 #include <vcl/msgbox.hxx>
50 #include "swtypes.hxx"
52 #include "viewopt.hxx"
53 #include "macassgn.hxx"
54 #include "swevent.hxx"
56 #include "globals.hrc"
58 #include <sfx2/viewfrm.hxx>
60 #include <svx/svxdlg.hxx>
64 using ::com::sun::star::uno::Reference
;
65 using ::com::sun::star::frame::XFrame
;
67 // SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage*, const String& );
69 SfxEventNamesItem
SwMacroAssignDlg::AddEvents( DlgEventType eType
)
71 // const SfxItemSet& rSet = rPg.GetItemSet();
72 SfxEventNamesItem
aItem(SID_EVENTCONFIG
);
74 BOOL bHtmlMode
= FALSE
;
75 USHORT nHtmlMode
= ::GetHtmlMode((const SwDocShell
*)SfxObjectShell::Current());
76 bHtmlMode
= nHtmlMode
& HTMLMODE_ON
? TRUE
: FALSE
;
80 case MACASSGN_TEXTBAUST
: // Textbausteine
81 // rPg.SetGetRangeLink( &_GetRangeHdl );
82 aItem
.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY
) ), String(),
83 SW_EVENT_START_INS_GLOSSARY
);
84 aItem
.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY
) ), String(),
85 SW_EVENT_END_INS_GLOSSARY
);
86 // damit der neue Handler aktiv wird!
90 case MACASSGN_GRAPHIC
: // Grafiken
92 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR
) ), String(),
93 SVX_EVENT_IMAGE_ERROR
);
94 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT
) ), String(),
95 SVX_EVENT_IMAGE_ABORT
);
96 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD
) ), String(),
97 SVX_EVENT_IMAGE_LOAD
);
100 case MACASSGN_FRMURL
: // Frm - URL-Attribute
103 (MACASSGN_FRMURL
== eType
|| MACASSGN_ALLFRM
== eType
))
105 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A
) ), String(),
106 SW_EVENT_FRM_KEYINPUT_ALPHA
);
107 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA
) ), String(),
108 SW_EVENT_FRM_KEYINPUT_NOALPHA
);
109 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE
) ), String(),
110 SW_EVENT_FRM_RESIZE
);
111 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE
) ), String(),
116 case MACASSGN_OLE
: // OLE
119 aItem
.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT
) ), String(),
120 SW_EVENT_OBJECT_SELECT
);
123 case MACASSGN_INETFMT
: // INetFmt-Attribute
125 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT
) ), String(),
126 SFX_EVENT_MOUSEOVER_OBJECT
);
127 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT
) ), String(),
128 SFX_EVENT_MOUSECLICK_OBJECT
);
129 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT
) ), String(),
130 SFX_EVENT_MOUSEOUT_OBJECT
);
139 BOOL
SwMacroAssignDlg::INetFmtDlg( Window
* pParent
, SwWrtShell
& rSh
,
140 SvxMacroItem
*& rpINetItem
)
143 SfxItemSet
aSet( rSh
.GetAttrPool(), RES_FRMMACRO
, RES_FRMMACRO
, SID_EVENTCONFIG
, SID_EVENTCONFIG
, 0 );
144 SvxMacroItem
aItem( RES_FRMMACRO
);
146 rpINetItem
= new SvxMacroItem( RES_FRMMACRO
);
148 aItem
.SetMacroTable( rpINetItem
->GetMacroTable() );
151 aSet
.Put( AddEvents( MACASSGN_INETFMT
) );
153 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
154 SfxAbstractDialog
* pMacroDlg
= pFact
->CreateSfxDialog( pParent
, aSet
,
155 rSh
.GetView().GetViewFrame()->GetFrame()->GetFrameInterface(),
157 if ( pMacroDlg
&& pMacroDlg
->Execute() == RET_OK
)
159 const SfxItemSet
* pOutSet
= pMacroDlg
->GetOutputItemSet();
160 const SfxPoolItem
* pItem
;
161 if( SFX_ITEM_SET
== pOutSet
->GetItemState( RES_FRMMACRO
, FALSE
, &pItem
))
163 rpINetItem
->SetMacroTable( ((SvxMacroItem
*)pItem
)->GetMacroTable() );
171 SvStringsDtor* __EXPORT _GetRangeHdl( _SfxMacroTabPage* , const String& rLanguage )
173 SvStringsDtor* pNew = new SvStringsDtor;
175 SfxApplication* pSfxApp = SFX_APP();
176 if ( !rLanguage.EqualsAscii(SVX_MACRO_LANGUAGE_JAVASCRIPT) )
178 pSfxApp->EnterBasicCall();
180 String* pNewEntry = new String( pSfxApp->GetName() );
181 pNew->Insert( pNewEntry, pNew->Count() );
183 TypeId aType( TYPE( SwDocShell ));
184 SfxObjectShell* pDoc = SfxObjectShell::GetFirst( &aType );
187 pNewEntry = new String( pDoc->GetTitle() );
188 pNew->Insert( pNewEntry, pNew->Count() );
189 pDoc = SfxObjectShell::GetNext( *pDoc, &aType );
191 pSfxApp->LeaveBasicCall();