1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "hintids.hxx"
22 #include <sfx2/htmlmode.hxx>
23 #include <svx/svxids.hrc>
24 #include <sfx2/app.hxx>
25 #include <vcl/msgbox.hxx>
27 #include "swtypes.hxx"
29 #include "viewopt.hxx"
30 #include "macassgn.hxx"
31 #include "swevent.hxx"
33 #include "globals.hrc"
35 #include <sfx2/viewfrm.hxx>
37 #include <svx/svxdlg.hxx>
41 using ::com::sun::star::uno::Reference
;
42 using ::com::sun::star::frame::XFrame
;
44 SfxEventNamesItem
SwMacroAssignDlg::AddEvents( DlgEventType eType
)
46 SfxEventNamesItem
aItem(SID_EVENTCONFIG
);
48 sal_uInt16 nHtmlMode
= ::GetHtmlMode((const SwDocShell
*)SfxObjectShell::Current());
49 bool bHtmlMode
= nHtmlMode
& HTMLMODE_ON
;
53 case MACASSGN_AUTOTEXT
:
54 aItem
.AddEvent( String( SW_RES(STR_EVENT_START_INS_GLOSSARY
) ), String(),
55 SW_EVENT_START_INS_GLOSSARY
);
56 aItem
.AddEvent( String( SW_RES(STR_EVENT_END_INS_GLOSSARY
) ), String(),
57 SW_EVENT_END_INS_GLOSSARY
);
58 // in order for the new handler to become active!
61 case MACASSGN_GRAPHIC
: // graphics
63 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ERROR
) ), String(),
64 SVX_EVENT_IMAGE_ERROR
);
65 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_ABORT
) ), String(),
66 SVX_EVENT_IMAGE_ABORT
);
67 aItem
.AddEvent( String( SW_RES(STR_EVENT_IMAGE_LOAD
) ), String(),
68 SVX_EVENT_IMAGE_LOAD
);
71 case MACASSGN_FRMURL
: // Frm - URL-Attributes
74 (MACASSGN_FRMURL
== eType
|| MACASSGN_ALLFRM
== eType
))
76 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_A
) ), String(),
77 SW_EVENT_FRM_KEYINPUT_ALPHA
);
78 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_KEYINPUT_NOA
) ), String(),
79 SW_EVENT_FRM_KEYINPUT_NOALPHA
);
80 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_RESIZE
) ), String(),
81 SW_EVENT_FRM_RESIZE
);
82 aItem
.AddEvent( String( SW_RES( STR_EVENT_FRM_MOVE
) ), String(),
87 case MACASSGN_OLE
: // OLE
90 aItem
.AddEvent( String( SW_RES(STR_EVENT_OBJECT_SELECT
) ), String(),
91 SW_EVENT_OBJECT_SELECT
);
94 case MACASSGN_INETFMT
: // INetFmt-Attributes
96 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSEOVER_OBJECT
) ), String(),
97 SFX_EVENT_MOUSEOVER_OBJECT
);
98 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSECLICK_OBJECT
) ), String(),
99 SFX_EVENT_MOUSECLICK_OBJECT
);
100 aItem
.AddEvent( String( SW_RES(STR_EVENT_MOUSEOUT_OBJECT
) ), String(),
101 SFX_EVENT_MOUSEOUT_OBJECT
);
110 sal_Bool
SwMacroAssignDlg::INetFmtDlg( Window
* pParent
, SwWrtShell
& rSh
,
111 SvxMacroItem
*& rpINetItem
)
113 sal_Bool bRet
= sal_False
;
114 SfxItemSet
aSet( rSh
.GetAttrPool(), RES_FRMMACRO
, RES_FRMMACRO
, SID_EVENTCONFIG
, SID_EVENTCONFIG
, 0 );
115 SvxMacroItem
aItem( RES_FRMMACRO
);
117 rpINetItem
= new SvxMacroItem( RES_FRMMACRO
);
119 aItem
.SetMacroTable( rpINetItem
->GetMacroTable() );
122 aSet
.Put( AddEvents( MACASSGN_INETFMT
) );
124 SvxAbstractDialogFactory
* pFact
= SvxAbstractDialogFactory::Create();
125 SfxAbstractDialog
* pMacroDlg
= pFact
->CreateSfxDialog( pParent
, aSet
,
126 rSh
.GetView().GetViewFrame()->GetFrame().GetFrameInterface(),
128 if ( pMacroDlg
&& pMacroDlg
->Execute() == RET_OK
)
130 const SfxItemSet
* pOutSet
= pMacroDlg
->GetOutputItemSet();
131 const SfxPoolItem
* pItem
;
132 if( SFX_ITEM_SET
== pOutSet
->GetItemState( RES_FRMMACRO
, sal_False
, &pItem
))
134 rpINetItem
->SetMacroTable( ((SvxMacroItem
*)pItem
)->GetMacroTable() );
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */