Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "View.hxx"
21 : #include <unotools/localfilehelper.hxx>
22 : #include <sfx2/request.hxx>
23 : #include <sfx2/docfilt.hxx>
24 : #include <sfx2/fcontnr.hxx>
25 : #include <sfx2/docfile.hxx>
26 : #include <vcl/msgbox.hxx>
27 : #include <svl/urlbmk.hxx>
28 : #include <svx/svdpagv.hxx>
29 : #include <svx/xfillit.hxx>
30 : #include <svx/svdundo.hxx>
31 : #include <svx/xoutbmp.hxx>
32 : #include <svx/svdograf.hxx>
33 : #include <svx/svdomedia.hxx>
34 : #include <svx/svdoole2.hxx>
35 : #include <sot/storage.hxx>
36 : #include <sfx2/app.hxx>
37 : #include <avmedia/mediawindow.hxx>
38 : #include <svtools/ehdl.hxx>
39 : #include <svtools/sfxecode.hxx>
40 : #include <vcl/graphicfilter.hxx>
41 : #include "app.hrc"
42 : #include "Window.hxx"
43 : #include "DrawDocShell.hxx"
44 : #include "DrawViewShell.hxx"
45 : #include "fuinsfil.hxx"
46 : #include "drawdoc.hxx"
47 : #include "sdresid.hxx"
48 : #include "strings.hrc"
49 : #include "imapinfo.hxx"
50 : #include "sdpage.hxx"
51 : #include "view/SlideSorterView.hxx"
52 : #include "undo/undoobjects.hxx"
53 : #include <comphelper/processfactory.hxx>
54 : #include <com/sun/star/embed/ElementModes.hpp>
55 : #include <com/sun/star/embed/XEmbedPersist.hpp>
56 : #include <com/sun/star/embed/Aspects.hpp>
57 : #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
58 : #include <svtools/soerr.hxx>
59 : #include <sfx2/ipclient.hxx>
60 : #include <svx/svdoashp.hxx>
61 : #include "glob.hrc"
62 :
63 : using namespace com::sun::star;
64 :
65 : namespace sd {
66 :
67 : /**
68 : * If an empty graphic object is provided, we fill it. Otherwise we fill an
69 : * existing object at the specified position. If there is no object at the
70 : * position, we create a new object and return a pointer to it.
71 : */
72 0 : SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
73 : const Point& rPos, SdrObject* pObj, ImageMap* pImageMap )
74 : {
75 0 : SdrEndTextEdit();
76 0 : mnAction = rAction;
77 :
78 : // Is there a object at the position rPos?
79 0 : SdrGrafObj* pNewGrafObj = NULL;
80 0 : SdrPageView* pPV = GetSdrPageView();
81 0 : SdrObject* pPickObj = pObj;
82 0 : const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
83 :
84 0 : if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView))
85 : {
86 0 : if(!pPV->GetPageRect().IsInside(rPos))
87 0 : pPV = 0L;
88 : }
89 :
90 0 : if( !pPickObj && pPV )
91 : {
92 0 : SdrPageView* pPageView = pPV;
93 0 : PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
94 : }
95 :
96 0 : if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
97 : {
98 0 : const bool bIsGraphic(0 != dynamic_cast< SdrGrafObj* >(pPickObj));
99 :
100 0 : if(bIsGraphic || (pPickObj && pPickObj->IsEmptyPresObj() && !bOnMaster)) // #i121603# Do not use pObj, it may be NULL
101 : {
102 0 : if( IsUndoEnabled() )
103 0 : BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
104 :
105 0 : SdPage* pPage = (SdPage*) pPickObj->GetPage();
106 :
107 0 : if( bIsGraphic )
108 : {
109 : // We fill the object with the Bitmap
110 0 : pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
111 0 : pNewGrafObj->SetGraphic(rGraphic);
112 : }
113 : else
114 : {
115 0 : pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetSnapRect() );
116 0 : pNewGrafObj->SetEmptyPresObj(sal_True);
117 : }
118 :
119 0 : if ( pNewGrafObj->IsEmptyPresObj() )
120 : {
121 0 : Rectangle aRect( pNewGrafObj->GetLogicRect() );
122 0 : pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
123 0 : pNewGrafObj->SetOutlinerParaObject(NULL);
124 0 : pNewGrafObj->SetEmptyPresObj(sal_False);
125 : }
126 :
127 0 : if (pPage && pPage->IsPresObj(pPickObj))
128 : {
129 : // Insert new PresObj into the list
130 0 : pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
131 0 : pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
132 : }
133 :
134 0 : if (pImageMap)
135 0 : pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
136 :
137 0 : ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
138 :
139 0 : if( IsUndoEnabled() )
140 0 : EndUndo();
141 : }
142 0 : else if(pPickObj->IsClosedObj())
143 : {
144 : // fill object with graphic
145 0 : if( IsUndoEnabled() )
146 : {
147 0 : BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
148 0 : AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
149 0 : EndUndo();
150 : }
151 :
152 0 : SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
153 0 : aSet.Put(XFillStyleItem(XFILL_BITMAP));
154 0 : aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
155 0 : pPickObj->SetMergedItemSetAndBroadcast(aSet);
156 0 : }
157 : }
158 0 : else if ( pPV )
159 : {
160 : // create new object
161 0 : Size aSize;
162 :
163 0 : if ( rGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
164 : {
165 0 : ::OutputDevice* pOutDev = 0;
166 0 : if( mpViewSh )
167 0 : pOutDev = mpViewSh->GetActiveWindow();
168 :
169 0 : if( !pOutDev )
170 0 : pOutDev = Application::GetDefaultDevice();
171 :
172 0 : if( pOutDev )
173 0 : aSize = pOutDev->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM );
174 : }
175 : else
176 : {
177 : aSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
178 : rGraphic.GetPrefMapMode(),
179 0 : MapMode( MAP_100TH_MM ) );
180 : }
181 :
182 0 : pNewGrafObj = new SdrGrafObj( rGraphic, Rectangle( rPos, aSize ) );
183 0 : SdrPage* pPage = pPV->GetPage();
184 0 : Size aPageSize( pPage->GetSize() );
185 0 : aPageSize.Width() -= pPage->GetLftBorder() + pPage->GetRgtBorder();
186 0 : aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
187 0 : pNewGrafObj->AdjustToMaxRect( Rectangle( Point(), aPageSize ), sal_True );
188 :
189 0 : sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
190 0 : sal_Bool bIsPresTarget = sal_False;
191 :
192 0 : if ((mpViewSh
193 0 : && mpViewSh->GetViewShell()!=NULL
194 0 : && mpViewSh->GetViewShell()->GetIPClient()
195 0 : && mpViewSh->GetViewShell()->GetIPClient()->IsObjectInPlaceActive())
196 0 : || this->ISA(::sd::slidesorter::view::SlideSorterView))
197 0 : nOptions |= SDRINSERT_DONTMARK;
198 :
199 0 : if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
200 : {
201 0 : SdPage* pP = static_cast< SdPage* >( pPickObj->GetPage() );
202 :
203 0 : if ( pP && pP->IsMasterPage() )
204 0 : bIsPresTarget = pP->IsPresObj(pPickObj);
205 : }
206 :
207 0 : if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
208 : {
209 : // replace object
210 0 : if (pImageMap)
211 0 : pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
212 :
213 0 : Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
214 0 : Size aPickObjSize(aPickObjRect.GetSize());
215 0 : Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
216 0 : Size aObjSize(aObjRect.GetSize());
217 :
218 0 : Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
219 0 : Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
220 0 : pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
221 :
222 0 : Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
223 0 : pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y()));
224 :
225 0 : const bool bUndo = IsUndoEnabled();
226 :
227 0 : if( bUndo )
228 0 : BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
229 0 : pNewGrafObj->NbcSetLayer(pPickObj->GetLayer());
230 0 : SdrPage* pP = pPV->GetPage();
231 0 : pP->InsertObject(pNewGrafObj);
232 0 : if( bUndo )
233 : {
234 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj));
235 0 : AddUndo(mrDoc.GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj));
236 : }
237 0 : pP->RemoveObject(pPickObj->GetOrdNum());
238 :
239 0 : if( bUndo )
240 : {
241 0 : EndUndo();
242 : }
243 : else
244 : {
245 0 : SdrObject::Free(pPickObj);
246 : }
247 0 : mnAction = DND_ACTION_COPY;
248 : }
249 : else
250 : {
251 0 : InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
252 :
253 0 : if( pImageMap )
254 0 : pNewGrafObj->AppendUserData(new SdIMapInfo(*pImageMap));
255 : }
256 : }
257 :
258 0 : rAction = mnAction;
259 :
260 0 : return pNewGrafObj;
261 : }
262 :
263 : // -----------------------------------------------------------------------------
264 :
265 0 : SdrMediaObj* View::InsertMediaURL( const OUString& rMediaURL, sal_Int8& rAction,
266 : const Point& rPos, const Size& rSize,
267 : bool const bLink )
268 : {
269 0 : OUString realURL;
270 0 : if (bLink)
271 : {
272 0 : realURL = rMediaURL;
273 : }
274 : else
275 : {
276 : uno::Reference<frame::XModel> const xModel(
277 0 : GetDoc().GetObjectShell()->GetModel());
278 0 : bool const bRet = ::avmedia::EmbedMedia(xModel, rMediaURL, realURL);
279 0 : if (!bRet) { return 0; }
280 : }
281 :
282 0 : SdrEndTextEdit();
283 0 : mnAction = rAction;
284 :
285 0 : SdrMediaObj* pNewMediaObj = NULL;
286 0 : SdrPageView* pPV = GetSdrPageView();
287 0 : SdrObject* pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA );
288 :
289 0 : if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView ))
290 : {
291 0 : if(!pPV->GetPageRect().IsInside(rPos))
292 0 : pPV = 0L;
293 : }
294 :
295 0 : if( !pPickObj && pPV )
296 : {
297 0 : SdrPageView* pPageView = pPV;
298 0 : PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
299 : }
300 :
301 0 : if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) )
302 : {
303 0 : pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
304 0 : pNewMediaObj->setURL( realURL );
305 :
306 0 : BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
307 0 : ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
308 0 : EndUndo();
309 : }
310 0 : else if( pPV )
311 : {
312 0 : Rectangle aRect( rPos, rSize );
313 0 : if( pPickObj )
314 0 : aRect = pPickObj->GetLogicRect();
315 :
316 :
317 0 : pNewMediaObj = new SdrMediaObj( aRect );
318 :
319 0 : bool bIsPres = false;
320 0 : if( pPickObj )
321 : {
322 0 : SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
323 0 : bIsPres = pPage && pPage->IsPresObj(pPickObj);
324 0 : if( bIsPres )
325 : {
326 0 : pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA );
327 : }
328 : }
329 :
330 0 : if( pPickObj )
331 0 : ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
332 : else
333 0 : InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER );
334 :
335 0 : pNewMediaObj->setURL( realURL );
336 :
337 0 : if( pPickObj )
338 : {
339 0 : pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() );
340 0 : if( bIsPres )
341 0 : pNewMediaObj->SetUserCall(pPickObj->GetUserCall());
342 : }
343 : }
344 :
345 0 : rAction = mnAction;
346 :
347 0 : return pNewMediaObj;
348 : }
349 :
350 : /**
351 : * Timer handler for InsertFile at Drop()
352 : */
353 0 : IMPL_LINK_NOARG(View, DropInsertFileHdl)
354 : {
355 : DBG_ASSERT( mpViewSh, "sd::View::DropInsertFileHdl(), I need a view shell to work!" );
356 0 : if( !mpViewSh )
357 0 : return 0;
358 :
359 0 : SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX );
360 0 : ErrCode nError = 0;
361 :
362 0 : ::std::vector< String >::const_iterator aIter( maDropFileVector.begin() );
363 :
364 0 : while( (aIter != maDropFileVector.end()) && !nError )
365 : {
366 0 : String aCurrentDropFile( *aIter );
367 0 : INetURLObject aURL( aCurrentDropFile );
368 0 : sal_Bool bOK = sal_False;
369 :
370 0 : if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
371 : {
372 0 : OUString aURLStr;
373 0 : ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aCurrentDropFile, aURLStr );
374 0 : aURL = INetURLObject( aURLStr );
375 : }
376 :
377 0 : GraphicFilter& rGraphicFilter = GraphicFilter::GetGraphicFilter();
378 0 : Graphic aGraphic;
379 :
380 0 : aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
381 :
382 0 : if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) )
383 : {
384 0 : if( !rGraphicFilter.ImportGraphic( aGraphic, aURL ) )
385 : {
386 0 : sal_Int8 nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
387 0 : const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 );
388 0 : SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
389 0 : if(pGrafObj && bLink)
390 : {
391 0 : pGrafObj->SetGraphicLink( aCurrentDropFile, String() );
392 : }
393 :
394 : // return action from first inserted graphic
395 0 : if( aIter == maDropFileVector.begin() )
396 0 : mnAction = nTempAction;
397 :
398 0 : bOK = sal_True;
399 : }
400 0 : if( !bOK )
401 : {
402 0 : const SfxFilter* pFoundFilter = NULL;
403 0 : SfxMedium aSfxMedium( aCurrentDropFile, STREAM_READ | STREAM_SHARE_DENYNONE );
404 0 : ErrCode nErr = SFX_APP()->GetFilterMatcher().GuessFilter( aSfxMedium, &pFoundFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
405 :
406 0 : if( pFoundFilter && !nErr )
407 : {
408 0 : ::std::vector< OUString > aFilterVector;
409 0 : const String aFilterName( pFoundFilter->GetFilterName() );
410 0 : String aLowerAsciiFileName( aCurrentDropFile );
411 0 : aLowerAsciiFileName.ToLowerAscii();
412 :
413 0 : FuInsertFile::GetSupportedFilterVector( aFilterVector );
414 :
415 0 : if( ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFoundFilter->GetMimeType() ) != aFilterVector.end() ) ||
416 0 : aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
417 0 : aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
418 0 : aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
419 0 : aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ||
420 0 : aLowerAsciiFileName.SearchAscii(".sdd") != STRING_NOTFOUND ||
421 0 : aLowerAsciiFileName.SearchAscii(".sda") != STRING_NOTFOUND ||
422 0 : aLowerAsciiFileName.SearchAscii(".sxd") != STRING_NOTFOUND ||
423 0 : aLowerAsciiFileName.SearchAscii(".sxi") != STRING_NOTFOUND ||
424 0 : aLowerAsciiFileName.SearchAscii(".std") != STRING_NOTFOUND ||
425 0 : aLowerAsciiFileName.SearchAscii(".sti") != STRING_NOTFOUND )
426 : {
427 0 : ::sd::Window* pWin = mpViewSh->GetActiveWindow();
428 0 : SfxRequest aReq(SID_INSERTFILE, 0, mrDoc.GetItemPool());
429 0 : SfxStringItem aItem1( ID_VAL_DUMMY0, aCurrentDropFile ), aItem2( ID_VAL_DUMMY1, pFoundFilter->GetFilterName() );
430 :
431 0 : aReq.AppendItem( aItem1 );
432 0 : aReq.AppendItem( aItem2 );
433 0 : FuInsertFile::Create( mpViewSh, pWin, this, &mrDoc, aReq );
434 0 : bOK = sal_True;
435 0 : }
436 0 : }
437 : }
438 : }
439 :
440 0 : if( !bOK )
441 : {
442 0 : Size aPrefSize;
443 :
444 0 : if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) &&
445 0 : ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, true, &aPrefSize ) )
446 : {
447 0 : if( aPrefSize.Width() && aPrefSize.Height() )
448 : {
449 0 : ::sd::Window* pWin = mpViewSh->GetActiveWindow();
450 :
451 0 : if( pWin )
452 0 : aPrefSize = pWin->PixelToLogic( aPrefSize, MAP_100TH_MM );
453 : else
454 0 : aPrefSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
455 : }
456 : else
457 0 : aPrefSize = Size( 5000, 5000 );
458 :
459 0 : InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize, true ) ;
460 : }
461 0 : else if( mnAction & DND_ACTION_LINK )
462 0 : static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, String(), &maDropPos );
463 : else
464 : {
465 0 : if( mpViewSh )
466 : {
467 : try
468 : {
469 : //TODO/MBA: testing
470 0 : OUString aName;
471 0 : uno::Sequence < beans::PropertyValue > aMedium(1);
472 0 : aMedium[0].Name = "URL" ;
473 0 : aMedium[0].Value <<= OUString(aCurrentDropFile) ;
474 :
475 0 : uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().
476 0 : InsertEmbeddedObject( aMedium, aName );
477 :
478 0 : uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
479 0 : if ( xPersist.is())
480 : {
481 : // TODO/LEAN: VisualArea access can switch the object to running state
482 0 : sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
483 :
484 0 : xPersist->storeOwn();
485 :
486 0 : awt::Size aSz;
487 : try
488 : {
489 0 : aSz = xObj->getVisualAreaSize( nAspect );
490 : }
491 0 : catch( embed::NoVisualAreaSizeException& )
492 : {
493 : // the default size will be set later
494 : }
495 :
496 0 : Size aSize( aSz.Width, aSz.Height );
497 0 : Rectangle aRect;
498 :
499 0 : if (!aSize.Width() || !aSize.Height())
500 : {
501 0 : aSize.Width() = 1410;
502 0 : aSize.Height() = 1000;
503 : }
504 :
505 0 : aRect = Rectangle( maDropPos, aSize );
506 :
507 0 : SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
508 0 : sal_uLong nOptions = SDRINSERT_SETDEFLAYER;
509 :
510 0 : if (mpViewSh != NULL)
511 : {
512 : OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
513 : SfxInPlaceClient* pIpClient =
514 0 : mpViewSh->GetViewShell()->GetIPClient();
515 0 : if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
516 0 : nOptions |= SDRINSERT_DONTMARK;
517 : }
518 :
519 0 : InsertObjectAtView( pOleObj, *GetSdrPageView(), nOptions );
520 0 : pOleObj->SetLogicRect( aRect );
521 0 : aSz.Width = aRect.GetWidth();
522 0 : aSz.Height = aRect.GetHeight();
523 0 : xObj->setVisualAreaSize( nAspect,aSz );
524 0 : }
525 : }
526 0 : catch( uno::Exception& )
527 : {
528 0 : nError = ERRCODE_IO_GENERAL;
529 : // TODO/LATER: better error handling
530 : }
531 : }
532 : }
533 : }
534 :
535 0 : ++aIter;
536 0 : }
537 :
538 0 : if( nError )
539 0 : ErrorHandler::HandleError( nError );
540 :
541 0 : return nError;
542 : }
543 :
544 : /**
545 : * Timer handler for Errorhandling at Drop()
546 : */
547 0 : IMPL_LINK_NOARG(View, DropErrorHdl)
548 : {
549 0 : InfoBox( mpViewSh ? mpViewSh->GetActiveWindow() : 0, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
550 0 : return 0;
551 : }
552 :
553 : /**
554 : * @returns StyleSheet from selection
555 : */
556 2 : SfxStyleSheet* View::GetStyleSheet() const
557 : {
558 2 : return SdrView::GetStyleSheet();
559 : }
560 :
561 33 : } // end of namespace sd
562 :
563 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|