ITEM: Refactor ItemType
[LibreOffice.git] / sw / source / ui / dialog / macassgn.cxx
blobfe62baaac77d594de3472d4e4ef29d5e5e6eaf1d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <svl/macitem.hxx>
26 #include <swtypes.hxx>
27 #include <wrtsh.hxx>
28 #include <viewopt.hxx>
29 #include <macassgn.hxx>
30 #include <docsh.hxx>
31 #include <strings.hrc>
32 #include <view.hxx>
33 #include <sfx2/viewfrm.hxx>
35 #include <svx/svxdlg.hxx>
38 SfxEventNamesItem SwMacroAssignDlg::AddEvents( DlgEventType eType )
40 SfxEventNamesItem aItem(SID_EVENTCONFIG);
42 sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
43 bool bHtmlMode = nHtmlMode & HTMLMODE_ON;
45 switch( eType )
47 case MACASSGN_AUTOTEXT:
48 aItem.AddEvent( SwResId(STR_EVENT_START_INS_GLOSSARY), OUString(),
49 SvMacroItemId::SwStartInsGlossary );
50 aItem.AddEvent( SwResId(STR_EVENT_END_INS_GLOSSARY), OUString(),
51 SvMacroItemId::SwEndInsGlossary);
52 // in order for the new handler to become active!
53 break;
54 case MACASSGN_ALLFRM:
55 case MACASSGN_GRAPHIC: // graphics
57 aItem.AddEvent( SwResId(STR_EVENT_IMAGE_ERROR), OUString(),
58 SvMacroItemId::OnImageLoadError);
59 aItem.AddEvent( SwResId(STR_EVENT_IMAGE_ABORT), OUString(),
60 SvMacroItemId::OnImageLoadCancel);
61 aItem.AddEvent( SwResId(STR_EVENT_IMAGE_LOAD), OUString(),
62 SvMacroItemId::OnImageLoadDone);
64 [[fallthrough]];
65 case MACASSGN_FRMURL: // Frame - URL-Attributes
67 if( !bHtmlMode &&
68 (MACASSGN_FRMURL == eType || MACASSGN_ALLFRM == eType))
70 aItem.AddEvent( SwResId( STR_EVENT_FRM_KEYINPUT_A ), OUString(),
71 SvMacroItemId::SwFrmKeyInputAlpha );
72 aItem.AddEvent( SwResId( STR_EVENT_FRM_KEYINPUT_NOA ), OUString(),
73 SvMacroItemId::SwFrmKeyInputNoAlpha );
74 aItem.AddEvent( SwResId( STR_EVENT_FRM_RESIZE ), OUString(),
75 SvMacroItemId::SwFrmResize );
76 aItem.AddEvent( SwResId( STR_EVENT_FRM_MOVE ), OUString(),
77 SvMacroItemId::SwFrmMove );
80 [[fallthrough]];
81 case MACASSGN_OLE: // OLE
83 if( !bHtmlMode )
84 aItem.AddEvent( SwResId(STR_EVENT_OBJECT_SELECT), OUString(),
85 SvMacroItemId::SwObjectSelect );
86 aItem.AddEvent( SwResId(STR_EVENT_MOUSEOVER_OBJECT), OUString(),
87 SvMacroItemId::OnMouseOver );
88 aItem.AddEvent( SwResId(STR_EVENT_MOUSECLICK_OBJECT), OUString(),
89 SvMacroItemId::OnClick);
90 aItem.AddEvent( SwResId(STR_EVENT_MOUSEOUT_OBJECT), OUString(),
91 SvMacroItemId::OnMouseOut);
93 break;
96 return aItem;
99 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */