xref: /aoo42x/main/sw/source/core/doc/notxtfrm.cxx (revision a7185797)
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_sw.hxx"
24 
25 #include <hintids.hxx>
26 #include <tools/urlobj.hxx>
27 #include <vcl/print.hxx>
28 #include <vcl/virdev.hxx>
29 #include <vcl/svapp.hxx>
30 #include <svtools/imapobj.hxx>
31 #include <svtools/imap.hxx>
32 #include <svl/urihelper.hxx>
33 #include <svtools/soerr.hxx>
34 #include <sfx2/progress.hxx>
35 #include <sfx2/docfile.hxx>
36 #include <sfx2/printer.hxx>
37 #include <editeng/udlnitem.hxx>
38 #include <editeng/colritem.hxx>
39 #include <svx/xoutbmp.hxx>
40 #include <vcl/window.hxx>
41 #include <fmturl.hxx>
42 #include <fmtsrnd.hxx>
43 #include <frmfmt.hxx>
44 #include <swrect.hxx>
45 #include <fesh.hxx>
46 #include <doc.hxx>
47 #include <flyfrm.hxx>
48 #include <frmtool.hxx>
49 #include <viewopt.hxx>
50 #include <viewimp.hxx>
51 #include <pam.hxx>
52 #include <hints.hxx>
53 #include <rootfrm.hxx>
54 #include <dflyobj.hxx>
55 #include <pagefrm.hxx>
56 #include <notxtfrm.hxx>
57 #include <grfatr.hxx>
58 #include <charatr.hxx>
59 #include <fmtornt.hxx>
60 #include <ndnotxt.hxx>
61 #include <ndgrf.hxx>
62 #include <ndole.hxx>
63 #include <swregion.hxx>
64 #include <poolfmt.hxx>
65 #include <mdiexp.hxx>
66 #include <swwait.hxx>
67 #include <comcore.hrc>
68 #include <accessibilityoptions.hxx>
69 #include <com/sun/star/embed/EmbedMisc.hpp>
70 #include <com/sun/star/embed/EmbedStates.hpp>
71 #include <svtools/embedhlp.hxx>
72 #include <svx/charthelper.hxx>
73 #include <dview.hxx>
74 #include <basegfx/matrix/b2dhommatrix.hxx>
75 #include <svx/sdr/contact/objectcontacttools.hxx>
76 #include <drawinglayer/processor2d/baseprocessor2d.hxx>
77 #include <basegfx/matrix/b2dhommatrixtools.hxx>
78 #include <drawinglayer/processor2d/processor2dtools.hxx>
79 
80 using namespace com::sun::star;
81 
82 #define DEFTEXTSIZE  12
83 
84 extern void ClrContourCache( const SdrObject *pObj ); // TxtFly.Cxx
85 
86 
87 inline sal_Bool GetRealURL( const SwGrfNode& rNd, String& rTxt )
88 {
89 	sal_Bool bRet = rNd.GetFileFilterNms( &rTxt, 0 );
90 	if( bRet )
91 		rTxt = URIHelper::removePassword( rTxt, INetURLObject::WAS_ENCODED,
92 			   							INetURLObject::DECODE_UNAMBIGUOUS);
93 	return bRet;
94 }
95 
96 void lcl_PaintReplacement( const SwRect &rRect, const String &rText,
97 						   const ViewShell &rSh, const SwNoTxtFrm *pFrm,
98 						   sal_Bool bDefect )
99 {
100 	static Font *pFont = 0;
101 	if ( !pFont )
102 	{
103 		pFont = new Font();
104 		pFont->SetWeight( WEIGHT_BOLD );
105 		pFont->SetStyleName( aEmptyStr );
106 		pFont->SetName( String::CreateFromAscii(
107                             RTL_CONSTASCII_STRINGPARAM( "Arial Unicode" )));
108 		pFont->SetFamily( FAMILY_SWISS );
109 		pFont->SetTransparent( sal_True );
110 	}
111 
112 	Color aCol( COL_RED );
113 	FontUnderline eUnderline = UNDERLINE_NONE;
114 	const SwFmtURL &rURL = pFrm->FindFlyFrm()->GetFmt()->GetURL();
115 	if( rURL.GetURL().Len() || rURL.GetMap() )
116 	{
117 		sal_Bool bVisited = sal_False;
118 		if ( rURL.GetMap() )
119 		{
120 			ImageMap *pMap = (ImageMap*)rURL.GetMap();
121 			for( sal_uInt16 i = 0; i < pMap->GetIMapObjectCount(); i++ )
122 			{
123 				IMapObject *pObj = pMap->GetIMapObject( i );
124 				if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) )
125 				{
126 					bVisited = sal_True;
127 					break;
128 				}
129 			}
130 		}
131 		else if ( rURL.GetURL().Len() )
132 			bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
133 
134 		SwFmt *pFmt = rSh.GetDoc()->GetFmtFromPool( static_cast<sal_uInt16>
135             (bVisited ? RES_POOLCHR_INET_VISIT : RES_POOLCHR_INET_NORMAL ) );
136 		aCol = pFmt->GetColor().GetValue();
137 		eUnderline = pFmt->GetUnderline().GetLineStyle();
138 	}
139 
140 	pFont->SetUnderline( eUnderline );
141 	pFont->SetColor( aCol );
142 
143     const BitmapEx& rBmp = ViewShell::GetReplacementBitmap( bDefect != sal_False );
144     Graphic::DrawEx( rSh.GetOut(), rText, *pFont, rBmp, rRect.Pos(), rRect.SSize() );
145 }
146 
147 /*************************************************************************
148 |*
149 |*	  SwGrfFrm::SwGrfFrm(ViewShell * const,SwGrfNode *)
150 |*
151 |*	  Beschreibung
152 |*	  Ersterstellung	JP 05.03.91
153 |*	  Letzte Aenderung	MA 03. Mar. 93
154 |*
155 *************************************************************************/
156 
157 
158 SwNoTxtFrm::SwNoTxtFrm(SwNoTxtNode * const pNode, SwFrm* pSib )
159 	: SwCntntFrm( pNode, pSib )
160 {
161 	InitCtor();
162 }
163 
164 // Initialisierung: z.Zt. Eintragen des Frames im Cache
165 
166 
167 void SwNoTxtFrm::InitCtor()
168 {
169     nType = FRMC_NOTXT;
170 	// Das Gewicht der Grafik ist 0, wenn sie noch nicht
171 	// gelesen ist, < 0, wenn ein Lesefehler auftrat und
172 	// Ersatzdarstellung angewendet werden musste und >0,
173 	// wenn sie zur Verfuegung steht.
174 	nWeight = 0;
175 }
176 
177 /*************************************************************************
178 |*
179 |*	  SwNoTxtNode::MakeFrm()
180 |*
181 |*	  Beschreibung
182 |*	  Ersterstellung	JP 05.03.91
183 |*	  Letzte Aenderung	MA 03. Mar. 93
184 |*
185 *************************************************************************/
186 
187 
188 SwCntntFrm *SwNoTxtNode::MakeFrm( SwFrm* pSib )
189 {
190 	return new SwNoTxtFrm(this, pSib);
191 }
192 
193 /*************************************************************************
194 |*
195 |*	  SwNoTxtFrm::~SwNoTxtFrm()
196 |*
197 |*	  Beschreibung
198 |*	  Ersterstellung	JP 05.03.91
199 |*	  Letzte Aenderung	MA 30. Apr. 96
200 |*
201 *************************************************************************/
202 
203 SwNoTxtFrm::~SwNoTxtFrm()
204 {
205 	StopAnimation();
206 }
207 
208 /*************************************************************************
209 |*
210 |*	  void SwNoTxtFrm::Modify( SwHint * pOld, SwHint * pNew )
211 |*
212 |*	  Beschreibung
213 |*	  Ersterstellung	JP 05.03.91
214 |*	  Letzte Aenderung	JP 05.03.91
215 |*
216 *************************************************************************/
217 
218 void SetOutDev( ViewShell *pSh, OutputDevice *pOut )
219 {
220 	pSh->pOut = pOut;
221 }
222 
223 
224 
225 
226 void lcl_ClearArea( const SwFrm &rFrm,
227 					OutputDevice &rOut, const SwRect& rPtArea,
228 					const SwRect &rGrfArea )
229 {
230 	SwRegionRects aRegion( rPtArea, 4, 4 );
231 	aRegion -= rGrfArea;
232 
233 	if ( aRegion.Count() )
234 	{
235 		const SvxBrushItem *pItem; const Color *pCol; SwRect aOrigRect;
236 		if ( rFrm.GetBackgroundBrush( pItem, pCol, aOrigRect, sal_False ) )
237 			for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
238 				::DrawGraphic( pItem, &rOut, aOrigRect, aRegion[i] );
239 		else
240 		{
241             // OD 2004-04-23 #116347#
242             rOut.Push( PUSH_FILLCOLOR|PUSH_LINECOLOR );
243 			rOut.SetFillColor( rFrm.getRootFrm()->GetCurrShell()->Imp()->GetRetoucheColor());
244 			rOut.SetLineColor();
245 			for( sal_uInt16 i = 0; i < aRegion.Count(); ++i )
246 				rOut.DrawRect( aRegion[i].SVRect() );
247 			rOut.Pop();
248 		}
249 	}
250 }
251 
252 /*************************************************************************
253 |*
254 |*	  void SwNoTxtFrm::Paint()
255 |*
256 |*	  Beschreibung
257 |*	  Ersterstellung	JP 05.03.91
258 |*	  Letzte Aenderung	MA 10. Jan. 97
259 |*
260 *************************************************************************/
261 
262 void SwNoTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
263 {
264 	if ( Frm().IsEmpty() )
265 		return;
266 
267 	const ViewShell* pSh = getRootFrm()->GetCurrShell();
268 	if( !pSh->GetViewOptions()->IsGraphic() )
269 	{
270 		StopAnimation();
271         // OD 10.01.2003 #i6467# - no paint of placeholder for page preview
272         if ( pSh->GetWin() && !pSh->IsPreView() )
273 		{
274 			const SwNoTxtNode* pNd = GetNode()->GetNoTxtNode();
275             String aTxt( pNd->GetTitle() );
276 			if ( !aTxt.Len() && pNd->IsGrfNode() )
277 				GetRealURL( *(SwGrfNode*)pNd, aTxt );
278 			if( !aTxt.Len() )
279 				aTxt = FindFlyFrm()->GetFmt()->GetName();
280 			lcl_PaintReplacement( Frm(), aTxt, *pSh, this, sal_False );
281 		}
282 		return;
283 	}
284 
285     if( pSh->GetAccessibilityOptions()->IsStopAnimatedGraphics() ||
286     // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
287        !pSh->GetWin() )
288     // <--
289         StopAnimation();
290 
291 	SfxProgress::EnterLock(); //Keine Progress-Reschedules im Paint (SwapIn)
292 
293 	OutputDevice *pOut = pSh->GetOut();
294 	pOut->Push();
295 	sal_Bool bClip = sal_True;
296 	PolyPolygon aPoly;
297 
298     SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
299 	SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
300     if( pGrfNd )
301 		pGrfNd->SetFrameInPaint( sal_True );
302 
303     // OD 16.04.2003 #i13147# - add 2nd parameter with value <sal_True> to
304     // method call <FindFlyFrm().GetContour(..)> to indicate that it is called
305     // for paint in order to avoid load of the intrinsic graphic.
306     if ( ( !pOut->GetConnectMetaFile() ||
307            !pSh->GetWin() ) &&
308          FindFlyFrm()->GetContour( aPoly, sal_True )
309        )
310 	{
311 		pOut->SetClipRegion( aPoly );
312 		bClip = sal_False;
313 	}
314 
315 	SwRect aOrigPaint( rRect );
316 	if ( HasAnimation() && pSh->GetWin() )
317 	{
318 		aOrigPaint = Frm(); aOrigPaint += Prt().Pos();
319 	}
320 
321 	SwRect aGrfArea( Frm() );
322 	SwRect aPaintArea( aGrfArea );
323 	aPaintArea._Intersection( aOrigPaint );
324 
325 	SwRect aNormal( Frm().Pos() + Prt().Pos(), Prt().SSize() );
326 	aNormal.Justify(); //Normalisiertes Rechteck fuer die Vergleiche
327 
328 	if( aPaintArea.IsOver( aNormal ) )
329 	{
330 		// berechne die 4 zu loeschenden Rechtecke
331 		if( pSh->GetWin() )
332 			::lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, aNormal );
333 
334 		// in der Schnittmenge vom PaintBereich und der Bitmap liegt
335 		// der absolut sichtbare Bereich vom Frame
336 		aPaintArea._Intersection( aNormal );
337 
338 		if ( bClip )
339 			pOut->IntersectClipRegion( aPaintArea.SVRect() );
340         /// OD 25.09.2002 #99739# - delete unused 3rd parameter
341         PaintPicture( pOut, aGrfArea );
342 	}
343 	else
344 		// wenn nicht sichtbar, loesche einfach den angegebenen Bereich
345 		lcl_ClearArea( *this, *pSh->GetOut(), aPaintArea, SwRect() );
346     if( pGrfNd )
347 		pGrfNd->SetFrameInPaint( sal_False );
348 
349 	pOut->Pop();
350 	SfxProgress::LeaveLock();
351 }
352 
353 /*************************************************************************
354 |*
355 |*    void lcl_CalcRect( Point & aPt, Size & aDim,
356 |*                   sal_uInt16 nMirror )
357 |*
358 |*    Beschreibung      Errechne die Position und die Groesse der Grafik im
359 |*                      Frame, entsprechen der aktuellen Grafik-Attribute
360 |*
361 |*    Parameter         Point&  die Position im Frame  ( auch Return-Wert )
362 |*                      Size&   die Groesse der Grafik ( auch Return-Wert )
363 |*                      MirrorGrf   akt. Spiegelungs-Attribut
364 |*    Ersterstellung    JP 04.03.91
365 |*    Letzte Aenderung  JP 31.08.94
366 |*
367 *************************************************************************/
368 
369 
370 void lcl_CalcRect( Point& rPt, Size& rDim, sal_uInt16 nMirror )
371 {
372     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
373     {
374         rPt.X() += rDim.Width() -1;
375         rDim.Width() = -rDim.Width();
376     }
377 
378     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
379     {
380         rPt.Y() += rDim.Height() -1;
381         rDim.Height() = -rDim.Height();
382     }
383 }
384 
385 /*************************************************************************
386 |*
387 |*	  void SwNoTxtFrm::GetGrfArea()
388 |*
389 |*	  Beschreibung		Errechne die Position und die Groesse der Bitmap
390 |*						innerhalb des uebergebenem Rechtecks.
391 |*
392 |*	  Ersterstellung	JP 03.09.91
393 |*	  Letzte Aenderung	MA 11. Oct. 94
394 |*
395 *************************************************************************/
396 
397 void SwNoTxtFrm::GetGrfArea( SwRect &rRect, SwRect* pOrigRect,
398 							 sal_Bool ) const
399 {
400     // JP 23.01.2001: currently only used for scaling, cropping and mirroring
401     // the contour of graphics!
402 	//					all other is handled by the GraphicObject
403 
404 	//In rRect wird das sichbare Rechteck der Grafik gesteckt.
405 	//In pOrigRect werden Pos+Size der Gesamtgrafik gesteck.
406 
407 	const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet();
408 	const SwCropGrf& rCrop = rAttrSet.GetCropGrf();
409     sal_uInt16 nMirror = rAttrSet.GetMirrorGrf().GetValue();
410 
411     if( rAttrSet.GetMirrorGrf().IsGrfToggle() )
412     {
413         if( !(FindPageFrm()->GetVirtPageNum() % 2) )
414         {
415             switch ( nMirror )
416             {
417                 case RES_MIRROR_GRAPH_DONT: nMirror = RES_MIRROR_GRAPH_VERT; break;
418                 case RES_MIRROR_GRAPH_VERT: nMirror = RES_MIRROR_GRAPH_DONT; break;
419                 case RES_MIRROR_GRAPH_HOR: nMirror = RES_MIRROR_GRAPH_BOTH; break;
420                 default: nMirror = RES_MIRROR_GRAPH_HOR; break;
421             }
422         }
423     }
424 
425 	//Grafik wird vom Node eingelesen falls notwendig. Kann aber schiefgehen.
426 	long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop;
427 	Size aOrigSz( ((SwNoTxtNode*)GetNode())->GetTwipSize() );
428 	if ( !aOrigSz.Width() )
429 	{
430 		aOrigSz.Width() = Prt().Width();
431 		nLeftCrop  = -rCrop.GetLeft();
432 		nRightCrop = -rCrop.GetRight();
433 	}
434 	else
435 	{
436 		nLeftCrop = Max( aOrigSz.Width() -
437 							(rCrop.GetRight() + rCrop.GetLeft()), long(1) );
438 		const double nScale = double(Prt().Width())  / double(nLeftCrop);
439 		nLeftCrop  = long(nScale * -rCrop.GetLeft() );
440 		nRightCrop = long(nScale * -rCrop.GetRight() );
441 	}
442 
443     // crop values have to be mirrored too
444     if( nMirror == RES_MIRROR_GRAPH_VERT || nMirror == RES_MIRROR_GRAPH_BOTH )
445     {
446         long nTmpCrop = nLeftCrop;
447         nLeftCrop = nRightCrop;
448         nRightCrop= nTmpCrop;
449     }
450 
451 	if( !aOrigSz.Height() )
452 	{
453 		aOrigSz.Height() = Prt().Height();
454 		nTopCrop   = -rCrop.GetTop();
455 		nBottomCrop= -rCrop.GetBottom();
456 	}
457 	else
458 	{
459 		nTopCrop = Max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) );
460 		const double nScale = double(Prt().Height()) / double(nTopCrop);
461 		nTopCrop   = long(nScale * -rCrop.GetTop() );
462 		nBottomCrop= long(nScale * -rCrop.GetBottom() );
463 	}
464 
465     // crop values have to be mirrored too
466     if( nMirror == RES_MIRROR_GRAPH_HOR || nMirror == RES_MIRROR_GRAPH_BOTH )
467     {
468         long nTmpCrop = nTopCrop;
469         nTopCrop   = nBottomCrop;
470         nBottomCrop= nTmpCrop;
471     }
472 
473 	Size  aVisSz( Prt().SSize() );
474 	Size  aGrfSz( aVisSz );
475 	Point aVisPt( Frm().Pos() + Prt().Pos() );
476 	Point aGrfPt( aVisPt );
477 
478 	//Erst das 'sichtbare' Rect einstellen.
479 	if ( nLeftCrop > 0 )
480 	{
481 		aVisPt.X() 	+= nLeftCrop;
482 		aVisSz.Width() -= nLeftCrop;
483 	}
484 	if ( nTopCrop > 0 )
485 	{
486 		aVisPt.Y() 	 += nTopCrop;
487 		aVisSz.Height() -= nTopCrop;
488 	}
489 	if ( nRightCrop > 0 )
490 		aVisSz.Width() -= nRightCrop;
491 	if ( nBottomCrop > 0 )
492 		aVisSz.Height() -= nBottomCrop;
493 
494 	rRect.Pos  ( aVisPt );
495 	rRect.SSize( aVisSz );
496 
497 	//Ggf. Die Gesamtgrafik berechnen
498 	if ( pOrigRect )
499 	{
500 		Size aTmpSz( aGrfSz );
501 		aGrfPt.X()    += nLeftCrop;
502 		aTmpSz.Width() -= nLeftCrop + nRightCrop;
503 		aGrfPt.Y()	    += nTopCrop;
504 		aTmpSz.Height()-= nTopCrop + nBottomCrop;
505 
506         if( RES_MIRROR_GRAPH_DONT != nMirror )
507             lcl_CalcRect( aGrfPt, aTmpSz, nMirror );
508 
509 		pOrigRect->Pos  ( aGrfPt );
510 		pOrigRect->SSize( aTmpSz );
511 	}
512 }
513 
514 /*************************************************************************
515 |*
516 |*	  Size SwNoTxtFrm::GetSize()
517 |*
518 |*	  Beschreibung		Gebe die Groesse des umgebenen FLys und
519 |*						damit die der Grafik zurueck.
520 |*	  Ersterstellung	JP 04.03.91
521 |*	  Letzte Aenderung	JP 31.08.94
522 |*
523 *************************************************************************/
524 
525 
526 const Size& SwNoTxtFrm::GetSize() const
527 {
528 	// gebe die Groesse des Frames zurueck
529 	const SwFrm *pFly = FindFlyFrm();
530 	if( !pFly )
531 		pFly = this;
532 	return pFly->Prt().SSize();
533 }
534 
535 /*************************************************************************
536 |*
537 |*	  SwNoTxtFrm::MakeAll()
538 |*
539 |*	  Ersterstellung	MA 29. Nov. 96
540 |*	  Letzte Aenderung	MA 29. Nov. 96
541 |*
542 *************************************************************************/
543 
544 
545 void SwNoTxtFrm::MakeAll()
546 {
547 	SwCntntNotify aNotify( this );
548 	SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
549 	const SwBorderAttrs &rAttrs = *aAccess.Get();
550 
551 	while ( !bValidPos || !bValidSize || !bValidPrtArea )
552 	{
553 		MakePos();
554 
555 		if ( !bValidSize )
556 			Frm().Width( GetUpper()->Prt().Width() );
557 
558 		MakePrtArea( rAttrs );
559 
560 		if ( !bValidSize )
561 		{	bValidSize = sal_True;
562 			Format();
563 		}
564 	}
565 }
566 
567 /*************************************************************************
568 |*
569 |*	  SwNoTxtFrm::Format()
570 |*
571 |*	  Beschreibung		Errechne die Groesse der Bitmap, wenn noetig
572 |*	  Ersterstellung	JP 11.03.91
573 |*	  Letzte Aenderung	MA 13. Mar. 96
574 |*
575 *************************************************************************/
576 
577 
578 void SwNoTxtFrm::Format( const SwBorderAttrs * )
579 {
580 	const Size aNewSize( GetSize() );
581 
582 	// hat sich die Hoehe geaendert?
583 	SwTwips nChgHght = IsVertical() ?
584 		(SwTwips)(aNewSize.Width() - Prt().Width()) :
585 		(SwTwips)(aNewSize.Height() - Prt().Height());
586     if( nChgHght > 0)
587         Grow( nChgHght );
588 	else if( nChgHght < 0)
589         Shrink( Min(Prt().Height(), -nChgHght) );
590 }
591 
592 /*************************************************************************
593 |*
594 |*	  SwNoTxtFrm::GetCharRect()
595 |*
596 |*	  Beschreibung
597 |*	  Ersterstellung	SS 29-Apr-1991
598 |*	  Letzte Aenderung	MA 10. Oct. 94
599 |*
600 |*************************************************************************/
601 
602 
603 sal_Bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
604 							  SwCrsrMoveState *pCMS ) const
605 {
606 	if ( &rPos.nNode.GetNode() != (SwNode*)GetNode() )
607 		return sal_False;
608 
609 	Calc();
610 	SwRect aFrameRect( Frm() );
611 	rRect = aFrameRect;
612 	rRect.Pos( Frm().Pos() + Prt().Pos() );
613 	rRect.SSize( Prt().SSize() );
614 
615 	rRect.Justify();
616 
617 	// liegt die Bitmap ueberhaupt im sichtbaren Berich ?
618 	if( !aFrameRect.IsOver( rRect ) )
619 	{
620 		// wenn nicht dann steht der Cursor auf dem Frame
621 		rRect = aFrameRect;
622 		rRect.Width( 1 );
623 	}
624 	else
625 		rRect._Intersection( aFrameRect );
626 
627 	if ( pCMS )
628 	{
629 		if ( pCMS->bRealHeight )
630 		{
631 			pCMS->aRealHeight.Y() = rRect.Height();
632 			pCMS->aRealHeight.X() = 0;
633 		}
634 	}
635 
636 	return sal_True;
637 }
638 
639 
640 sal_Bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
641                              SwCrsrMoveState* ) const
642 {
643 	SwCntntNode* pCNd = (SwCntntNode*)GetNode();
644 	pPos->nNode = *pCNd;
645 	pPos->nContent.Assign( pCNd, 0 );
646 	return sal_True;
647 }
648 
649 #define CLEARCACHE( pNd ) {\
650 	(pNd)->ReleaseGraphicFromCache();\
651 	SwFlyFrm* pFly = FindFlyFrm();\
652 	if( pFly && pFly->GetFmt()->GetSurround().IsContour() )\
653 	{\
654 		ClrContourCache( pFly->GetVirtDrawObj() );\
655 		pFly->NotifyBackground( FindPageFrm(), Prt(), PREP_FLY_ATTR_CHG );\
656 	}\
657 }
658 
659 void SwNoTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
660 {
661 	sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
662 
663     // --> OD 2007-03-06 #i73788#
664     // no <SwCntntFrm::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
665     if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
666 		 RES_GRAPHIC_ARRIVED != nWhich &&
667          RES_GRF_REREAD_AND_INCACHE != nWhich &&
668          RES_LINKED_GRAPHIC_STREAM_ARRIVED != nWhich )
669     // <--
670     {
671 		SwCntntFrm::Modify( pOld, pNew );
672     }
673 
674 	sal_Bool bComplete = sal_True;
675 
676 	switch( nWhich )
677 	{
678 	case RES_OBJECTDYING:
679 		break;
680 
681 	case RES_GRF_REREAD_AND_INCACHE:
682 		if( ND_GRFNODE == GetNode()->GetNodeType() )
683 		{
684 			bComplete = sal_False;
685 			SwGrfNode* pNd = (SwGrfNode*) GetNode();
686 
687 			ViewShell *pVSh = 0;
688 			pNd->GetDoc()->GetEditShell( &pVSh );
689 			if( pVSh )
690 			{
691 				GraphicAttr aAttr;
692 				if( pNd->GetGrfObj().IsCached( pVSh->GetOut(), Point(),
693 							Prt().SSize(), &pNd->GetGraphicAttr( aAttr, this ) ))
694 				{
695 					ViewShell *pSh = pVSh;
696 					do {
697 						SET_CURR_SHELL( pSh );
698 						if( pSh->GetWin() )
699 						{
700 							if( pSh->IsPreView() )
701 								::RepaintPagePreview( pSh, Frm().SVRect() );
702 							else
703 								pSh->GetWin()->Invalidate( Frm().SVRect() );
704 						}
705 					} while( pVSh != (pSh = (ViewShell*)pSh->GetNext() ));
706 				}
707 				else
708 					pNd->SwapIn();
709 			}
710 		}
711 		break;
712 
713 	case RES_UPDATE_ATTR:
714 	case RES_FMT_CHG:
715 		CLEARCACHE( (SwGrfNode*) GetNode() )
716 		break;
717 
718 	case RES_ATTRSET_CHG:
719 		{
720 			sal_uInt16 n;
721 			for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
722 				if( SFX_ITEM_SET == ((SwAttrSetChg*)pOld)->GetChgSet()->
723 								GetItemState( n, sal_False ))
724 				{
725 					CLEARCACHE( (SwGrfNode*) GetNode() )
726 					break;
727 				}
728 			if( RES_GRFATR_END == n )			// not found
729 				return ;
730 		}
731 		break;
732 
733 	case RES_GRAPHIC_PIECE_ARRIVED:
734 	case RES_GRAPHIC_ARRIVED:
735     // --> OD 2007-03-06 #i73788#
736     // handle RES_LINKED_GRAPHIC_STREAM_ARRIVED as RES_GRAPHIC_ARRIVED
737     case RES_LINKED_GRAPHIC_STREAM_ARRIVED:
738     // <--
739 		if ( GetNode()->GetNodeType() == ND_GRFNODE )
740 		{
741 			bComplete = sal_False;
742 			SwGrfNode* pNd = (SwGrfNode*) GetNode();
743 
744 			CLEARCACHE( pNd )
745 
746 			SwRect aRect( Frm() );
747 
748 			ViewShell *pVSh = 0;
749 			pNd->GetDoc()->GetEditShell( &pVSh );
750             if( !pVSh )
751 				break;
752 
753 			ViewShell *pSh = pVSh;
754 			do {
755 				SET_CURR_SHELL( pSh );
756 				if( pSh->IsPreView() )
757 				{
758 					if( pSh->GetWin() )
759 						::RepaintPagePreview( pSh, aRect );
760 				}
761                 else if ( pSh->VisArea().IsOver( aRect ) &&
762                    OUTDEV_WINDOW == pSh->GetOut()->GetOutDevType() )
763 				{
764                     // OD 27.11.2002 #105519# - invalidate instead of painting
765                     pSh->GetWin()->Invalidate( aRect.SVRect() );
766 				}
767 
768 				pSh = (ViewShell *)pSh->GetNext();
769 			} while( pSh != pVSh );
770 		}
771 		break;
772 
773 	default:
774         if ( !pNew || !isGRFATR(nWhich) )
775 			return;
776 	}
777 
778 	if( bComplete )
779 	{
780 		InvalidatePrt();
781 		SetCompletePaint();
782 	}
783 }
784 
785 void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, OutputDevice* pOut )
786 {
787 
788     if(!pOut)
789         return;
790     Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
791     Rectangle aNewPxRect( aPxRect );
792     while( aNewPxRect.Left() < aPxRect.Left() )
793     {
794         rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
795         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
796     }
797     while( aNewPxRect.Top() < aPxRect.Top() )
798     {
799         rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
800         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
801     }
802     while( aNewPxRect.Bottom() > aPxRect.Bottom() )
803     {
804         rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
805         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
806     }
807     while( aNewPxRect.Right() > aPxRect.Right() )
808     {
809         rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
810         aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
811     }
812 }
813 
814 bool paintUsingPrimitivesHelper(
815     OutputDevice& rOutputDevice,
816     const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
817     const basegfx::B2DRange& rSourceRange,
818     const basegfx::B2DRange& rTargetRange,
819     const sal_Int32 nLeftCrop = 0,
820     const sal_Int32 nTopCrop = 0,
821     const sal_Int32 nRightCrop = 0,
822     const sal_Int32 nBottomCrop = 0,
823     const bool bMirrorX = false,
824     const bool bMirrorY = false)
825 {
826     const double fSourceWidth(rSourceRange.getWidth());
827     const double fSourceHeight(rSourceRange.getHeight());
828 
829     if(rSequence.hasElements() && !basegfx::fTools::equalZero(fSourceWidth) && !basegfx::fTools::equalZero(fSourceHeight))
830     {
831         // copy target range and apply evtl. cropping
832         basegfx::B2DRange aTargetRange(rTargetRange);
833 
834         if(nLeftCrop || nTopCrop || nRightCrop || nBottomCrop)
835         {
836             // calculate original TargetRange
837             const double fFactor100thmmToTwips(72.0 / 127.0);
838 
839             aTargetRange = basegfx::B2DRange(
840                 aTargetRange.getMinX() - (nLeftCrop * fFactor100thmmToTwips),
841                 aTargetRange.getMinY() - (nTopCrop * fFactor100thmmToTwips),
842                 aTargetRange.getMaxX() + (nRightCrop * fFactor100thmmToTwips),
843                 aTargetRange.getMaxY() + (nBottomCrop * fFactor100thmmToTwips));
844         }
845 
846         const double fTargetWidth(aTargetRange.getWidth());
847         const double fTargetHeight(aTargetRange.getHeight());
848 
849         if(!basegfx::fTools::equalZero(fTargetWidth) && !basegfx::fTools::equalZero(fTargetHeight))
850         {
851             // map graphic range to target range. This will automatically include
852             // tme mapping from Svg 1/100th mm content to twips since the target
853             // range is twips already
854             basegfx::B2DHomMatrix aMappingTransform(
855                 basegfx::tools::createTranslateB2DHomMatrix(
856                     -rSourceRange.getMinX(),
857                     -rSourceRange.getMinY()));
858 
859             aMappingTransform.scale(fTargetWidth / fSourceWidth, fTargetHeight / fSourceHeight);
860             aMappingTransform.translate(aTargetRange.getMinX(), aTargetRange.getMinY());
861 
862             // apply mirrorings
863             if(bMirrorX || bMirrorY)
864             {
865                 aMappingTransform.translate(-aTargetRange.getCenterX(), -aTargetRange.getCenterY());
866                 aMappingTransform.scale(bMirrorX ? -1.0 : 1.0, bMirrorY ? -1.0 : 1.0); // #119176# small typo with X/Y
867                 aMappingTransform.translate(aTargetRange.getCenterX(), aTargetRange.getCenterY());
868             }
869 
870             // Fill ViewInformation. Use MappingTransform here, so there is no need to
871             // embed the primitives to it. Use original TargetRange here so there is also
872             // no need to embed the primitives to a MaskPrimitive for cropping. This works
873             // only in this case where the graphic object cannot be rotated, though.
874             const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
875                 aMappingTransform,
876                 rOutputDevice.GetViewTransformation(),
877                 aTargetRange,
878                 0,
879                 0.0,
880                 uno::Sequence< beans::PropertyValue >());
881 
882             // get a primitive processor for rendering
883             drawinglayer::processor2d::BaseProcessor2D* pProcessor2D = drawinglayer::processor2d::createProcessor2DFromOutputDevice(
884                 rOutputDevice,
885                 aViewInformation2D);
886 
887             if(pProcessor2D)
888             {
889                 // render and cleanup
890                 pProcessor2D->process(rSequence);
891                 delete pProcessor2D;
892                 return true;
893             }
894         }
895     }
896 
897     return false;
898 }
899 
900 // Ausgabe der Grafik. Hier wird entweder eine QuickDraw-Bmp oder
901 // eine Grafik vorausgesetzt. Ist nichts davon vorhanden, wird
902 // eine Ersatzdarstellung ausgegeben.
903 /// OD 25.09.2002 #99739# - delete unused 3rd parameter.
904 /// OD 25.09.2002 #99739# - use aligned rectangle for drawing graphic.
905 /// OD 25.09.2002 #99739# - pixel-align coordinations for drawing graphic.
906 void SwNoTxtFrm::PaintPicture( OutputDevice* pOut, const SwRect &rGrfArea ) const
907 {
908 	ViewShell* pShell = getRootFrm()->GetCurrShell();
909 
910 	SwNoTxtNode& rNoTNd = *(SwNoTxtNode*)GetNode();
911 	SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
912 	SwOLENode* pOLENd = rNoTNd.GetOLENode();
913 
914     const sal_Bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess()->getPrinter( false ) ||
915                           pOut->GetConnectMetaFile();
916 
917     const bool bIsChart = pOLENd && ChartHelper::IsChart( pOLENd->GetOLEObj().GetObject() );
918 
919     /// OD 25.09.2002 #99739# - calculate aligned rectangle from parameter <rGrfArea>.
920     ///     Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
921     ///     the following code.
922     SwRect aAlignedGrfArea = rGrfArea;
923     ::SwAlignRect( aAlignedGrfArea,  pShell );
924 
925     if( !bIsChart )
926     {
927         /// OD 25.09.2002 #99739#
928         /// Because for drawing a graphic left-top-corner and size coordinations are
929         /// used, these coordinations have to be determined on pixel level.
930         ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
931     }
932     else //if( bIsChart )
933     {
934         //#i78025# charts own borders are not completely visible
935         //the above pixel correction is not correct - at least not for charts
936         //so a different pixel correction is choosen here
937         //this might be a good idea for all other OLE objects also,
938         //but as I cannot oversee the consequences I fix it only for charts for now
939         lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
940     }
941 
942     if( pGrfNd )
943 	{
944 		sal_Bool bForceSwap = sal_False, bContinue = sal_True;
945 		const GraphicObject& rGrfObj = pGrfNd->GetGrfObj();
946 
947 		GraphicAttr aGrfAttr;
948 		pGrfNd->GetGraphicAttr( aGrfAttr, this );
949 
950 		if( !bPrn )
951 		{
952             // --> OD 2007-01-02 #i73788#
953             if ( pGrfNd->IsLinkedInputStreamReady() )
954             {
955                 pGrfNd->UpdateLinkWithInputStream();
956             }
957             // <--
958             // --> OD 2008-01-30 #i85717#
959             // --> OD 2008-07-21 #i90395# - check, if asynchronous retrieval
960             // if input stream for the graphic is possible
961 //            else if( GRAPHIC_DEFAULT == rGrfObj.GetType() &&
962             else if ( ( rGrfObj.GetType() == GRAPHIC_DEFAULT ||
963                         rGrfObj.GetType() == GRAPHIC_NONE ) &&
964                       pGrfNd->IsLinkedFile() &&
965                       pGrfNd->IsAsyncRetrieveInputStreamPossible() )
966             // <--
967 			{
968 				Size aTmpSz;
969                 ::sfx2::SvLinkSource* pGrfObj = pGrfNd->GetLink()->GetObj();
970 				if( !pGrfObj ||
971 					!pGrfObj->IsDataComplete() ||
972 					!(aTmpSz = pGrfNd->GetTwipSize()).Width() ||
973 					!aTmpSz.Height() || !pGrfNd->GetAutoFmtLvl() )
974 				{
975                     // --> OD 2006-12-22 #i73788#
976                     pGrfNd->TriggerAsyncRetrieveInputStream();
977                     // <--
978 				}
979                 String aTxt( pGrfNd->GetTitle() );
980 				if ( !aTxt.Len() )
981 					GetRealURL( *pGrfNd, aTxt );
982                 ::lcl_PaintReplacement( aAlignedGrfArea, aTxt, *pShell, this, sal_False );
983 				bContinue = sal_False;
984 			}
985             else if( rGrfObj.IsCached( pOut, aAlignedGrfArea.Pos(),
986                                     aAlignedGrfArea.SSize(), &aGrfAttr ))
987 			{
988                 pGrfNd->DrawGraphicWithPDFHandling(*pOut,
989                     aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(),
990                     &aGrfAttr );
991 				bContinue = sal_False;
992 			}
993 		}
994 
995 		if( bContinue )
996 		{
997 			const sal_Bool bSwapped = rGrfObj.IsSwappedOut();
998 			const sal_Bool bSwappedIn = 0 != pGrfNd->SwapIn( bPrn );
999 			if( bSwappedIn && rGrfObj.GetGraphic().IsSupportedGraphic())
1000 			{
1001                 const sal_Bool bAnimate = rGrfObj.IsAnimated() &&
1002                                          !pShell->IsPreView() &&
1003                                          !pShell->GetAccessibilityOptions()->IsStopAnimatedGraphics() &&
1004                 // --> FME 2004-06-21 #i9684# Stop animation during printing/pdf export
1005                                           pShell->GetWin();
1006                 // <--
1007 
1008 				if( bAnimate &&
1009 					FindFlyFrm() != ::GetFlyFromMarked( 0, pShell ))
1010 				{
1011 					OutputDevice* pVout;
1012 					if( pOut == pShell->GetOut() && SwRootFrm::FlushVout() )
1013 						pVout = pOut, pOut = pShell->GetOut();
1014 					else if( pShell->GetWin() &&
1015 							 OUTDEV_VIRDEV == pOut->GetOutDevType() )
1016 						pVout = pOut, pOut = pShell->GetWin();
1017 					else
1018 						pVout = 0;
1019 
1020                     ASSERT( OUTDEV_VIRDEV != pOut->GetOutDevType() ||
1021                             pShell->GetViewOptions()->IsPDFExport(),
1022                             "pOut sollte kein virtuelles Device sein" );
1023 
1024                     pGrfNd->StartGraphicAnimation(pOut, aAlignedGrfArea.Pos(),
1025                                         aAlignedGrfArea.SSize(), long(this),
1026 										0, GRFMGR_DRAW_STANDARD, pVout );
1027 				}
1028                 else
1029                 {
1030                     const SvgDataPtr& rSvgDataPtr = rGrfObj.GetGraphic().getSvgData();
1031                     bool bDone(false);
1032 
1033                     if(rSvgDataPtr.get())
1034                     {
1035                         // Graphic is Svg and can be painted as primitives (vector graphic)
1036                         const basegfx::B2DRange aTargetRange(
1037                             aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
1038                             aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
1039                         const bool bCropped(aGrfAttr.IsCropped());
1040 
1041                         bDone = paintUsingPrimitivesHelper(
1042                             *pOut,
1043                             rSvgDataPtr->getPrimitive2DSequence(),
1044                             rSvgDataPtr->getRange(),
1045                             aTargetRange,
1046                             bCropped ? aGrfAttr.GetLeftCrop() : 0,
1047                             bCropped ? aGrfAttr.GetTopCrop() : 0,
1048                             bCropped ? aGrfAttr.GetRightCrop() : 0,
1049                             bCropped ? aGrfAttr.GetBottomCrop() : 0,
1050                             aGrfAttr.GetMirrorFlags() & BMP_MIRROR_HORZ,
1051                             aGrfAttr.GetMirrorFlags() & BMP_MIRROR_VERT);
1052                     }
1053 
1054                     if(!bDone)
1055                     {
1056                         // fallback paint, uses replacement image
1057                         pGrfNd->DrawGraphicWithPDFHandling(*pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), &aGrfAttr);
1058                     }
1059                 }
1060 			}
1061 			else
1062 			{
1063 				sal_uInt16 nResId = 0;
1064 				if( bSwappedIn )
1065 				{
1066 					if( GRAPHIC_NONE == rGrfObj.GetType() )
1067 						nResId = STR_COMCORE_READERROR;
1068 					else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
1069 						nResId = STR_COMCORE_CANT_SHOW;
1070 				}
1071 				((SwNoTxtFrm*)this)->nWeight = -1;
1072 				String aText;
1073 				if ( !nResId &&
1074                      !(aText = pGrfNd->GetTitle()).Len() &&
1075 					 (!GetRealURL( *pGrfNd, aText ) || !aText.Len()))
1076 				{
1077 					nResId = STR_COMCORE_READERROR;
1078 				}
1079 				if ( nResId )
1080 					aText = SW_RESSTR( nResId );
1081 
1082                 ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, sal_True );
1083 			}
1084 
1085 			//Beim Drucken duerfen wir nicht die Grafiken sammeln...
1086 			if( bSwapped && bPrn )
1087 				bForceSwap = sal_True;
1088 		}
1089 		if( bForceSwap )
1090 			pGrfNd->SwapOut();
1091 	}
1092     else // bIsChart || pOLENd
1093     {
1094         // --> OD 2009-03-05 #i99665#
1095         // Adjust AntiAliasing mode at output device for chart OLE
1096         const sal_uInt16 nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
1097         if ( pOLENd->IsChart() &&
1098                 pShell->Imp()->GetDrawView()->IsAntiAliasing() )
1099         {
1100             const sal_uInt16 nAntialiasingForChartOLE =
1101                     nFormerAntialiasingAtOutput | ANTIALIASING_PIXELSNAPHAIRLINE;
1102             pOut->SetAntialiasing( nAntialiasingForChartOLE );
1103         }
1104         // <--
1105 
1106         bool bDone(false);
1107 
1108         if(bIsChart)
1109         {
1110             const uno::Reference< frame::XModel > aXModel(pOLENd->GetOLEObj().GetOleRef()->getComponent(), uno::UNO_QUERY);
1111 
1112             if(aXModel.is())
1113             {
1114                 basegfx::B2DRange aSourceRange;
1115 
1116                 const drawinglayer::primitive2d::Primitive2DSequence aSequence(
1117                     ChartHelper::tryToGetChartContentAsPrimitive2DSequence(
1118                         aXModel,
1119                         aSourceRange));
1120 
1121                 if(aSequence.hasElements() && !aSourceRange.isEmpty())
1122                 {
1123                     const basegfx::B2DRange aTargetRange(
1124                         aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
1125                         aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
1126 
1127                     bDone = paintUsingPrimitivesHelper(
1128                         *pOut,
1129                         aSequence,
1130                         aSourceRange,
1131                         aTargetRange);
1132                 }
1133             }
1134         }
1135 
1136         if(!bDone && pOLENd)
1137 	    {
1138             Point aPosition(aAlignedGrfArea.Pos());
1139             Size aSize(aAlignedGrfArea.SSize());
1140 
1141             // Im BrowseModus gibt es nicht unbedingt einen Drucker und
1142             // damit kein JobSetup, also legen wir eines an ...
1143             const JobSetup* pJobSetup = pOLENd->getIDocumentDeviceAccess()->getJobsetup();
1144             sal_Bool bDummyJobSetup = 0 == pJobSetup;
1145             if( bDummyJobSetup )
1146                 pJobSetup = new JobSetup();
1147 
1148 		    // #i42323#
1149 		    // The reason for #114233# is gone, so i remove it again
1150             //TODO/LATER: is it a problem that the JopSetup isn't used?
1151             //xRef->DoDraw( pOut, aAlignedGrfArea.Pos(), aAlignedGrfArea.SSize(), *pJobSetup );
1152 
1153             // get hi-contrast image, but never for printing
1154 		    Graphic* pGraphic = NULL;
1155             if (pOut && !bPrn && Application::GetSettings().GetStyleSettings().GetHighContrastMode() )
1156 			    pGraphic = pOLENd->GetHCGraphic();
1157 
1158 		    // when it is not possible to get HC-representation, the original image should be used
1159 		    if ( !pGraphic )
1160            	    pGraphic = pOLENd->GetGraphic();
1161 
1162             if ( pGraphic && pGraphic->GetType() != GRAPHIC_NONE )
1163 		    {
1164 			    pGraphic->Draw( pOut, aPosition, aSize );
1165 
1166 			    // shade the representation if the object is activated outplace
1167 			    uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
1168 			    if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
1169 			    {
1170 				    ::svt::EmbeddedObjectRef::DrawShading( Rectangle( aPosition, aSize ), pOut );
1171 			    }
1172 		    }
1173             else
1174                 ::svt::EmbeddedObjectRef::DrawPaintReplacement( Rectangle( aPosition, aSize ), pOLENd->GetOLEObj().GetCurrentPersistName(), pOut );
1175 
1176             if( bDummyJobSetup )
1177                 delete pJobSetup;  // ... und raeumen wieder auf.
1178 
1179             sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
1180             if ( !bPrn && pShell->ISA( SwCrsrShell ) &&
1181                     nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE )
1182             {
1183                 const SwFlyFrm *pFly = FindFlyFrm();
1184                 ASSERT( pFly, "OLE not in FlyFrm" );
1185                 ((SwFEShell*)pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->Prt(), pFly->Frm());
1186             }
1187         }
1188 
1189         // --> OD 2009-03-05 #i99665#
1190         if ( pOLENd->IsChart() &&
1191                 pShell->Imp()->GetDrawView()->IsAntiAliasing() )
1192         {
1193             pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
1194         }
1195         // <--
1196     }
1197 }
1198 
1199 
1200 sal_Bool SwNoTxtFrm::IsTransparent() const
1201 {
1202 	const ViewShell* pSh = getRootFrm()->GetCurrShell();
1203 	if ( !pSh || !pSh->GetViewOptions()->IsGraphic() )
1204 		return sal_True;
1205 
1206 	const SwGrfNode *pNd;
1207 	if( 0 != (pNd = GetNode()->GetGrfNode()) )
1208 		return pNd->IsTransparent();
1209 
1210 	//#29381# OLE sind immer Transparent.
1211 	return sal_True;
1212 }
1213 
1214 
1215 void SwNoTxtFrm::StopAnimation( OutputDevice* pOut ) const
1216 {
1217 	//animierte Grafiken anhalten
1218 	const SwGrfNode* pGrfNd = dynamic_cast< const SwGrfNode* >(GetNode()->GetGrfNode());
1219 
1220     if( pGrfNd && pGrfNd->IsAnimated() )
1221     {
1222 		const_cast< SwGrfNode* >(pGrfNd)->StopGraphicAnimation( pOut, long(this) );
1223     }
1224 }
1225 
1226 
1227 sal_Bool SwNoTxtFrm::HasAnimation() const
1228 {
1229 	const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
1230 	return pGrfNd && pGrfNd->IsAnimated();
1231 }
1232 
1233 
1234 
1235