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