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 <svx/svdmark.hxx>
30 : : #include <svx/svdview.hxx>
31 : : #include <svx/galbrws.hxx>
32 : : #include <svx/gallery.hxx>
33 : : #include <svx/hlnkitem.hxx>
34 : : #include <sfx2/bindings.hxx>
35 : : #include <sfx2/request.hxx>
36 : : #include <sfx2/viewfrm.hxx>
37 : : #include <sfx2/dispatch.hxx>
38 : : #include <svl/whiter.hxx>
39 : :
40 : : #include "tabvwsh.hxx"
41 : : #include "viewdata.hxx"
42 : : #include "tabview.hxx"
43 : : #include "drwlayer.hxx"
44 : : #include "userdat.hxx"
45 : : #include "docsh.hxx"
46 : :
47 : : // forwards -> galwrap.cxx (wg. CLOOKs)
48 : :
49 : : sal_uInt16 GallerySGA_FORMAT_GRAPHIC();
50 : : Graphic GalleryGetGraphic ();
51 : : sal_Bool GalleryIsLinkage ();
52 : : String GalleryGetFullPath ();
53 : : String GalleryGetFilterName ();
54 : :
55 : : // forwards -> imapwrap.cxx (wg. CLOOKs)
56 : :
57 : : class SvxIMapDlg;
58 : :
59 : : sal_uInt16 ScIMapChildWindowId();
60 : : SvxIMapDlg* ScGetIMapDlg();
61 : : const void* ScIMapDlgGetObj( SvxIMapDlg* pDlg );
62 : : const ImageMap& ScIMapDlgGetMap( SvxIMapDlg* pDlg );
63 : :
64 : : //------------------------------------------------------------------
65 : :
66 : 0 : void ScTabViewShell::ExecChildWin(SfxRequest& rReq)
67 : : {
68 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
69 [ # # ]: 0 : switch(nSlot)
70 : : {
71 : : case SID_GALLERY:
72 : : {
73 : 0 : SfxViewFrame* pThisFrame = GetViewFrame();
74 : 0 : pThisFrame->ToggleChildWindow( GalleryChildWindow::GetChildWindowId() );
75 : 0 : pThisFrame->GetBindings().Invalidate( SID_GALLERY );
76 : 0 : rReq.Ignore();
77 : : }
78 : 0 : break;
79 : : }
80 : 0 : }
81 : :
82 : 268 : void ScTabViewShell::GetChildWinState( SfxItemSet& rSet )
83 : : {
84 [ + - ]: 268 : if( SFX_ITEM_AVAILABLE == rSet.GetItemState( SID_GALLERY ) )
85 : : {
86 : 268 : sal_uInt16 nId = GalleryChildWindow::GetChildWindowId();
87 [ + - ]: 268 : rSet.Put( SfxBoolItem( SID_GALLERY, GetViewFrame()->HasChildWindow( nId ) ) );
88 : : }
89 : 268 : }
90 : :
91 : : //------------------------------------------------------------------
92 : :
93 : 0 : void ScTabViewShell::ExecGallery( SfxRequest& rReq )
94 : : {
95 : 0 : const SfxItemSet* pArgs = rReq.GetArgs();
96 : :
97 [ # # ]: 0 : if ( pArgs )
98 : : {
99 : 0 : const SfxPoolItem* pItem = NULL;
100 [ # # ]: 0 : SfxItemState eState = pArgs->GetItemState(SID_GALLERY_FORMATS, sal_True, &pItem);
101 [ # # ]: 0 : if ( eState == SFX_ITEM_SET )
102 : : {
103 : 0 : sal_uInt32 nFormats = ((const SfxUInt32Item*)pItem)->GetValue();
104 : :
105 : : /******************************************************************
106 : : * Graphik einfuegen
107 : : ******************************************************************/
108 [ # # ][ # # ]: 0 : if ( nFormats & GallerySGA_FORMAT_GRAPHIC() )
109 : : {
110 [ # # ]: 0 : MakeDrawLayer();
111 : :
112 [ # # ]: 0 : Graphic aGraphic = GalleryGetGraphic();
113 [ # # ]: 0 : Point aPos = GetInsertPos();
114 : :
115 [ # # ][ # # ]: 0 : String aPath, aFilter;
116 [ # # ][ # # ]: 0 : if ( GalleryIsLinkage() ) // als Link einfuegen?
117 : : {
118 [ # # ][ # # ]: 0 : aPath = GalleryGetFullPath();
[ # # ]
119 [ # # ][ # # ]: 0 : aFilter = GalleryGetFilterName();
[ # # ]
120 : : }
121 : :
122 [ # # ][ # # ]: 0 : PasteGraphic( aPos, aGraphic, aPath, aFilter );
[ # # ][ # # ]
123 : : }
124 [ # # ]: 0 : else if ( nFormats & SGA_FORMAT_SOUND )
125 : : {
126 : : // for sounds (linked or not), insert a hyperlink button,
127 : : // like in Impress and Writer
128 : :
129 [ # # ]: 0 : GalleryExplorer* pGal = SVX_GALLERY();
130 [ # # ]: 0 : if ( pGal )
131 : : {
132 [ # # ][ # # ]: 0 : const SfxStringItem aMediaURLItem( SID_INSERT_AVMEDIA, pGal->GetURL().GetMainURL( INetURLObject::NO_DECODE ) );
[ # # ][ # # ]
[ # # ][ # # ]
133 [ # # ][ # # ]: 0 : GetViewFrame()->GetDispatcher()->Execute( SID_INSERT_AVMEDIA, SFX_CALLMODE_SYNCHRON, &aMediaURLItem, 0L );
134 : : }
135 : : }
136 : : }
137 : : }
138 : 0 : }
139 : :
140 : 0 : void ScTabViewShell::GetGalleryState( SfxItemSet& /* rSet */ )
141 : : {
142 : 0 : }
143 : :
144 : : //------------------------------------------------------------------
145 : :
146 : 10159 : ScInputHandler* ScTabViewShell::GetInputHandler() const
147 : : {
148 : 10159 : return pInputHandler;
149 : : }
150 : :
151 : : //------------------------------------------------------------------
152 : :
153 : 0 : String ScTabViewShell::GetDescription() const
154 : : {
155 [ # # ]: 0 : return rtl::OUString(" ** Test ** ");
156 : : }
157 : :
158 : 0 : void ScTabViewShell::ExecImageMap( SfxRequest& rReq )
159 : : {
160 : 0 : sal_uInt16 nSlot = rReq.GetSlot();
161 [ # # # ]: 0 : switch(nSlot)
162 : : {
163 : : case SID_IMAP:
164 : : {
165 : 0 : SfxViewFrame* pThisFrame = GetViewFrame();
166 : 0 : sal_uInt16 nId = ScIMapChildWindowId();
167 : 0 : pThisFrame->ToggleChildWindow( nId );
168 : 0 : GetViewFrame()->GetBindings().Invalidate( SID_IMAP );
169 : :
170 [ # # ]: 0 : if ( pThisFrame->HasChildWindow( nId ) )
171 : : {
172 : 0 : SvxIMapDlg* pDlg = ScGetIMapDlg();
173 [ # # ]: 0 : if ( pDlg )
174 : : {
175 : 0 : SdrView* pDrView = GetSdrView();
176 [ # # ]: 0 : if ( pDrView )
177 : : {
178 : 0 : const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
179 [ # # ]: 0 : if ( rMarkList.GetMarkCount() == 1 )
180 : 0 : UpdateIMap( rMarkList.GetMark( 0 )->GetMarkedSdrObj() );
181 : : }
182 : : }
183 : : }
184 : :
185 : 0 : rReq.Ignore();
186 : : }
187 : 0 : break;
188 : :
189 : : case SID_IMAP_EXEC:
190 : : {
191 : 0 : SdrView* pDrView = GetSdrView();
192 [ # # ]: 0 : SdrMark* pMark = pDrView ? pDrView->GetMarkedObjectList().GetMark(0) : 0;
193 : :
194 [ # # ]: 0 : if ( pMark )
195 : : {
196 : 0 : SdrObject* pSdrObj = pMark->GetMarkedSdrObj();
197 : 0 : SvxIMapDlg* pDlg = ScGetIMapDlg();
198 : :
199 [ # # ]: 0 : if ( ScIMapDlgGetObj(pDlg) == (void*) pSdrObj )
200 : : {
201 : 0 : const ImageMap& rImageMap = ScIMapDlgGetMap(pDlg);
202 : 0 : ScIMapInfo* pIMapInfo = ScDrawLayer::GetIMapInfo( pSdrObj );
203 : :
204 [ # # ]: 0 : if ( !pIMapInfo )
205 [ # # ]: 0 : pSdrObj->AppendUserData( new ScIMapInfo( rImageMap ) );
206 : : else
207 : 0 : pIMapInfo->SetImageMap( rImageMap );
208 : :
209 : 0 : GetViewData()->GetDocShell()->SetDrawModified();
210 : : }
211 : : }
212 : : }
213 : 0 : break;
214 : : }
215 : 0 : }
216 : :
217 : 0 : void ScTabViewShell::GetImageMapState( SfxItemSet& rSet )
218 : : {
219 [ # # ]: 0 : SfxWhichIter aIter(rSet);
220 [ # # ]: 0 : sal_uInt16 nWhich = aIter.FirstWhich();
221 [ # # ]: 0 : while ( nWhich )
222 : : {
223 [ # # # ]: 0 : switch ( nWhich )
224 : : {
225 : : case SID_IMAP:
226 : : {
227 : : // Disabled wird nicht mehr...
228 : :
229 : 0 : sal_Bool bThere = false;
230 : 0 : SfxViewFrame* pThisFrame = GetViewFrame();
231 [ # # ]: 0 : sal_uInt16 nId = ScIMapChildWindowId();
232 [ # # ][ # # ]: 0 : if ( pThisFrame->KnowsChildWindow(nId) )
233 [ # # ][ # # ]: 0 : if ( pThisFrame->HasChildWindow(nId) )
234 : 0 : bThere = sal_True;
235 : :
236 [ # # ]: 0 : ObjectSelectionType eType=GetCurObjectSelectionType();
237 [ # # ][ # # ]: 0 : sal_Bool bEnable=(eType==OST_OleObject) ||(eType==OST_Graphic);
238 [ # # ][ # # ]: 0 : if(!bThere && !bEnable)
239 : : {
240 [ # # ]: 0 : rSet.DisableItem( nWhich );
241 : : }
242 : : else
243 : : {
244 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( nWhich, bThere ) );
[ # # ]
245 : : }
246 : : }
247 : 0 : break;
248 : :
249 : : case SID_IMAP_EXEC:
250 : : {
251 : 0 : sal_Bool bDisable = sal_True;
252 : :
253 [ # # ]: 0 : SdrView* pDrView = GetSdrView();
254 [ # # ]: 0 : if ( pDrView )
255 : : {
256 : 0 : const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
257 [ # # ]: 0 : if ( rMarkList.GetMarkCount() == 1 )
258 [ # # ][ # # ]: 0 : if ( ScIMapDlgGetObj(ScGetIMapDlg()) ==
[ # # ]
259 [ # # ][ # # ]: 0 : (void*) rMarkList.GetMark(0)->GetMarkedSdrObj() )
260 : 0 : bDisable = false;
261 : : }
262 : :
263 [ # # ][ # # ]: 0 : rSet.Put( SfxBoolItem( SID_IMAP_EXEC, bDisable ) );
[ # # ]
264 : : }
265 : 0 : break;
266 : : }
267 : :
268 [ # # ]: 0 : nWhich = aIter.NextWhich();
269 [ # # ]: 0 : }
270 : 0 : }
271 : :
272 : :
273 : :
274 : :
275 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|