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 <cmdid.h>
30 : : #include <hintids.hxx>
31 : : #include <vcl/msgbox.hxx>
32 : : #include <svl/stritem.hxx>
33 : : #include <svl/whiter.hxx>
34 : : #include <svl/urihelper.hxx>
35 : : #include <sfx2/dispatch.hxx>
36 : : #include <editeng/sizeitem.hxx>
37 : : #include <editeng/protitem.hxx>
38 : : #include <sfx2/request.hxx>
39 : : #include <svl/srchitem.hxx>
40 : : #include <svx/htmlmode.hxx>
41 : : #include <svx/sdgluitm.hxx>
42 : : #include <svx/sdgcoitm.hxx>
43 : : #include <svx/sdggaitm.hxx>
44 : : #include <svx/sdgtritm.hxx>
45 : : #include <svx/sdginitm.hxx>
46 : : #include <svx/sdgmoitm.hxx>
47 : : #include <editeng/brshitem.hxx>
48 : : #include <svx/grfflt.hxx>
49 : : #include <fmturl.hxx>
50 : : #include <view.hxx>
51 : : #include <wrtsh.hxx>
52 : : #include <viewopt.hxx>
53 : : #include <swmodule.hxx>
54 : : #include <frmatr.hxx>
55 : : #include <swundo.hxx>
56 : : #include <uitool.hxx>
57 : : #include <docsh.hxx>
58 : : #include <mediash.hxx>
59 : : #include <frmmgr.hxx>
60 : : #include <frmdlg.hxx>
61 : : #include <frmfmt.hxx>
62 : : #include <grfatr.hxx>
63 : : #include <usrpref.hxx>
64 : : #include <edtwin.hxx>
65 : : #include <swwait.hxx>
66 : : #include <shells.hrc>
67 : : #include <popup.hrc>
68 : :
69 : : #include <sfx2/objface.hxx>
70 : : #include <svx/svdomedia.hxx>
71 : : #include <svx/sdr/contact/viewcontactofsdrmediaobj.hxx>
72 : : #include <avmedia/mediaitem.hxx>
73 : :
74 : : #define SwMediaShell
75 : : #include <sfx2/msg.hxx>
76 : : #include "swslots.hxx"
77 : : #include "swabstdlg.hxx"
78 : :
79 [ + + ][ + - ]: 292 : SFX_IMPL_INTERFACE(SwMediaShell, SwBaseShell, SW_RES(STR_SHELLNAME_MEDIA))
[ + - ][ + - ]
80 : : {
81 [ + - ][ + - ]: 73 : SFX_POPUPMENU_REGISTRATION(SW_RES(MN_MEDIA_POPUPMENU));
82 [ + - ][ + - ]: 73 : SFX_OBJECTBAR_REGISTRATION(SFX_OBJECTBAR_OBJECT, SW_RES(RID_MEDIA_TOOLBOX));
83 : 73 : }
84 : :
85 : 0 : void SwMediaShell::ExecMedia(SfxRequest &rReq)
86 : : {
87 : 0 : SwWrtShell* pSh = &GetShell();
88 : 0 : SdrView* pSdrView = pSh->GetDrawView();
89 : :
90 [ # # ]: 0 : if( pSdrView )
91 : : {
92 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
93 : 0 : sal_uInt16 nSlotId = rReq.GetSlot();
94 : 0 : sal_Bool bChanged = pSdrView->GetModel()->IsChanged();
95 : :
96 : 0 : pSdrView->GetModel()->SetChanged( sal_False );
97 : :
98 [ # # # ]: 0 : switch( nSlotId )
99 : : {
100 : : case SID_DELETE:
101 : : {
102 [ # # ]: 0 : if( pSh->IsObjSelected() )
103 : : {
104 : 0 : pSh->SetModified();
105 : 0 : pSh->DelSelectedObj();
106 : :
107 [ # # ]: 0 : if( pSh->IsSelFrmMode() )
108 : 0 : pSh->LeaveSelFrmMode();
109 : :
110 : 0 : GetView().AttrChangedNotify( pSh );
111 : : }
112 : : }
113 : 0 : break;
114 : :
115 : : case( SID_AVMEDIA_TOOLBOX ):
116 : : {
117 [ # # ]: 0 : if( pSh->IsObjSelected() )
118 : : {
119 : : const SfxPoolItem* pItem;
120 : :
121 [ # # ][ # # ]: 0 : if( !pArgs || ( SFX_ITEM_SET != pArgs->GetItemState( SID_AVMEDIA_TOOLBOX, sal_False, &pItem ) ) )
[ # # ][ # # ]
122 : 0 : pItem = NULL;
123 : :
124 [ # # ]: 0 : if( pItem )
125 : : {
126 [ # # ][ # # ]: 0 : SdrMarkList* pMarkList = new SdrMarkList( pSdrView->GetMarkedObjectList() );
127 : :
128 [ # # ]: 0 : if( 1 == pMarkList->GetMarkCount() )
129 : : {
130 [ # # ][ # # ]: 0 : SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
131 : :
132 [ # # ][ # # ]: 0 : if( pObj && pObj->ISA( SdrMediaObj ) )
[ # # ][ # # ]
[ # # ]
133 : : {
134 [ # # ]: 0 : static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).executeMediaItem(
135 [ # # ]: 0 : static_cast< const ::avmedia::MediaItem& >( *pItem ) );
136 : : }
137 : : }
138 : :
139 [ # # ][ # # ]: 0 : delete pMarkList;
140 : : }
141 : : }
142 : : }
143 : 0 : break;
144 : :
145 : : default:
146 : 0 : break;
147 : : }
148 : :
149 [ # # ]: 0 : if( pSdrView->GetModel()->IsChanged() )
150 : 0 : GetShell().SetModified();
151 [ # # ]: 0 : else if( bChanged )
152 : 0 : pSdrView->GetModel()->SetChanged(sal_True);
153 : : }
154 : 0 : }
155 : :
156 : 0 : void SwMediaShell::GetMediaState(SfxItemSet &rSet)
157 : : {
158 [ # # ]: 0 : SfxWhichIter aIter( rSet );
159 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
160 : :
161 [ # # ]: 0 : while( nWhich )
162 : : {
163 [ # # ]: 0 : if( SID_AVMEDIA_TOOLBOX == nWhich )
164 : : {
165 [ # # ]: 0 : SwWrtShell& rSh = GetShell();
166 [ # # ]: 0 : SdrView* pView = rSh.GetDrawView();
167 : :
168 [ # # ]: 0 : if( pView )
169 : : {
170 : 0 : bool bDisable = true;
171 [ # # ][ # # ]: 0 : SdrMarkList* pMarkList = new SdrMarkList( pView->GetMarkedObjectList() );
172 : :
173 [ # # ]: 0 : if( 1 == pMarkList->GetMarkCount() )
174 : : {
175 [ # # ][ # # ]: 0 : SdrObject* pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
176 : :
177 [ # # ][ # # ]: 0 : if( pObj && pObj->ISA( SdrMediaObj ) )
[ # # ][ # # ]
[ # # ]
178 : : {
179 [ # # ]: 0 : ::avmedia::MediaItem aItem( SID_AVMEDIA_TOOLBOX );
180 : :
181 [ # # ][ # # ]: 0 : static_cast< sdr::contact::ViewContactOfSdrMediaObj& >( pObj->GetViewContact() ).updateMediaItem( aItem );
182 [ # # ]: 0 : rSet.Put( aItem );
183 [ # # ]: 0 : bDisable = false;
184 : : }
185 : : }
186 : :
187 [ # # ]: 0 : if( bDisable )
188 [ # # ]: 0 : rSet.DisableItem( SID_AVMEDIA_TOOLBOX );
189 : :
190 [ # # ][ # # ]: 0 : delete pMarkList;
191 : : }
192 : : }
193 : :
194 [ # # ]: 0 : nWhich = aIter.NextWhich();
195 [ # # ]: 0 : }
196 : 0 : }
197 : :
198 : 0 : SwMediaShell::SwMediaShell(SwView &_rView) :
199 : 0 : SwBaseShell(_rView)
200 : :
201 : : {
202 [ # # ][ # # ]: 0 : SetName(rtl::OUString("Media Playback"));
[ # # ]
203 [ # # ]: 0 : SetHelpId(SW_MEDIASHELL);
204 : 0 : }
205 : :
206 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|