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