xref: /trunk/main/sd/source/ui/view/sdview4.cxx (revision 70d3707a)
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 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sd.hxx"
26 
27 #include "View.hxx"
28 #include <unotools/localfilehelper.hxx>
29 #include <sfx2/request.hxx>
30 #include <sfx2/docfilt.hxx>
31 #include <sfx2/fcontnr.hxx>
32 #include <sfx2/docfile.hxx>
33 #include <vcl/msgbox.hxx>
34 #include <svl/urlbmk.hxx>
35 #include <svx/svdpagv.hxx>
36 #include <svx/xfillit.hxx>
37 #include <svx/svdundo.hxx>
38 #include <svx/xoutbmp.hxx>
39 #include <svx/svdograf.hxx>
40 #include <svx/svdomedia.hxx>
41 #include <svx/svdoole2.hxx>
42 #include <sot/storage.hxx>
43 #include <sfx2/app.hxx>
44 #include <avmedia/mediawindow.hxx>
45 #include <svtools/ehdl.hxx>
46 #include <svtools/sfxecode.hxx>
47 #include <svtools/filter.hxx>
48 #include "app.hrc"
49 #include "Window.hxx"
50 #include "DrawDocShell.hxx"
51 #include "DrawViewShell.hxx"
52 #include "fuinsfil.hxx"
53 #include "drawdoc.hxx"
54 #include "sdresid.hxx"
55 #include "strings.hrc"
56 #include "imapinfo.hxx"
57 #include "sdpage.hxx"
58 #include "view/SlideSorterView.hxx"
59 #include "undo/undoobjects.hxx"
60 
61 #include <comphelper/processfactory.hxx>
62 #include <com/sun/star/embed/ElementModes.hpp>
63 #include <com/sun/star/embed/XEmbedPersist.hpp>
64 #include <com/sun/star/embed/Aspects.hpp>
65 #include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
66 #include <svtools/soerr.hxx>
67 
68 #include <sfx2/ipclient.hxx>
69 
70 using namespace com::sun::star;
71 
72 namespace sd {
73 
74 #ifdef _MSC_VER
75 #pragma optimize ( "", off )
76 #endif
77 
78 /*************************************************************************
79 |*
80 |* Graphik einfuegen
81 |* Wird ein leeres Graphikobjekt uebergeben, so wird dieses gefuellt.
82 |* Andernfalls wird ein an der gegebenen Position vorhandenes Objekt
83 |* gefuellt. Ist an der Position kein Objekt vorhanden, so wird ein neues
84 |* Objekt erzeugt und ein Pointer auf dieses Objekt zurueckgegeben.
85 |*
86 \************************************************************************/
87 
88 SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
89 								   const Point& rPos, SdrObject* pObj, ImageMap* pImageMap )
90 {
91 	SdrEndTextEdit();
92 	mnAction = rAction;
93 
94 	// Liegt ein Objekt an der Position rPos?
95 	SdrGrafObj*		pNewGrafObj = NULL;
96 	SdrPageView*	pPV = GetSdrPageView();
97 	SdrObject*		pPickObj = pObj;
98 	const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
99 
100 	if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView))
101 	{
102 		if(!pPV->GetPageRect().IsInside(rPos))
103 			pPV = 0L;
104 	}
105 
106 	if( !pPickObj && pPV )
107 	{
108 		SdrPageView* pPageView = pPV;
109 		PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
110 	}
111 
112 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
113 	{
114 		const bool bIsGraphic = pPickObj->ISA( SdrGrafObj );
115 		if( bIsGraphic || (pObj->IsEmptyPresObj() && !bOnMaster) )
116 		{
117 			if( IsUndoEnabled() )
118 				BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
119 
120 			SdPage* pPage = (SdPage*) pPickObj->GetPage();
121 
122 			if( bIsGraphic )
123 			{
124 				// Das Objekt wird mit der Bitmap gefuellt
125 				pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
126 				pNewGrafObj->SetGraphic(rGraphic);
127 			}
128 			else
129 			{
130 				pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
131 				pNewGrafObj->SetEmptyPresObj(sal_True);
132 			}
133 
134 			if ( pNewGrafObj->IsEmptyPresObj() )
135 			{
136 				Rectangle aRect( pNewGrafObj->GetLogicRect() );
137 				pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
138 				pNewGrafObj->SetOutlinerParaObject(NULL);
139 				pNewGrafObj->SetEmptyPresObj(sal_False);
140 			}
141 
142 			if (pPage && pPage->IsPresObj(pPickObj))
143 			{
144 				// Neues PresObj in die Liste eintragen
145 				pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
146 				pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
147 			}
148 
149 			if (pImageMap)
150 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
151 
152 			ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
153 
154 			if( IsUndoEnabled() )
155 				EndUndo();
156 		}
157 		else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj))
158 		{
159 			/******************************************************************
160 			* Das Objekt wird mit der Graphik gefuellt
161 			******************************************************************/
162 			if( IsUndoEnabled() )
163 			{
164 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
165 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
166 				EndUndo();
167 			}
168 
169 			SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
170 			aSet.Put(XFillStyleItem(XFILL_BITMAP));
171 			aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
172 			pPickObj->SetMergedItemSetAndBroadcast(aSet);
173 		}
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