xref: /aoo42x/main/sd/source/ui/view/sdview4.cxx (revision 9e9dd2d5)
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 #include "glob.hrc"
70 
71 using namespace com::sun::star;
72 
73 namespace sd {
74 
75 #ifdef _MSC_VER
76 #pragma optimize ( "", off )
77 #endif
78 
79 /*************************************************************************
80 |*
81 |* Graphik einfuegen
82 |* Wird ein leeres Graphikobjekt uebergeben, so wird dieses gefuellt.
83 |* Andernfalls wird ein an der gegebenen Position vorhandenes Objekt
84 |* gefuellt. Ist an der Position kein Objekt vorhanden, so wird ein neues
85 |* Objekt erzeugt und ein Pointer auf dieses Objekt zurueckgegeben.
86 |*
87 \************************************************************************/
88 
89 SdrGrafObj* View::InsertGraphic( const Graphic& rGraphic, sal_Int8& rAction,
90 								   const Point& rPos, SdrObject* pObj, ImageMap* pImageMap )
91 {
92 	SdrEndTextEdit();
93 	mnAction = rAction;
94 
95 	// Liegt ein Objekt an der Position rPos?
96 	SdrGrafObj*		pNewGrafObj = NULL;
97 	SdrPageView*	pPV = GetSdrPageView();
98 	SdrObject*		pPickObj = pObj;
99 	const bool bOnMaster = pPV && pPV->GetPage() && pPV->GetPage()->IsMasterPage();
100 
101 	if(pPV && this->ISA(::sd::slidesorter::view::SlideSorterView))
102 	{
103 		if(!pPV->GetPageRect().IsInside(rPos))
104 			pPV = 0L;
105 	}
106 
107 	if( !pPickObj && pPV )
108 	{
109 		SdrPageView* pPageView = pPV;
110 		PickObj(rPos, getHitTolLog(), pPickObj, pPageView);
111 	}
112 
113 	if( mnAction == DND_ACTION_LINK && pPickObj && pPV )
114 	{
115 		const bool bIsGraphic = pPickObj->ISA( SdrGrafObj );
116 		if( bIsGraphic || (pObj->IsEmptyPresObj() && !bOnMaster) )
117 		{
118 			if( IsUndoEnabled() )
119 				BegUndo(String(SdResId(STR_INSERTGRAPHIC)));
120 
121 			SdPage* pPage = (SdPage*) pPickObj->GetPage();
122 
123 			if( bIsGraphic )
124 			{
125 				// Das Objekt wird mit der Bitmap gefuellt
126 				pNewGrafObj = (SdrGrafObj*) pPickObj->Clone();
127 				pNewGrafObj->SetGraphic(rGraphic);
128 			}
129 			else
130 			{
131 				pNewGrafObj = new SdrGrafObj( rGraphic, pPickObj->GetLogicRect() );
132 				pNewGrafObj->SetEmptyPresObj(sal_True);
133 			}
134 
135 			if ( pNewGrafObj->IsEmptyPresObj() )
136 			{
137 				Rectangle aRect( pNewGrafObj->GetLogicRect() );
138 				pNewGrafObj->AdjustToMaxRect( aRect, sal_False );
139 				pNewGrafObj->SetOutlinerParaObject(NULL);
140 				pNewGrafObj->SetEmptyPresObj(sal_False);
141 			}
142 
143 			if (pPage && pPage->IsPresObj(pPickObj))
144 			{
145 				// Neues PresObj in die Liste eintragen
146 				pPage->InsertPresObj( pNewGrafObj, PRESOBJ_GRAPHIC );
147 				pNewGrafObj->SetUserCall(pPickObj->GetUserCall());
148 			}
149 
150 			if (pImageMap)
151 				pNewGrafObj->InsertUserData(new SdIMapInfo(*pImageMap));
152 
153 			ReplaceObjectAtView(pPickObj, *pPV, pNewGrafObj); // maybe ReplaceObjectAtView
154 
155 			if( IsUndoEnabled() )
156 				EndUndo();
157 		}
158 		else if (pPickObj->IsClosedObj() && !pPickObj->ISA(SdrOle2Obj))
159 		{
160 			/******************************************************************
161 			* Das Objekt wird mit der Graphik gefuellt
162 			******************************************************************/
163 			if( IsUndoEnabled() )
164 			{
165 				BegUndo(String(SdResId(STR_UNDO_DRAGDROP)));
166 				AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pPickObj));
167 				EndUndo();
168 			}
169 
170 			SfxItemSet aSet(mpDocSh->GetPool(), XATTR_FILLSTYLE, XATTR_FILLBITMAP);
171 			aSet.Put(XFillStyleItem(XFILL_BITMAP));
172 			aSet.Put(XFillBitmapItem(&mpDocSh->GetPool(), rGraphic));
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