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