xref: /aoo42x/main/sd/source/ui/view/sdview4.cxx (revision 17e8bc19)
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 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
111 	{
112 		const bool bIsGraphic(0 != dynamic_cast< SdrGrafObj* >(pPickObj));
113 
114         if(bIsGraphic || (pPickObj->IsEmptyPresObj() && !bOnMaster)) // #121603# Do not use pObj, it may be NULL
115 		{
116 			if( IsUndoEnabled() )
117 				BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
118 
119 			SdPage* pPage = (SdPage*) pPickObj->GetPage();
120 
121 			if( bIsGraphic )
122 			{
123 				// Das Objekt wird mit der Bitmap gefuellt
124 				pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
125 				pNewGrafObj->SetGraphic(rGraphic);
126 			}
127 			else
128 			{
129 				pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
130 				pNewGrafObj->SetEmptyPresObj(sal_True);
131 			}
132 
133 			if ( pNewGrafObj->IsEmptyPresObj() )
134 			{
135 				Rectangle aRect( pNewGrafObj->GetLogicRect() );
136 				pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
137 				pNewGrafObj->SetOutlinerParaObject(NULL);
138 				pNewGrafObj->SetEmptyPresObj(sal_False);
139 			}
140 
141 			if (pPage && pPage->IsPresObj(pPickObj))
142 			{
143 				// Neues PresObj in die Liste eintragen
144 				pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
145 				pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
146 			}
147 
148 			if (pImageMap)
149 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
150 
151 			ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
152 
153 			if( IsUndoEnabled() )
154 				EndUndo();
155 		}
156 		else if(pPickObj->IsClosedObj())
157 		{
158             // fill object with graphic
159 			if( IsUndoEnabled() )
160 			{
161 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
162 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
163 				EndUndo();
164 			}
165 
166 			SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
167 			aSet.Put(XFillStyleItem(XFILL_BITMAP));
168 			aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
169 			pPickObj->SetMergedItemSetAndBroadcast(aSet);
170 		}
171 	}
172 	else if ( pPV )
173 	{
174 		// create  new object
175 		Size aSize;
176 
177 		if ( rGraphic.GetPrefMapMode().GetMapUnit() == MAP_PIXEL )
178 		{
179 			::OutputDevice* pOutDev = 0;
180 			if( mpViewSh )
181 				pOutDev = mpViewSh->GetActiveWindow();
182 
183 			if( !pOutDev )
184 				pOutDev = Application::GetDefaultDevice();
185 
186 			if( pOutDev )
187 				aSize = pOutDev->PixelToLogic( rGraphic.GetPrefSize(), MAP_100TH_MM );
188 		}
189 		else
190 		{
191 			aSize = OutputDevice::LogicToLogic( rGraphic.GetPrefSize(),
192 											    rGraphic.GetPrefMapMode(),
193 											    MapMode( MAP_100TH_MM ) );
194 		}
195 
196 		pNewGrafObj = new SdrGrafObj( rGraphic, Rectangle( rPos, aSize ) );
197 		SdrPage* pPage = pPV->GetPage();
198 		Size aPageSize( pPage->GetSize() );
199 		aPageSize.Width()  -= pPage->GetLftBorder() + pPage->GetRgtBorder();
200 		aPageSize.Height() -= pPage->GetUppBorder() + pPage->GetLwrBorder();
201 		pNewGrafObj->AdjustToMaxRect( Rectangle( Point(), aPageSize ), sal_True );
202 //		pNewGrafObj->AdjustToMaxRect( Rectangle( pPV->GetOffset(), aPageSize ), sal_True );
203 
204 		sal_uLong	nOptions = SDRINSERT_SETDEFLAYER;
205 		sal_Bool	bIsPresTarget = sal_False;
206 
207         if ((mpViewSh
208                 && mpViewSh->GetViewShell()!=NULL
209                 && mpViewSh->GetViewShell()->GetIPClient()
210                 && mpViewSh->GetViewShell()->GetIPClient()->IsObjectInPlaceActive())
211             || this->ISA(::sd::slidesorter::view::SlideSorterView))
212 			nOptions |= SDRINSERT_DONTMARK;
213 
214 		if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && (pPickObj->IsEmptyPresObj() || pPickObj->GetUserCall()) )
215 		{
216 			SdPage* pP = static_cast< SdPage* >( pPickObj->GetPage() );
217 
218 			if ( pP && pP->IsMasterPage() )
219 				bIsPresTarget = pP->IsPresObj(pPickObj);
220 		}
221 
222 		if( ( mnAction & DND_ACTION_MOVE ) && pPickObj && !bIsPresTarget )
223 		{
224 			// replace object
225 			if (pImageMap)
226 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
227 
228 			Rectangle aPickObjRect(pPickObj->GetCurrentBoundRect());
229 			Size aPickObjSize(aPickObjRect.GetSize());
230 			Rectangle aObjRect(pNewGrafObj->GetCurrentBoundRect());
231 			Size aObjSize(aObjRect.GetSize());
232 
233 			Fraction aScaleWidth(aPickObjSize.Width(), aObjSize.Width());
234 			Fraction aScaleHeight(aPickObjSize.Height(), aObjSize.Height());
235 			pNewGrafObj->NbcResize(aObjRect.TopLeft(), aScaleWidth, aScaleHeight);
236 
237 			Point aVec = aPickObjRect.TopLeft() - aObjRect.TopLeft();
238 			pNewGrafObj->NbcMove(Size(aVec.X(), aVec.Y()));
239 
240 			const bool bUndo = IsUndoEnabled();
241 
242 			if( bUndo )
243 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
244 			pNewGrafObj->NbcSetLayer(pPickObj->GetLayer());
245 			SdrPage* pP = pPV->GetPage();
246 			pP->InsertObject(pNewGrafObj);
247 			if( bUndo )
248 			{
249 				AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoNewObject(*pNewGrafObj));
250 				AddUndo(mpDoc->GetSdrUndoFactory().CreateUndoDeleteObject(*pPickObj));
251 			}
252 			pP->RemoveObject(pPickObj->GetOrdNum());
253 
254 			if( bUndo )
255 			{
256 				EndUndo();
257 			}
258 			else
259 			{
260 				SdrObject::Free(pPickObj);
261 			}
262 			mnAction = DND_ACTION_COPY;
263 		}
264 		else
265 		{
266 			InsertObjectAtView(pNewGrafObj, *pPV, nOptions);
267 
268 			if( pImageMap )
269 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
270 		}
271 	}
272 
273 	rAction = mnAction;
274 
275 	return pNewGrafObj;
276 }
277 
278 // -----------------------------------------------------------------------------
279 
280 SdrMediaObj* View::InsertMediaURL( const rtl::OUString& rMediaURL, sal_Int8& rAction,
281 								   const Point& rPos, const Size& rSize )
282 {
283 	SdrEndTextEdit();
284 	mnAction = rAction;
285 
286 	SdrMediaObj*	pNewMediaObj = NULL;
287 	SdrPageView*	pPV = GetSdrPageView();
288 	SdrObject*		pPickObj = GetEmptyPresentationObject( PRESOBJ_MEDIA );
289 
290 	if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView ))
291 	{
292 		if(!pPV->GetPageRect().IsInside(rPos))
293 			pPV = 0L;
294 	}
295 
296 	if( !pPickObj && pPV )
297 	{
298 		SdrPageView* pPageView = pPV;
299 		PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
300 	}
301 
302 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV && pPickObj->ISA( SdrMediaObj ) )
303 	{
304 		pNewMediaObj = static_cast< SdrMediaObj* >( pPickObj->Clone() );
305 		pNewMediaObj->setURL( rMediaURL );
306 
307     	BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
308 		ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
309 		EndUndo();
310 	}
311 	else if( pPV )
312 	{
313 		Rectangle aRect( rPos, rSize );
314 		if( pPickObj )
315 			aRect = pPickObj->GetLogicRect();
316 
317 
318     	pNewMediaObj = new SdrMediaObj( aRect );
319 
320 		bool bIsPres = false;
321 		if( pPickObj )
322 		{
323 			SdPage* pPage = static_cast< SdPage* >(pPickObj->GetPage());
324 			bIsPres = pPage && pPage->IsPresObj(pPickObj);
325 			if( bIsPres )
326 			{
327 				pPage->InsertPresObj( pNewMediaObj, PRESOBJ_MEDIA );
328 			}
329 		}
330 
331 		if( pPickObj )
332 			ReplaceObjectAtView(pPickObj, *pPV, pNewMediaObj);
333 		else
334 			InsertObjectAtView( pNewMediaObj, *pPV, SDRINSERT_SETDEFLAYER );
335 
336 	    pNewMediaObj->setURL( rMediaURL );
337 
338 		if( pPickObj )
339 		{
340 			pNewMediaObj->AdjustToMaxRect( pPickObj->GetLogicRect() );
341 			if( bIsPres )
342 				pNewMediaObj->SetUserCall(pPickObj->GetUserCall());
343 		}
344 	}
345 
346 	rAction = mnAction;
347 
348 	return pNewMediaObj;
349 }
350 
351 /*************************************************************************
352 |*
353 |* Timer-Handler fuer InsertFile beim Drop()
354 |*
355 \************************************************************************/
356 
357 IMPL_LINK( View, DropInsertFileHdl, Timer*, EMPTYARG )
358 {
359 	DBG_ASSERT( mpViewSh, "sd::View::DropInsertFileHdl(), I need a view shell to work!" );
360 	if( !mpViewSh )
361 		return 0;
362 
363     SfxErrorContext aEc( ERRCTX_ERROR, mpViewSh->GetActiveWindow(), RID_SO_ERRCTX );
364     ErrCode nError = 0;
365 
366 	::std::vector< String >::const_iterator aIter( maDropFileVector.begin() );
367 
368     while( (aIter != maDropFileVector.end()) && !nError )
369     {
370 	    String          aCurrentDropFile( *aIter );
371         INetURLObject   aURL( aCurrentDropFile );
372 	    sal_Bool		    bOK = sal_False;
373 
374 	    if( aURL.GetProtocol() == INET_PROT_NOT_VALID )
375 	    {
376 		    String aURLStr;
377 		    ::utl::LocalFileHelper::ConvertPhysicalNameToURL( aCurrentDropFile, aURLStr );
378 		    aURL = INetURLObject( aURLStr );
379 	    }
380 
381         GraphicFilter*  pGraphicFilter = GraphicFilter::GetGraphicFilter();
382 	    Graphic			aGraphic;
383 
384         aCurrentDropFile = aURL.GetMainURL( INetURLObject::NO_DECODE );
385 
386 		if( !::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) )
387 		{
388 			if( !pGraphicFilter->ImportGraphic( aGraphic, aURL ) )
389 			{
390 				sal_Int8    nTempAction = ( aIter == maDropFileVector.begin() ) ? mnAction : 0;
391 				const bool bLink = ( ( nTempAction & DND_ACTION_LINK ) != 0 );
392 				SdrGrafObj* pGrafObj = InsertGraphic( aGraphic, nTempAction, maDropPos, NULL, NULL );
393 
394 				if(pGrafObj && bLink)
395                 {
396     				pGrafObj->SetGraphicLink( aCurrentDropFile, String() );
397                 }
398 
399 				// return action from first inserted graphic
400 				if( aIter == maDropFileVector.begin() )
401 					mnAction = nTempAction;
402 
403 				bOK = sal_True;
404 			}
405 			if( !bOK )
406 			{
407     			const SfxFilter*        pFoundFilter = NULL;
408 				SfxMedium	            aSfxMedium( aCurrentDropFile, STREAM_READ | STREAM_SHARE_DENYNONE, sal_False );
409 				ErrCode		            nErr = SFX_APP()->GetFilterMatcher().GuessFilter(  aSfxMedium, &pFoundFilter, SFX_FILTER_IMPORT, SFX_FILTER_NOTINSTALLED | SFX_FILTER_EXECUTABLE );
410 
411 				if( pFoundFilter && !nErr )
412 				{
413 					::std::vector< String > aFilterVector;
414 					const String	        aFilterName( pFoundFilter->GetFilterName() );
415 					String	        		aLowerAsciiFileName( aCurrentDropFile );
416 					aLowerAsciiFileName.ToLowerAscii();
417 
418 					FuInsertFile::GetSupportedFilterVector( aFilterVector );
419 
420 					if( ( ::std::find( aFilterVector.begin(), aFilterVector.end(), pFoundFilter->GetMimeType() ) != aFilterVector.end() ) ||
421 						aFilterName.SearchAscii( "Text" ) != STRING_NOTFOUND ||
422 						aFilterName.SearchAscii( "Rich" ) != STRING_NOTFOUND ||
423 						aFilterName.SearchAscii( "RTF" ) != STRING_NOTFOUND ||
424 						aFilterName.SearchAscii( "HTML" ) != STRING_NOTFOUND ||
425 						aLowerAsciiFileName.SearchAscii(".sdd") != STRING_NOTFOUND ||
426 						aLowerAsciiFileName.SearchAscii(".sda") != STRING_NOTFOUND ||
427 						aLowerAsciiFileName.SearchAscii(".sxd") != STRING_NOTFOUND ||
428 						aLowerAsciiFileName.SearchAscii(".sxi") != STRING_NOTFOUND ||
429 						aLowerAsciiFileName.SearchAscii(".std") != STRING_NOTFOUND ||
430 						aLowerAsciiFileName.SearchAscii(".sti") != STRING_NOTFOUND )
431 					{
432 						::sd::Window* pWin = mpViewSh->GetActiveWindow();
433 						SfxRequest      aReq(SID_INSERTFILE, 0, mpDoc->GetItemPool());
434 						SfxStringItem   aItem1( ID_VAL_DUMMY0, aCurrentDropFile ), aItem2( ID_VAL_DUMMY1, pFoundFilter->GetFilterName() );
435 
436 						aReq.AppendItem( aItem1 );
437 						aReq.AppendItem( aItem2 );
438 						FuInsertFile::Create( mpViewSh, pWin, this, mpDoc, aReq );
439 						bOK = sal_True;
440 					}
441 				}
442 			}
443 		}
444 
445 	    if( !bOK )
446 	    {
447 	        Size aPrefSize;
448 
449 	        if( ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile ) &&
450 	            ::avmedia::MediaWindow::isMediaURL( aCurrentDropFile, true, &aPrefSize ) )
451 	        {
452 			    if( aPrefSize.Width() && aPrefSize.Height() )
453 			    {
454 					::sd::Window* pWin = mpViewSh->GetActiveWindow();
455 
456 				    if( pWin )
457 					    aPrefSize = pWin->PixelToLogic( aPrefSize, MAP_100TH_MM );
458 				    else
459 					    aPrefSize = Application::GetDefaultDevice()->PixelToLogic( aPrefSize, MAP_100TH_MM );
460 			    }
461 			    else
462 				    aPrefSize  = Size( 5000, 5000 );
463 
464     		    InsertMediaURL( aCurrentDropFile, mnAction, maDropPos, aPrefSize ) ;
465 	        }
466 	        else if( mnAction & DND_ACTION_LINK )
467 			    static_cast< DrawViewShell* >( mpViewSh )->InsertURLButton( aCurrentDropFile, aCurrentDropFile, String(), &maDropPos );
468 		    else
469 		    {
470 			    if( mpViewSh )
471 			    {
472 					try
473 					{
474 						//TODO/MBA: testing
475 						::rtl::OUString aName;
476 						uno::Sequence < beans::PropertyValue > aMedium(1);
477 						aMedium[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
478 						aMedium[0].Value <<= ::rtl::OUString( aCurrentDropFile );
479 
480 						uno::Reference < embed::XEmbeddedObject > xObj = mpDocSh->GetEmbeddedObjectContainer().
481 								InsertEmbeddedObject( aMedium, aName );
482 
483 						uno::Reference < embed::XEmbedPersist > xPersist( xObj, uno::UNO_QUERY );
484 						if ( xPersist.is())
485 						{
486 							// TODO/LEAN: VisualArea access can switch the object to running state
487 							sal_Int64 nAspect = embed::Aspects::MSOLE_CONTENT;
488 
489 							xPersist->storeOwn();
490 
491 							awt::Size aSz;
492 							try
493 							{
494 								aSz = xObj->getVisualAreaSize( nAspect );
495 							}
496 							catch( embed::NoVisualAreaSizeException& )
497 							{
498 								// the default size will be set later
499 							}
500 
501 							Size        aSize( aSz.Width, aSz.Height );
502 							Rectangle   aRect;
503 
504 							if (!aSize.Width() || !aSize.Height())
505 							{
506 								aSize.Width()   = 1410;
507 								aSize.Height()  = 1000;
508 							}
509 
510 							aRect = Rectangle( maDropPos, aSize );
511 
512 							SdrOle2Obj* pOleObj = new SdrOle2Obj( svt::EmbeddedObjectRef( xObj, nAspect ), aName, aRect );
513 							sal_uLong       nOptions = SDRINSERT_SETDEFLAYER;
514 
515 							if (mpViewSh != NULL)
516 							{
517 								OSL_ASSERT (mpViewSh->GetViewShell()!=NULL);
518 								SfxInPlaceClient* pIpClient =
519 									mpViewSh->GetViewShell()->GetIPClient();
520 								if (pIpClient!=NULL && pIpClient->IsObjectInPlaceActive())
521 									nOptions |= SDRINSERT_DONTMARK;
522 							}
523 
524 							InsertObjectAtView( pOleObj, *GetSdrPageView(), nOptions );
525 							pOleObj->SetLogicRect( aRect );
526 							aSz.Width = aRect.GetWidth();
527 							aSz.Height = aRect.GetHeight();
528 							xObj->setVisualAreaSize( nAspect,aSz );
529 						}
530 					}
531 					catch( uno::Exception& )
532 					{
533 						nError = ERRCODE_IO_GENERAL;
534 						// TODO/LATER: better error handling
535 					}
536 				}
537 		    }
538 	    }
539 
540         ++aIter;
541     }
542 
543     if( nError )
544         ErrorHandler::HandleError( nError );
545 
546     return nError;
547 }
548 
549 /*************************************************************************
550 |*
551 |* Timer-Handler fuer Errorhandling beim Drop()
552 |*
553 \************************************************************************/
554 
555 IMPL_LINK( View, DropErrorHdl, Timer*, EMPTYARG )
556 {
557 	InfoBox( mpViewSh ? mpViewSh->GetActiveWindow() : 0, String(SdResId(STR_ACTION_NOTPOSSIBLE) ) ).Execute();
558 	return 0;
559 }
560 
561 #ifdef _MSC_VER
562 #pragma optimize ( "", on )
563 #endif
564 
565 /*************************************************************************
566 |*
567 |* Redraw sperren oder erlauben
568 |*
569 \************************************************************************/
570 
571 void View::LockRedraw(sal_Bool bLock)
572 {
573 	if (bLock)
574 	{
575 		mnLockRedrawSmph++;
576 		DBG_ASSERT(mnLockRedrawSmph, "Ueberlauf im LockRedraw");
577 	}
578 	else
579 	{
580 		DBG_ASSERT(mnLockRedrawSmph, "Unterlauf im LockRedraw");
581 		mnLockRedrawSmph--;
582 
583 		// alle gespeicherten Redraws ausfuehren
584 		if (!mnLockRedrawSmph)
585 		{
586 			while (mpLockedRedraws && mpLockedRedraws->Count())
587 			{
588 				SdViewRedrawRec* pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
589 				OutputDevice* pCurrentOut = pRec->mpOut;
590 				Rectangle aBoundRect(pRec->aRect);
591 				mpLockedRedraws->Remove(pRec);
592 				delete pRec;
593 
594 				pRec = (SdViewRedrawRec*)mpLockedRedraws->First();
595 				while (pRec)
596 				{
597 					if (pRec->mpOut == pCurrentOut)
598 					{
599 						aBoundRect.Union(pRec->aRect);
600 						mpLockedRedraws->Remove(pRec);
601 						delete pRec;
602 						pRec = (SdViewRedrawRec*)mpLockedRedraws->GetCurObject();
603 					}
604 					else
605 					{
606 						pRec = (SdViewRedrawRec*)mpLockedRedraws->Next();
607 					}
608 				}
609 
610 				CompleteRedraw(pCurrentOut, Region(aBoundRect));
611 			}
612 			delete mpLockedRedraws;
613 			mpLockedRedraws = NULL;
614 		}
615 	}
616 }
617 
618 
619 
620 
621 /*************************************************************************
622 |*
623 |* StyleSheet aus der Sleketion besorgen
624 |*
625 \************************************************************************/
626 
627 SfxStyleSheet* View::GetStyleSheet() const
628 {
629 	return SdrView::GetStyleSheet();
630 }
631 
632 } // end of namespace sd
633