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