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