xref: /aoo41x/main/sd/source/ui/view/sdview4.cxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sd.hxx"
30 
31 #include "View.hxx"
32 #include <unotools/localfilehelper.hxx>
33 #include <sfx2/request.hxx>
34 #include <sfx2/docfilt.hxx>
35 #include <sfx2/fcontnr.hxx>
36 #include <sfx2/docfile.hxx>
37 #include <vcl/msgbox.hxx>
38 #include <svl/urlbmk.hxx>
39 #include <svx/svdpagv.hxx>
40 #include <svx/xfillit.hxx>
41 #include <svx/svdundo.hxx>
42 #include <svx/xoutbmp.hxx>
43 #include <svx/svdograf.hxx>
44 #include <svx/svdomedia.hxx>
45 #include <svx/svdoole2.hxx>
46 #include <sot/storage.hxx>
47 #include <sfx2/app.hxx>
48 #include <avmedia/mediawindow.hxx>
49 #include <svtools/ehdl.hxx>
50 #include <svtools/sfxecode.hxx>
51 #include <svtools/filter.hxx>
52 #include "app.hrc"
53 #include "Window.hxx"
54 #include "DrawDocShell.hxx"
55 #include "DrawViewShell.hxx"
56 #include "fuinsfil.hxx"
57 #include "drawdoc.hxx"
58 #include "sdresid.hxx"
59 #include "strings.hrc"
60 #include "imapinfo.hxx"
61 #include "sdpage.hxx"
62 #include "view/SlideSorterView.hxx"
63 #include "undo/undoobjects.hxx"
64 
65 #include <comphelper/processfactory.hxx>
66 #include <com/sun/star/embed/ElementModes.hpp>
67 #include <com/sun/star/embed/XEmbedPersist.hpp>
68 #include <com/sun/star/embed/Aspects.hpp>
69 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
70 #include <svtools/soerr.hxx>
71 
72 #include <sfx2/ipclient.hxx>
73 
74 using namespace com::sun::star;
75 
76 namespace sd {
77 
78 #ifdef _MSC_VER
79 #pragma optimize ( "", off )
80 #endif
81 
82 /*************************************************************************
83 |*
84 |* Graphik einfuegen
85 |* Wird ein leeres Graphikobjekt uebergeben, so wird dieses gefuellt.
86 |* Andernfalls wird ein an der gegebenen Position vorhandenes Objekt
87 |* gefuellt. Ist an der Position kein Objekt vorhanden, so wird ein neues
88 |* Objekt erzeugt und ein Pointer auf dieses Objekt zurueckgegeben.
89 |*
90 \************************************************************************/
91 
92 SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
93 								   const Point& rPos, SdrObject* pObj, ImageMap* pImageMap )
94 {
95 	SdrEndTextEdit();
96 	mnAction = rAction;
97 
98 	// Liegt ein Objekt an der Position rPos?
99 	SdrGrafObj*		pNewGrafObj = NULL;
100 	SdrPageView*	pPV = GetSdrPageView();
101 	SdrObject*		pPickObj = pObj;
102 	const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
103 
104 	if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView))
105 	{
106 		if(!pPV->GetPageRect().IsInside(rPos))
107 			pPV = 0L;
108 	}
109 
110 	if( !pPickObj && pPV )
111 	{
112 		SdrPageView* pPageView = pPV;
113 		PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
114 	}
115 
116 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
117 	{
118 		const bool bIsGraphic = pPickObj->ISA( SdrGrafObj );
119 		if( bIsGraphic || (pObj->IsEmptyPresObj() && !bOnMaster) )
120 		{
121 			if( IsUndoEnabled() )
122 				BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
123 
124 			SdPage* pPage = (SdPage*) pPickObj->GetPage();
125 
126 			if( bIsGraphic )
127 			{
128 				// Das Objekt wird mit der Bitmap gefuellt
129 				pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
130 				pNewGrafObj->SetGraphic(rGraphic);
131 			}
132 			else
133 			{
134 				pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
135 				pNewGrafObj->SetEmptyPresObj(sal_True);
136 			}
137 
138 			if ( pNewGrafObj->IsEmptyPresObj() )
139 			{
140 				Rectangle aRect( pNewGrafObj->GetLogicRect() );
141 				pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
142 				pNewGrafObj->SetOutlinerParaObject(NULL);
143 				pNewGrafObj->SetEmptyPresObj(sal_False);
144 			}
145 
146 			if (pPage && pPage->IsPresObj(pPickObj))
147 			{
148 				// Neues PresObj in die Liste eintragen
149 				pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
150 				pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
151 			}
152 
153 			if (pImageMap)
154 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
155 
156 			ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
157 
158 			if( IsUndoEnabled() )
159 				EndUndo();
160 		}
161 		else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj))
162 		{
163 			/******************************************************************
164 			* Das Objekt wird mit der Graphik gefuellt
165 			******************************************************************/
166 			if( IsUndoEnabled() )
167 			{
168 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
169 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
170 				EndUndo();
171 			}
172 
173 			XOBitmap aXOBitmap( rGraphic.GetBitmap() );
174 			SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
175 			aSet.Put(XFillStyleItem(XFILL_BITMAP));
176 			aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), aXOBitmap));
177 			pPickObj->SetMergedItemSetAndBroadcast(aSet);
178 		}
179 	}
180 	else if ( pPV )
181 	{
182 		// create  new object
183 		Size aSize;
184 
185 		if ( rGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
186 		{
187 			::OutputDevice* pOutDev = 0;
188 			if( mpViewSh )
189 				pOutDev = mpViewSh->GetActiveWindow();
190 
191 			if( !pOutDev )
192 				pOutDev = Application::GetDefaultDevice();
193 
194 			if( pOutDev )
195 				aSize = pOutDev->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM );
196 		}
197 		else
198 		{
199 			aSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
200 											    rGraphic.GetPrefMapMode(),
201 											    MapMode( MAP_100TH_MM ) );
202 		}
203 
204 		pNewGrafObj = new SdrGrafObj( rGraphic, Rectangle( rPos, aSize ) );
205 		SdrPage* pPage = pPV->GetPage();
206 		Size aPageSize( pPage->GetSize() );
207 		aPageSize.Width()  -= pPage->GetLftBorder() + pPage->GetRgtBorder();
208 		aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
209 		pNewGrafObj->AdjustToMaxRect( Rectangle( Point(), aPageSize ), sal_True );
210 //		pNewGrafObj->AdjustToMaxRect( Rectangle( pPV->GetOffset(), aPageSize ), sal_True );
211 
212 		sal_uLong	nOptions = SDRINSERT_SETDEFLAYER;
213 		sal_Bool	bIsPresTarget = sal_False;
214 
215         if ((mpViewSh
216                 && mpViewSh->GetViewShell()!=NULL
217                 && mpViewSh->GetViewShell()->GetIPClient()
218                 && mpViewSh->GetViewShell()->GetIPClient()->IsObjectInPlaceActive())
219             || this->ISA(::sd::slidesorter::view::SlideSorterView))
220 			nOptions |= SDRINSERT_DONTMARK;
221 
222 		if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
223 		{
224 			SdPage* pP = static_cast< SdPage* >( pPickObj->GetPage() );
225 
226 			if ( pP && pP->IsMasterPage() )
227 				bIsPresTarget = pP->IsPresObj(pPickObj);
228 		}
229 
230 		if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
231 		{
232 			// replace object
233 			if (pImageMap)
234 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
235 
236 			Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
237 			Size aPickObjSize(aPickObjRect.GetSize());
238 			Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
239 			Size aObjSize(aObjRect.GetSize());
240 
241 			Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
242 			Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
243 			pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
244 
245 			Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
246 			pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y()));
247 
248 			const bool bUndo = IsUndoEnabled();
249 
250 			if( bUndo )
251 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
252 			pNewGrafObj->NbcSetLayer(pPickObj->GetLayer());
253 			SdrPage* pP = pPV->GetPage();
254 			pP->InsertObject(pNewGrafObj);
255 			if( bUndo )
256 			{
257 				AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj));
258 				AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj));
259 			}
260 			pP->RemoveObject(pPickObj->GetOrdNum());
261 
262 			if( bUndo )
263 			{
264 				EndUndo();
265 			}
266 			else
267 			{
268 				SdrObject::Free(pPickObj);
269 			}
270 			mnAction = DND_ACTION_COPY;
271 		}
272 		else
273 		{
274 			InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
275 
276 			if( pImageMap )
277 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
278 		}
279 	}
280 
281 	rAction = mnAction;
282 
283 	return pNewGrafObj;
284 }
285 
286 // -----------------------------------------------------------------------------
287 
288 SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
289 								   const Point& rPos, const Size& rSize )
290 {
291 	SdrEndTextEdit();
292 	mnAction = rAction;
293 
294 	SdrMediaObj*	pNewMediaObj = NULL;
295 	SdrPageView*	pPV = GetSdrPageView();
296 	SdrObject*		pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA );
297 
298 	if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView ))
299 	{
300 		if(!pPV->GetPageRect().IsInside(rPos))
301 			pPV = 0L;
302 	}
303 
304 	if( !pPickObj && pPV )
305 	{
306 		SdrPageView* pPageView = pPV;
307 		PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
308 	}
309 
310 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) )
311 	{
312 		pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
313 		pNewMediaObj->setURL( rMediaURL );
314 
315     	BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
316 		ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
317 		EndUndo();
318 	}
319 	else if( pPV )
320 	{
321 		Rectangle aRect( rPos, rSize );
322 		if( pPickObj )
323 			aRect = pPickObj->GetLogicRect();
324 
325 
326     	pNewMediaObj = new SdrMediaObj( aRect );
327 
328 		bool bIsPres = false;
329 		if( pPickObj )
330 		{
331 			SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
332 			bIsPres = pPage && pPage->IsPresObj(pPickObj);
333 			if( bIsPres )
334 			{
335 				pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA );
336 			}
337 		}
338 
339 		if( pPickObj )
340 			ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
341 		else
342 			InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER );
343 
344 	    pNewMediaObj->setURL( rMediaURL );
345 
346 		if( pPickObj )
347 		{
348 			pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() );
349 			if( bIsPres )
350 				pNewMediaObj->SetUserCall(pPickObj->GetUserCall());
351 		}
352 	}
353 
354 	rAction = mnAction;
355 
356 	return pNewMediaObj;
357 }
358 
359 /*************************************************************************
360 |*
361 |* Timer-Handler fuer InsertFile beim Drop()
362 |*
363 \************************************************************************/
364 
365 IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG )
366 {
367 	DBG_ASSERT( mpViewSh, "sd::View::DropInsertFileHdl(), I need a view shell to work!" );
368 	if( !mpViewSh )
369 		return 0;
370 
371     SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX );
372     ErrCode nError = 0;
373 
374 	::std::vector< String >::const_iterator aIter( maDropFileVector.begin() );
375 
376     while( (aIter != maDropFileVector.end()) && !nError )
377     {
378 	    String          aCurrentDropFile( *aIter );
379         INetURLObject   aURL( aCurrentDropFile );
380 	    sal_Bool		    bOK = sal_False;
381 
382 	    if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
383 	    {
384 		    String aURLStr;
385 		    ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aCurrentDropFile, aURLStr );
386 		    aURL = INetURLObject( aURLStr );
387 	    }
388 
389         GraphicFilter*  pGraphicFilter = GraphicFilter::GetGraphicFilter();
390 	    Graphic			aGraphic;
391 
392         aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
393 
394 		if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) )
395 		{
396 			if( !pGraphicFilter->ImportGraphic( aGraphic, aURL ) )
397 			{
398 				sal_Int8    nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
399 				const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 );
400 				SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
401 
402 				if( pGrafObj && bLink )
403 					pGrafObj->SetGraphicLink( aCurrentDropFile, String() );
404 
405 				// return action from first inserted graphic
406 				if( aIter == maDropFileVector.begin() )
407 					mnAction = nTempAction;
408 
409 				bOK = sal_True;
410 			}
411 			if( !bOK )
412 			{
413     			const SfxFilter*        pFoundFilter = NULL;
414 				SfxMedium	            aSfxMedium( aCurrentDropFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_False );
415 				ErrCode		            nErr = SFX_APP()->GetFilterMatcher().GuessFilter(  aSfxMedium, &pFoundFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
416 
417 				if( pFoundFilter && !nErr )
418 				{
419 					::std::vector< String > aFilterVector;
420 					const String	        aFilterName( pFoundFilter->GetFilterName() );
421 					String	        		aLowerAsciiFileName( aCurrentDropFile );
422 					aLowerAsciiFileName.ToLowerAscii();
423 
424 					FuInsertFile::GetSupportedFilterVector( aFilterVector );
425 
426 					if( ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFoundFilter->GetMimeType() ) != aFilterVector.end() ) ||
427 						aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
428 						aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
429 						aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
430 						aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ||
431 						aLowerAsciiFileName.SearchAscii(".sdd") != STRING_NOTFOUND ||
432 						aLowerAsciiFileName.SearchAscii(".sda") != STRING_NOTFOUND ||
433 						aLowerAsciiFileName.SearchAscii(".sxd") != STRING_NOTFOUND ||
434 						aLowerAsciiFileName.SearchAscii(".sxi") != STRING_NOTFOUND ||
435 						aLowerAsciiFileName.SearchAscii(".std") != STRING_NOTFOUND ||
436 						aLowerAsciiFileName.SearchAscii(".sti") != STRING_NOTFOUND )
437 					{
438 						::sd::Window* pWin = mpViewSh->GetActiveWindow();
439 						SfxRequest      aReq(SID_INSERTFILE, 0, mpDoc->GetItemPool());
440 						SfxStringItem   aItem1( ID_VAL_DUMMY0, aCurrentDropFile ), aItem2( ID_VAL_DUMMY1, pFoundFilter->GetFilterName() );
441 
442 						aReq.AppendItem( aItem1 );
443 						aReq.AppendItem( aItem2 );
444 						FuInsertFile::Create( mpViewSh, pWin, this, mpDoc, aReq );
445 						bOK = sal_True;
446 					}
447 				}
448 			}
449 		}
450 
451 	    if( !bOK )
452 	    {
453 	        Size aPrefSize;
454 
455 	        if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) &&
456 	            ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, true, &aPrefSize ) )
457 	        {
458 			    if( aPrefSize.Width() && aPrefSize.Height() )
459 			    {
460 					::sd::Window* pWin = mpViewSh->GetActiveWindow();
461 
462 				    if( pWin )
463 					    aPrefSize = pWin->PixelToLogic( aPrefSize, MAP_100TH_MM );
464 				    else
465 					    aPrefSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
466 			    }
467 			    else
468 				    aPrefSize  = Size( 5000, 5000 );
469 
470     		    InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize ) ;
471 	        }
472 	        else if( mnAction & DND_ACTION_LINK )
473 			    static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, String(), &maDropPos );
474 		    else
475 		    {
476 			    if( mpViewSh )
477 			    {
478 					try
479 					{
480 						//TODO/MBA: testing
481 						::rtl::OUString aName;
482 						uno::Sequence < beans::PropertyValue > aMedium(1);
483 						aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
484 						aMedium[0].Value <<= ::rtl::OUString( aCurrentDropFile );
485 
486 						uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().
487 								InsertEmbeddedObject( aMedium, aName );
488 
489 						uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
490 						if ( xPersist.is())
491 						{
492 							// TODO/LEAN: VisualArea access can switch the object to running state
493 							sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
494 
495 							xPersist->storeOwn();
496 
497 							awt::Size aSz;
498 							try
499 							{
500 								aSz = xObj->getVisualAreaSize( nAspect );
501 							}
502 							catch( embed::NoVisualAreaSizeException& )
503 							{
504 								// the default size will be set later
505 							}
506 
507 							Size        aSize( aSz.Width, aSz.Height );
508 							Rectangle   aRect;
509 
510 							if (!aSize.Width() || !aSize.Height())
511 							{
512 								aSize.Width()   = 1410;
513 								aSize.Height()  = 1000;
514 							}
515 
516 							aRect = Rectangle( maDropPos, aSize );
517 
518 							SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
519 							sal_uLong       nOptions = SDRINSERT_SETDEFLAYER;
520 
521 							if (mpViewSh != NULL)
522 							{
523 								OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
524 								SfxInPlaceClient* pIpClient =
525 									mpViewSh->GetViewShell()->GetIPClient();
526 								if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
527 									nOptions |= SDRINSERT_DONTMARK;
528 							}
529 
530 							InsertObjectAtView( pOleObj, *GetSdrPageView(), nOptions );
531 							pOleObj->SetLogicRect( aRect );
532 							aSz.Width = aRect.GetWidth();
533 							aSz.Height = aRect.GetHeight();
534 							xObj->setVisualAreaSize( nAspect,aSz );
535 						}
536 					}
537 					catch( uno::Exception& )
538 					{
539 						nError = ERRCODE_IO_GENERAL;
540 						// TODO/LATER: better error handling
541 					}
542 				}
543 		    }
544 	    }
545 
546         ++aIter;
547     }
548 
549     if( nError )
550         ErrorHandler::HandleError( nError );
551 
552     return nError;
553 }
554 
555 /*************************************************************************
556 |*
557 |* Timer-Handler fuer Errorhandling beim Drop()
558 |*
559 \************************************************************************/
560 
561 IMPL_LINK( View, DropErrorHdl, Timer*, EMPTYARG )
562 {
563 	InfoBox( mpViewSh ? mpViewSh->GetActiveWindow() : 0, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
564 	return 0;
565 }
566 
567 #ifdef _MSC_VER
568 #pragma optimize ( "", on )
569 #endif
570 
571 /*************************************************************************
572 |*
573 |* Redraw sperren oder erlauben
574 |*
575 \************************************************************************/
576 
577 void View::LockRedraw(sal_Bool bLock)
578 {
579 	if (bLock)
580 	{
581 		mnLockRedrawSmph++;
582 		DBG_ASSERT(mnLockRedrawSmph, "Ueberlauf im LockRedraw");
583 	}
584 	else
585 	{
586 		DBG_ASSERT(mnLockRedrawSmph, "Unterlauf im LockRedraw");
587 		mnLockRedrawSmph--;
588 
589 		// alle gespeicherten Redraws ausfuehren
590 		if (!mnLockRedrawSmph)
591 		{
592 			while (mpLockedRedraws && mpLockedRedraws->Count())
593 			{
594 				SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
595 				OutputDevice* pCurrentOut = pRec->mpOut;
596 				Rectangle aBoundRect(pRec->aRect);
597 				mpLockedRedraws->Remove(pRec);
598 				delete pRec;
599 
600 				pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
601 				while (pRec)
602 				{
603 					if (pRec->mpOut == pCurrentOut)
604 					{
605 						aBoundRect.Union(pRec->aRect);
606 						mpLockedRedraws->Remove(pRec);
607 						delete pRec;
608 						pRec = (SdViewRedrawRec*)mpLockedRedraws->GetCurObject();
609 					}
610 					else
611 					{
612 						pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
613 					}
614 				}
615 
616 				CompleteRedraw(pCurrentOut, Region(aBoundRect));
617 			}
618 			delete mpLockedRedraws;
619 			mpLockedRedraws = NULL;
620 		}
621 	}
622 }
623 
624 
625 
626 
627 /*************************************************************************
628 |*
629 |* StyleSheet aus der Sleketion besorgen
630 |*
631 \************************************************************************/
632 
633 SfxStyleSheet* View::GetStyleSheet() const
634 {
635 	return SdrView::GetStyleSheet();
636 }
637 
638 } // end of namespace sd
639