LibreOffice Module sw (master)  1
notxtfrm.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <hintids.hxx>
21 #include <tools/urlobj.hxx>
22 #include <vcl/imapobj.hxx>
23 #include <vcl/imap.hxx>
24 #include <svl/urihelper.hxx>
25 #include <sfx2/progress.hxx>
26 #include <sfx2/printer.hxx>
27 #include <editeng/udlnitem.hxx>
28 #include <editeng/colritem.hxx>
29 #include <editeng/boxitem.hxx>
30 #include <fmturl.hxx>
31 #include <fmtsrnd.hxx>
32 #include <frmfmt.hxx>
33 #include <swrect.hxx>
34 #include <fesh.hxx>
35 #include <doc.hxx>
40 #include <flyfrm.hxx>
41 #include <flyfrms.hxx>
42 #include <frmtool.hxx>
43 #include <viewopt.hxx>
44 #include <viewimp.hxx>
45 #include <pam.hxx>
46 #include <hints.hxx>
47 #include <rootfrm.hxx>
48 #include <dflyobj.hxx>
49 #include <pagefrm.hxx>
50 #include <notxtfrm.hxx>
51 #include <grfatr.hxx>
52 #include <charatr.hxx>
53 #include <ndnotxt.hxx>
54 #include <ndgrf.hxx>
55 #include <ndole.hxx>
56 #include <swregion.hxx>
57 #include <poolfmt.hxx>
58 #include <mdiexp.hxx>
59 #include <strings.hrc>
60 #include <accessibilityoptions.hxx>
61 #include <com/sun/star/embed/EmbedMisc.hpp>
62 #include <com/sun/star/embed/EmbedStates.hpp>
63 #include <com/sun/star/embed/XEmbeddedObject.hpp>
64 #include <svtools/embedhlp.hxx>
65 #include <dview.hxx>
72 #include <txtfly.hxx>
76 
77 using namespace com::sun::star;
78 
79 static bool GetRealURL( const SwGrfNode& rNd, OUString& rText )
80 {
81  bool bRet = rNd.GetFileFilterNms( &rText, nullptr );
82  if( bRet )
85  if (rText.startsWith("data:image")) rText = "inline image";
86 
87  return bRet;
88 }
89 
90 static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
91  const SwViewShell &rSh, const SwNoTextFrame *pFrame,
92  bool bDefect )
93 {
94  static vcl::Font aFont = [&]()
95  {
96  vcl::Font tmp;
97  tmp.SetWeight( WEIGHT_BOLD );
98  tmp.SetStyleName( OUString() );
99  tmp.SetFamilyName("Arial Unicode");
100  tmp.SetFamily( FAMILY_SWISS );
101  tmp.SetTransparent( true );
102  return tmp;
103  }();
104 
105  Color aCol( COL_RED );
106  FontLineStyle eUnderline = LINESTYLE_NONE;
107  const SwFormatURL &rURL = pFrame->FindFlyFrame()->GetFormat()->GetURL();
108  if( !rURL.GetURL().isEmpty() || rURL.GetMap() )
109  {
110  bool bVisited = false;
111  if ( rURL.GetMap() )
112  {
113  ImageMap *pMap = const_cast<ImageMap*>(rURL.GetMap());
114  for( size_t i = 0; i < pMap->GetIMapObjectCount(); ++i )
115  {
116  IMapObject *pObj = pMap->GetIMapObject( i );
117  if( rSh.GetDoc()->IsVisitedURL( pObj->GetURL() ) )
118  {
119  bVisited = true;
120  break;
121  }
122  }
123  }
124  else if ( !rURL.GetURL().isEmpty() )
125  bVisited = rSh.GetDoc()->IsVisitedURL( rURL.GetURL() );
126 
127  SwFormat *pFormat = rSh.GetDoc()->getIDocumentStylePoolAccess().GetFormatFromPool( static_cast<sal_uInt16>
129  aCol = pFormat->GetColor().GetValue();
130  eUnderline = pFormat->GetUnderline().GetLineStyle();
131  }
132 
133  aFont.SetUnderline( eUnderline );
134  aFont.SetColor( aCol );
135 
136  const BitmapEx& rBmp = const_cast<SwViewShell&>(rSh).GetReplacementBitmap(bDefect);
137  Graphic::DrawEx( rSh.GetOut(), rText, aFont, rBmp, rRect.Pos(), rRect.SSize() );
138 }
139 
141 : SwContentFrame( pNode, pSib ),
142  // RotateFlyFrame3
143  mpTransformableSwFrame()
144 {
146 }
147 
149 {
150  return new SwNoTextFrame(this, pSib);
151 }
152 
154 {
155  StopAnimation();
156 
158 }
159 
161 {
162 }
163 
164 void SetOutDev( SwViewShell *pSh, OutputDevice *pOut )
165 {
166  pSh->mpOut = pOut;
167 }
168 
169 static void lcl_ClearArea( const SwFrame &rFrame,
170  vcl::RenderContext &rOut, const SwRect& rPtArea,
171  const SwRect &rGrfArea )
172 {
173  SwRegionRects aRegion( rPtArea, 4 );
174  aRegion -= rGrfArea;
175 
176  if ( !aRegion.empty() )
177  {
178  const SvxBrushItem *pItem;
179  const Color *pCol;
180  SwRect aOrigRect;
182 
183  if ( rFrame.GetBackgroundBrush( aFillAttributes, pItem, pCol, aOrigRect, false, /*bConsiderTextBox=*/false ) )
184  {
185  SwRegionRects const region(rPtArea);
186  basegfx::utils::B2DClipState aClipState;
187  const bool bDone(::DrawFillAttributes(aFillAttributes, aOrigRect, region, aClipState, rOut));
188 
189  if(!bDone)
190  {
191  for( const auto &rRegion : aRegion )
192  {
193  ::DrawGraphic( pItem, &rOut, aOrigRect, rRegion );
194  }
195  }
196  }
197  else
198  {
199  rOut.Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
200  rOut.SetFillColor( rFrame.getRootFrame()->GetCurrShell()->Imp()->GetRetoucheColor());
201  rOut.SetLineColor();
202  for( const auto &rRegion : aRegion )
203  rOut.DrawRect( rRegion.SVRect() );
204  rOut.Pop();
205  }
206  }
207 }
208 
209 void SwNoTextFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& rRect, SwPrintData const*const) const
210 {
211  if ( getFrameArea().IsEmpty() )
212  return;
213 
214  const SwViewShell* pSh = getRootFrame()->GetCurrShell();
215  if( !pSh->GetViewOptions()->IsGraphic() )
216  {
217  StopAnimation();
218  // #i6467# - no paint of placeholder for page preview
219  if ( pSh->GetWin() && !pSh->IsPreview() )
220  {
221  const SwNoTextNode* pNd = GetNode()->GetNoTextNode();
222  OUString aText( pNd->GetTitle() );
223  if ( aText.isEmpty() && pNd->IsGrfNode() )
224  GetRealURL( *static_cast<const SwGrfNode*>(pNd), aText );
225  if( aText.isEmpty() )
226  aText = FindFlyFrame()->GetFormat()->GetName();
227  lcl_PaintReplacement( getFrameArea(), aText, *pSh, this, false );
228  }
229  return;
230  }
231 
233  // #i9684# Stop animation during printing/pdf export
234  !pSh->GetWin() )
235  StopAnimation();
236 
237  SfxProgress::EnterLock(); // No progress reschedules in paint (SwapIn)
238 
239  rRenderContext.Push();
240  bool bClip = true;
241  tools::PolyPolygon aPoly;
242 
243  SwNoTextNode& rNoTNd = const_cast<SwNoTextNode&>(*static_cast<const SwNoTextNode*>(GetNode()));
244  SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
245  if( pGrfNd )
246  pGrfNd->SetFrameInPaint( true );
247 
248  // #i13147# - add 2nd parameter with value <true> to
249  // method call <FindFlyFrame().GetContour(..)> to indicate that it is called
250  // for paint in order to avoid load of the intrinsic graphic.
251  if ( ( !rRenderContext.GetConnectMetaFile() ||
252  !pSh->GetWin() ) &&
253  FindFlyFrame()->GetContour( aPoly, true )
254  )
255  {
256  rRenderContext.SetClipRegion(vcl::Region(aPoly));
257  bClip = false;
258  }
259 
260  SwRect aOrigPaint( rRect );
261  if ( HasAnimation() && pSh->GetWin() )
262  {
263  aOrigPaint = getFrameArea(); aOrigPaint += getFramePrintArea().Pos();
264  }
265 
266  SwRect aGrfArea( getFrameArea() );
267  SwRect aPaintArea( aGrfArea );
268 
269  // In case the picture fly frm was clipped, render it with the origin
270  // size instead of scaling it
272  {
273  const SwFlyFreeFrame *pFly = dynamic_cast< const SwFlyFreeFrame* >( FindFlyFrame() );
274  if( pFly )
275  {
276  bool bGetUnclippedFrame=true;
277  const SfxPoolItem* pItem;
278  if( pFly->GetFormat() && SfxItemState::SET == pFly->GetFormat()->GetItemState(RES_BOX, false, &pItem) )
279  {
280  const SvxBoxItem& rBox = *static_cast<const SvxBoxItem*>(pItem);
281  if( rBox.HasBorder( /*bTreatPaddingAsBorder*/true) )
282  bGetUnclippedFrame = false;
283  }
284 
285  if( bGetUnclippedFrame )
286  aGrfArea = SwRect( getFrameArea().Pos( ), pFly->GetUnclippedFrame( ).SSize( ) );
287  }
288  }
289 
290  aPaintArea.Intersection_( aOrigPaint );
291 
293  aNormal.Justify(); // Normalized rectangle for the comparisons
294 
295  if( aPaintArea.IsOver( aNormal ) )
296  {
297  // Calculate the four to-be-deleted rectangles
298  if( pSh->GetWin() )
299  ::lcl_ClearArea( *this, rRenderContext, aPaintArea, aNormal );
300 
301  // The intersection of the PaintArea and the Bitmap contains the absolutely visible area of the Frame
302  aPaintArea.Intersection_( aNormal );
303 
304  if ( bClip )
305  rRenderContext.IntersectClipRegion( aPaintArea.SVRect() );
307  PaintPicture( &rRenderContext, aGrfArea );
308  }
309  else
310  // If it's not visible, simply delete the given Area
311  lcl_ClearArea( *this, rRenderContext, aPaintArea, SwRect() );
312  if( pGrfNd )
313  pGrfNd->SetFrameInPaint( false );
314 
315  rRenderContext.Pop();
317 }
318 
326 static void lcl_CalcRect( Point& rPt, Size& rDim, MirrorGraph nMirror )
327 {
328  if( nMirror == MirrorGraph::Vertical || nMirror == MirrorGraph::Both )
329  {
330  rPt.setX(rPt.getX() + rDim.Width() -1);
331  rDim.setWidth( -rDim.Width() );
332  }
333 
334  if( nMirror == MirrorGraph::Horizontal || nMirror == MirrorGraph::Both )
335  {
336  rPt.setY(rPt.getY() + rDim.Height() -1);
337  rDim.setHeight( -rDim.Height() );
338  }
339 }
340 
342 void SwNoTextFrame::GetGrfArea( SwRect &rRect, SwRect* pOrigRect ) const
343 {
344  // Currently only used for scaling, cropping and mirroring the contour of graphics!
345  // Everything else is handled by GraphicObject
346  // We put the graphic's visible rectangle into rRect.
347  // pOrigRect contains position and size of the whole graphic.
348 
349  // RotateFlyFrame3: SwFrame may be transformed. Get untransformed
350  // SwRect(s) as base of calculation
351  const TransformableSwFrame* pTransformableSwFrame(getTransformableSwFrame());
352  const SwRect aFrameArea(pTransformableSwFrame ? pTransformableSwFrame->getUntransformedFrameArea() : getFrameArea());
353  const SwRect aFramePrintArea(pTransformableSwFrame ? pTransformableSwFrame->getUntransformedFramePrintArea() : getFramePrintArea());
354 
355  const SwAttrSet& rAttrSet = GetNode()->GetSwAttrSet();
356  const SwCropGrf& rCrop = rAttrSet.GetCropGrf();
357  MirrorGraph nMirror = rAttrSet.GetMirrorGrf().GetValue();
358 
359  if( rAttrSet.GetMirrorGrf().IsGrfToggle() )
360  {
361  if( !(FindPageFrame()->GetVirtPageNum() % 2) )
362  {
363  switch ( nMirror )
364  {
365  case MirrorGraph::Dont: nMirror = MirrorGraph::Vertical; break;
366  case MirrorGraph::Vertical: nMirror = MirrorGraph::Dont; break;
367  case MirrorGraph::Horizontal: nMirror = MirrorGraph::Both; break;
368  default: nMirror = MirrorGraph::Horizontal; break;
369  }
370  }
371  }
372 
373  // We read graphic from the Node, if needed.
374  // It may fail, however.
375  long nLeftCrop, nRightCrop, nTopCrop, nBottomCrop;
376  Size aOrigSz( static_cast<const SwNoTextNode*>(GetNode())->GetTwipSize() );
377  if ( !aOrigSz.Width() )
378  {
379  aOrigSz.setWidth( aFramePrintArea.Width() );
380  nLeftCrop = -rCrop.GetLeft();
381  nRightCrop = -rCrop.GetRight();
382  }
383  else
384  {
385  nLeftCrop = std::max( aOrigSz.Width() -
386  (rCrop.GetRight() + rCrop.GetLeft()), long(1) );
387  const double nScale = double(aFramePrintArea.Width()) / double(nLeftCrop);
388  nLeftCrop = long(nScale * -rCrop.GetLeft() );
389  nRightCrop = long(nScale * -rCrop.GetRight() );
390  }
391 
392  // crop values have to be mirrored too
393  if( nMirror == MirrorGraph::Vertical || nMirror == MirrorGraph::Both )
394  {
395  long nTmpCrop = nLeftCrop;
396  nLeftCrop = nRightCrop;
397  nRightCrop= nTmpCrop;
398  }
399 
400  if( !aOrigSz.Height() )
401  {
402  aOrigSz.setHeight( aFramePrintArea.Height() );
403  nTopCrop = -rCrop.GetTop();
404  nBottomCrop= -rCrop.GetBottom();
405  }
406  else
407  {
408  nTopCrop = std::max( aOrigSz.Height() - (rCrop.GetTop() + rCrop.GetBottom()), long(1) );
409  const double nScale = double(aFramePrintArea.Height()) / double(nTopCrop);
410  nTopCrop = long(nScale * -rCrop.GetTop() );
411  nBottomCrop= long(nScale * -rCrop.GetBottom() );
412  }
413 
414  // crop values have to be mirrored too
415  if( nMirror == MirrorGraph::Horizontal || nMirror == MirrorGraph::Both )
416  {
417  long nTmpCrop = nTopCrop;
418  nTopCrop = nBottomCrop;
419  nBottomCrop= nTmpCrop;
420  }
421 
422  Size aVisSz( aFramePrintArea.SSize() );
423  Size aGrfSz( aVisSz );
424  Point aVisPt( aFrameArea.Pos() + aFramePrintArea.Pos() );
425  Point aGrfPt( aVisPt );
426 
427  // Set the "visible" rectangle first
428  if ( nLeftCrop > 0 )
429  {
430  aVisPt.setX(aVisPt.getX() + nLeftCrop);
431  aVisSz.AdjustWidth( -nLeftCrop );
432  }
433  if ( nTopCrop > 0 )
434  {
435  aVisPt.setY(aVisPt.getY() + nTopCrop);
436  aVisSz.AdjustHeight( -nTopCrop );
437  }
438  if ( nRightCrop > 0 )
439  aVisSz.AdjustWidth( -nRightCrop );
440  if ( nBottomCrop > 0 )
441  aVisSz.AdjustHeight( -nBottomCrop );
442 
443  rRect.Pos ( aVisPt );
444  rRect.SSize( aVisSz );
445 
446  // Calculate the whole graphic if needed
447  if ( pOrigRect )
448  {
449  Size aTmpSz( aGrfSz );
450  aGrfPt.setX(aGrfPt.getX() + nLeftCrop);
451  aTmpSz.AdjustWidth( -(nLeftCrop + nRightCrop) );
452  aGrfPt.setY(aGrfPt.getY() + nTopCrop);
453  aTmpSz.AdjustHeight( -(nTopCrop + nBottomCrop) );
454 
455  if( MirrorGraph::Dont != nMirror )
456  lcl_CalcRect( aGrfPt, aTmpSz, nMirror );
457 
458  pOrigRect->Pos ( aGrfPt );
459  pOrigRect->SSize( aTmpSz );
460  }
461 }
462 
465 {
466  // Return the Frame's size
467  const SwFrame *pFly = FindFlyFrame();
468  if( !pFly )
469  pFly = this;
470  return pFly->getFramePrintArea().SSize();
471 }
472 
474 {
475  // RotateFlyFrame3 - inner frame. Get rotation and check if used
476  const double fRotation(getLocalFrameRotation());
477  const bool bRotated(!basegfx::fTools::equalZero(fRotation));
478 
479  if(bRotated)
480  {
481  SwFlyFreeFrame* pUpperFly(dynamic_cast< SwFlyFreeFrame* >(GetUpper()));
482 
483  if(pUpperFly)
484  {
485  if(!pUpperFly->isFrameAreaDefinitionValid())
486  {
487  // RotateFlyFrame3: outer frame *needs* to be layouted first, force this by calling
488  // it's ::Calc directly
489  pUpperFly->Calc(pRenderContext);
490  }
491 
492  // Reset outer frame to unrotated state. This is necessary to make the
493  // layouting below work as currently implemented in Writer. As expected
494  // using Transformations allows to do this on the fly due to all information
495  // being included there.
496  // The full solution would be to adapt the whole layouting
497  // process of Writer to take care of Transformations, but that
498  // is currently beyond scope
499  if(pUpperFly->isTransformableSwFrame())
500  {
502  }
503  }
504 
505  // Re-layout may be partially (see all isFrameAreaDefinitionValid() flags),
506  // so resetting the local SwFrame(s) in the local SwFrameAreaDefinition is also
507  // needed (e.g. for PrintPreview).
508  // Reset to BoundAreas will be done below automatically
510  {
512  }
513  }
514 
515  SwContentNotify aNotify( this );
516  SwBorderAttrAccess aAccess( SwFrame::GetCache(), this );
517  const SwBorderAttrs &rAttrs = *aAccess.Get();
518 
520  {
521  MakePos();
522 
523  if ( !isFrameAreaSizeValid() )
524  {
526  aFrm.Width( GetUpper()->getFramePrintArea().Width() );
527  }
528 
529  MakePrtArea( rAttrs );
530 
531  if ( !isFrameAreaSizeValid() )
532  {
533  setFrameAreaSizeValid(true);
534  Format(getRootFrame()->GetCurrShell()->GetOut());
535  }
536  }
537 
538  // RotateFlyFrame3 - inner frame
539  if(bRotated)
540  {
541  SwFlyFreeFrame* pUpperFly(dynamic_cast< SwFlyFreeFrame* >(GetUpper()));
542 
543  if(pUpperFly)
544  {
545  // restore outer frame back to Transformed state, that means
546  // set the SwFrameAreaDefinition(s) back to BoundAreas of
547  // the transformed SwFrame. All needed information is part
548  // of the already correctly created Transformations of the
549  // upper frame, so it can be re-created on the fly
550  if(pUpperFly->isTransformableSwFrame())
551  {
553  }
554  }
555 
556  // After the unrotated layout is finished, apply possible set rotation to it
557  // get center from outer frame (layout frame) to be on the safe side
558  const Point aCenter(GetUpper() ? GetUpper()->getFrameArea().Center() : getFrameArea().Center());
559  const basegfx::B2DPoint aB2DCenter(aCenter.X(), aCenter.Y());
560 
562  {
564  }
565 
567  fRotation,
568  aB2DCenter);
570  }
571  else
572  {
573  // reset transformations to show that they are not used
574  mpTransformableSwFrame.reset();
575  }
576 }
577 
578 // RotateFlyFrame3 - Support for Transformations - outer frame
580 {
582  {
583  // use pre-created transformation
585  }
586 
587  // call parent
589 }
590 
592 {
594  {
595  // use pre-created transformation
597  }
598 
599  // call parent
601 }
602 
603 // RotateFlyFrame3 - Support for Transformations
605 {
606  // call parent - this will do the basic transform for SwRect(s)
607  // in the SwFrameAreaDefinition
609 
610  // check if the Transformations need to be adapted
612  {
613  const basegfx::B2DHomMatrix aTransform(
615  rOffset.X(), rOffset.Y()));
616 
617  // transform using TransformableSwFrame
618  getTransformableSwFrame()->transform(aTransform);
619  }
620 }
621 
622 // RotateFlyFrame3 - inner frame
623 // Check if we contain a SwGrfNode and get possible rotation from it
625 {
626  const SwNoTextNode* pSwNoTextNode(nullptr != GetNode() ? GetNode()->GetNoTextNode() : nullptr);
627 
628  if(nullptr != pSwNoTextNode)
629  {
630  const SwGrfNode* pSwGrfNode(pSwNoTextNode->GetGrfNode());
631 
632  if(nullptr != pSwGrfNode)
633  {
634  const SwAttrSet& rSwAttrSet(pSwGrfNode->GetSwAttrSet());
635  const SwRotationGrf& rSwRotationGrf(rSwAttrSet.GetRotationGrf());
636  const double fRotate(static_cast< double >(-rSwRotationGrf.GetValue()) * (M_PI/1800.0));
637 
638  return basegfx::normalizeToRange(fRotate, F_2PI);
639  }
640  }
641 
642  // no rotation
643  return 0.0;
644 }
645 
647 void SwNoTextFrame::Format( vcl::RenderContext* /*pRenderContext*/, const SwBorderAttrs * )
648 {
649  const Size aNewSize( GetSize() );
650 
651  // Did the height change?
652  SwTwips nChgHght = IsVertical() ?
653  static_cast<SwTwips>(aNewSize.Width() - getFramePrintArea().Width()) :
654  static_cast<SwTwips>(aNewSize.Height() - getFramePrintArea().Height());
655  if( nChgHght > 0)
656  Grow( nChgHght );
657  else if( nChgHght < 0)
658  Shrink( std::min(getFramePrintArea().Height(), -nChgHght) );
659 }
660 
661 bool SwNoTextFrame::GetCharRect( SwRect &rRect, const SwPosition& rPos,
662  SwCursorMoveState *pCMS, bool /*bAllowFarAway*/ ) const
663 {
664  if ( &rPos.nNode.GetNode() != static_cast<SwNode const *>(GetNode()) )
665  return false;
666 
667  Calc(getRootFrame()->GetCurrShell()->GetOut());
668  SwRect aFrameRect( getFrameArea() );
669  rRect = aFrameRect;
670  rRect.Pos( getFrameArea().Pos() + getFramePrintArea().Pos() );
671  rRect.SSize( getFramePrintArea().SSize() );
672 
673  rRect.Justify();
674 
675  // Is the Bitmap in the visible area at all?
676  if( !aFrameRect.IsOver( rRect ) )
677  {
678  // If not, then the Cursor is on the Frame
679  rRect = aFrameRect;
680  rRect.Width( 1 );
681  }
682  else
683  rRect.Intersection_( aFrameRect );
684 
685  if ( pCMS && pCMS->m_bRealHeight )
686  {
687  pCMS->m_aRealHeight.setY(rRect.Height());
688  pCMS->m_aRealHeight.setX(0);
689  }
690 
691  return true;
692 }
693 
695  SwCursorMoveState*, bool ) const
696 {
697  SwContentNode* pCNd = const_cast<SwContentNode*>(GetNode());
698  pPos->nNode = *pCNd;
699  pPos->nContent.Assign( pCNd, 0 );
700  return true;
701 }
702 
704 {
705  SwFlyFrame* pFly = FindFlyFrame();
706  if( pFly && pFly->GetFormat()->GetSurround().IsContour() )
707  {
708  ClrContourCache( pFly->GetVirtDrawObj() );
710  }
711 }
712 
713 void SwNoTextFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
714 {
715  sal_uInt16 nWhich = pNew ? pNew->Which() : pOld ? pOld->Which() : 0;
716 
717  // #i73788#
718  // no <SwContentFrame::Modify(..)> for RES_LINKED_GRAPHIC_STREAM_ARRIVED
719  if ( RES_GRAPHIC_PIECE_ARRIVED != nWhich &&
720  RES_GRAPHIC_ARRIVED != nWhich &&
721  RES_GRF_REREAD_AND_INCACHE != nWhich &&
723  {
724  SwContentFrame::Modify( pOld, pNew );
725  }
726 
727  bool bComplete = true;
728 
729  switch( nWhich )
730  {
731  case RES_OBJECTDYING:
732  break;
733 
735  if( SwNodeType::Grf == GetNode()->GetNodeType() )
736  {
737  // TODO: Remove - due to GraphicObject refactoring
738  bComplete = false;
739  }
740  break;
741 
742  case RES_UPDATE_ATTR:
743  if (GetNode()->GetNodeType() != SwNodeType::Grf) {
744  break;
745  }
746  [[fallthrough]];
747  case RES_FMT_CHG:
748  ClearCache();
749  break;
750 
751  case RES_ATTRSET_CHG:
752  {
753  sal_uInt16 n;
754  for( n = RES_GRFATR_BEGIN; n < RES_GRFATR_END; ++n )
755  if( SfxItemState::SET == static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->
756  GetItemState( n, false ))
757  {
758  ClearCache();
759 
760  if(RES_GRFATR_ROTATION == n)
761  {
762  // RotGrfFlyFrame: Update Handles in view, these may be rotation-dependent
763  // (e.g. crop handles) and need a visualisation update
764  if ( GetNode()->GetNodeType() == SwNodeType::Grf )
765  {
766  SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
768 
769  if(pVSh)
770  {
771  SdrView* pDrawView = pVSh->GetDrawView();
772 
773  if(pDrawView)
774  {
775  pDrawView->AdjustMarkHdl(nullptr);
776  }
777  }
778 
779  // RotateFlyFrame3 - invalidate needed for ContentFrame (inner, this)
780  // and LayoutFrame (outer, GetUpper). It is possible to only invalidate
781  // the outer frame, but that leads to an in-between state that gets
782  // potentially painted
783  if(GetUpper())
784  {
786  }
787 
788  InvalidateAll_();
789  }
790  }
791  break;
792  }
793  if( RES_GRFATR_END == n ) // not found
794  return ;
795  }
796  break;
797 
799  case RES_GRAPHIC_ARRIVED:
800  // i73788# - handle RES_LINKED_GRAPHIC_STREAM_ARRIVED as RES_GRAPHIC_ARRIVED
802  if ( GetNode()->GetNodeType() == SwNodeType::Grf )
803  {
804  bComplete = false;
805  SwGrfNode* pNd = static_cast<SwGrfNode*>( GetNode());
806 
807  ClearCache();
808 
809  SwRect aRect( getFrameArea() );
810 
812  if( !pVSh )
813  break;
814 
815  for(SwViewShell& rShell : pVSh->GetRingContainer())
816  {
817  SET_CURR_SHELL( &rShell );
818  if( rShell.IsPreview() )
819  {
820  if( rShell.GetWin() )
821  ::RepaintPagePreview( &rShell, aRect );
822  }
823  else if ( rShell.VisArea().IsOver( aRect ) &&
824  OUTDEV_WINDOW == rShell.GetOut()->GetOutDevType() )
825  {
826  // invalidate instead of painting
827  rShell.GetWin()->Invalidate( aRect.SVRect() );
828  }
829  }
830  }
831  break;
832 
833  default:
834  if ( !pNew || !isGRFATR(nWhich) )
835  return;
836  }
837 
838  if( bComplete )
839  {
840  InvalidatePrt();
842  }
843 }
844 
845 static void lcl_correctlyAlignRect( SwRect& rAlignedGrfArea, const SwRect& rInArea, vcl::RenderContext const * pOut )
846 {
847 
848  if(!pOut)
849  return;
850  tools::Rectangle aPxRect = pOut->LogicToPixel( rInArea.SVRect() );
851  tools::Rectangle aNewPxRect( aPxRect );
852  while( aNewPxRect.Left() < aPxRect.Left() )
853  {
854  rAlignedGrfArea.Left( rAlignedGrfArea.Left()+1 );
855  aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
856  }
857  while( aNewPxRect.Top() < aPxRect.Top() )
858  {
859  rAlignedGrfArea.Top( rAlignedGrfArea.Top()+1 );
860  aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
861  }
862  while( aNewPxRect.Bottom() > aPxRect.Bottom() )
863  {
864  rAlignedGrfArea.Bottom( rAlignedGrfArea.Bottom()-1 );
865  aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
866  }
867  while( aNewPxRect.Right() > aPxRect.Right() )
868  {
869  rAlignedGrfArea.Right( rAlignedGrfArea.Right()-1 );
870  aNewPxRect = pOut->LogicToPixel( rAlignedGrfArea.SVRect() );
871  }
872 }
873 
875  vcl::RenderContext& rOutputDevice,
877  const basegfx::B2DRange& rSourceRange,
878  const basegfx::B2DRange& rTargetRange)
879 {
880  if(!rSequence.empty() && !basegfx::fTools::equalZero(rSourceRange.getWidth()) && !basegfx::fTools::equalZero(rSourceRange.getHeight()))
881  {
882  if(!basegfx::fTools::equalZero(rTargetRange.getWidth()) && !basegfx::fTools::equalZero(rTargetRange.getHeight()))
883  {
884  // map graphic range to target range. This will e.g. automatically include
885  // the mapping from 1/100th mm content to twips if needed when the target
886  // range is defined in twips
887  const basegfx::B2DHomMatrix aMappingTransform(
889  rSourceRange,
890  rTargetRange));
891 
892  // Fill ViewInformation. Use MappingTransform here, so there is no need to
893  // embed the primitives to it. Use original TargetRange here so there is also
894  // no need to embed the primitives to a MaskPrimitive for cropping. This works
895  // only in this case where the graphic object cannot be rotated, though.
896  const drawinglayer::geometry::ViewInformation2D aViewInformation2D(
897  aMappingTransform,
898  rOutputDevice.GetViewTransformation(),
899  rTargetRange,
900  nullptr,
901  0.0,
902  uno::Sequence< beans::PropertyValue >());
903 
904  // get a primitive processor for rendering
905  std::unique_ptr<drawinglayer::processor2d::BaseProcessor2D> pProcessor2D(
907  rOutputDevice, aViewInformation2D) );
908  if(pProcessor2D)
909  {
910  // render and cleanup
911  pProcessor2D->process(rSequence);
912  return true;
913  }
914  }
915  }
916 
917  return false;
918 }
919 
921  vcl::RenderContext & rOutputDevice,
922  GraphicObject const& rGrfObj,
923  GraphicAttr const& rGraphicAttr,
924  const basegfx::B2DHomMatrix& rGraphicTransform,
925  const OUString& rName,
926  const OUString& rTitle,
927  const OUString& rDescription)
928 {
929  // RotGrfFlyFrame: unify using GraphicPrimitive2D
930  // -> the primitive handles all crop and mirror stuff
931  // -> the primitive renderer will create the needed pdf export data
932  // -> if bitmap content, it will be cached system-dependent
934 
936  rGraphicTransform,
937  rGrfObj,
938  rGraphicAttr);
939 
940  // RotateFlyFrame3: If ClipRegion is set at OutputDevice, we
941  // need to use that. Usually the renderer would be a VCL-based
942  // PrimitiveRenderer, but there are system-specific shortcuts that
943  // will *not* use the VCL-Paint of Bitmap and thus ignore this.
944  // Anyways, indirectly using a CLipRegion set at the target OutDev
945  // when using a PrimitiveRenderer is a non-valid implication.
946  // First tried only to use when HasPolyPolygonOrB2DPolyPolygon(),
947  // but there is an optimization at ClipRegion creation that detects
948  // a single Rectangle in a tools::PolyPolygon and forces to a simple
949  // RegionBand-based implementation, so cannot use it here.
950  if(rOutputDevice.IsClipRegion())
951  {
952  const basegfx::B2DPolyPolygon aClip(rOutputDevice.GetClipRegion().GetAsB2DPolyPolygon());
953 
954  if(0 != aClip.count())
955  {
956  // tdf#114076: Expand ClipRange to next PixelBound
957  // Do this by going to basegfx::B2DRange, adding a
958  // single pixel size and using floor/ceil to go to
959  // full integer (as needed for pixels). Also need
960  // to go back to basegfx::B2DPolyPolygon for the
961  // creation of the needed MaskPrimitive2D.
962  // The general problem is that Writer is scrolling
963  // using blitting the unchanged parts, this forces
964  // this part of the scroll to pixel coordinate steps,
965  // while the ViewTransformation for paint nowadays has
966  // a sub-pixel precision. This results in an offset
967  // up to one pixel in radius. To solve this for now,
968  // we need to expand to the next outer pixel bound.
969  // Hopefully in the future we will someday be able to
970  // stay on the full available precision, but this
971  // will need a change in the repaint/scroll paradigm.
972  const basegfx::B2DRange aClipRange(aClip.getB2DRange());
973  const basegfx::B2DVector aSinglePixelXY(rOutputDevice.GetInverseViewTransformation() * basegfx::B2DVector(1.0, 1.0));
974  const basegfx::B2DRange aExpandedClipRange(
975  floor(aClipRange.getMinX() - aSinglePixelXY.getX()),
976  floor(aClipRange.getMinY() - aSinglePixelXY.getY()),
977  ceil(aClipRange.getMaxX() + aSinglePixelXY.getX()),
978  ceil(aClipRange.getMaxY() + aSinglePixelXY.getY()));
979 
980  // create the enclosing rectangle as polygon
982 
983  // tdf#124272 the fix above (tdf#114076) was too rough - the
984  // clip region used may be a PolyPolygon. In that case that
985  // PolyPolygon would have to be scaled to mentioned PixelBounds.
986  // Since that is not really possible geometrically (would need
987  // more some 'grow in outside direction' but with unequal grow
988  // values in all directions - just maaany problems
989  // involved), use a graphical trick: The topology of the
990  // PolyPolygon uses the standard FillRule, so adding the now
991  // guaranteed to be bigger or equal bounding (enclosing)
992  // rectangle twice as polygon will expand the BoundRange, but
993  // not change the geometry visualization at all
994  if(!rOutputDevice.GetClipRegion().IsRectangle())
995  {
996  // double the outer rectangle range polygon to have it
997  // included twice
998  aTarget.append(aTarget.getB2DPolygon(0));
999 
1000  // add the original clip 'inside' (due to being smaller
1001  // or equal). That PolyPolygon may have an unknown number
1002  // of polygons (>=1)
1003  aTarget.append(aClip);
1004  }
1005 
1007  aTarget,
1008  aContent);
1009  }
1010  }
1011 
1012  if(!rName.isEmpty() || !rTitle.isEmpty() || !rDescription.isEmpty())
1013  {
1014  // Embed to ObjectInfoPrimitive2D when we have Name/Title/Description
1015  // information available
1017  aContent,
1018  rName,
1019  rTitle,
1020  rDescription);
1021  }
1022 
1023  basegfx::B2DRange aTargetRange(0.0, 0.0, 1.0, 1.0);
1024  aTargetRange.transform(rGraphicTransform);
1025 
1027  rOutputDevice,
1028  aContent,
1029  aTargetRange,
1030  aTargetRange);
1031 }
1032 
1040 void SwNoTextFrame::PaintPicture( vcl::RenderContext* pOut, const SwRect &rGrfArea ) const
1041 {
1042  SwViewShell* pShell = getRootFrame()->GetCurrShell();
1043 
1044  SwNoTextNode& rNoTNd = const_cast<SwNoTextNode&>(*static_cast<const SwNoTextNode*>(GetNode()));
1045  SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
1046  SwOLENode* pOLENd = rNoTNd.GetOLENode();
1047 
1048  const bool bPrn = pOut == rNoTNd.getIDocumentDeviceAccess().getPrinter( false ) ||
1049  pOut->GetConnectMetaFile();
1050 
1051  const bool bIsChart = pOLENd && pOLENd->GetOLEObj().GetObject().IsChart();
1052 
1053  // calculate aligned rectangle from parameter <rGrfArea>.
1054  // Use aligned rectangle <aAlignedGrfArea> instead of <rGrfArea> in
1055  // the following code.
1056  SwRect aAlignedGrfArea = rGrfArea;
1057  ::SwAlignRect( aAlignedGrfArea, pShell, pOut );
1058 
1059  if( !bIsChart )
1060  {
1061  // Because for drawing a graphic left-top-corner and size coordinations are
1062  // used, these coordinations have to be determined on pixel level.
1063  ::SwAlignGrfRect( &aAlignedGrfArea, *pOut );
1064  }
1065  else //if( bIsChart )
1066  {
1067  // #i78025# charts own borders are not completely visible
1068  // the above pixel correction is not correct - at least not for charts
1069  // so a different pixel correction is chosen here
1070  // this might be a good idea for all other OLE objects also,
1071  // but as I cannot oversee the consequences I fix it only for charts for now
1072  lcl_correctlyAlignRect( aAlignedGrfArea, rGrfArea, pOut );
1073  }
1074 
1075  if( pGrfNd )
1076  {
1077  // Fix for bug fdo#33781
1078  const AntialiasingFlags nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
1079  if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
1080  {
1081  pOut->SetAntialiasing( nFormerAntialiasingAtOutput | AntialiasingFlags::EnableB2dDraw );
1082  }
1083 
1084  bool bContinue = true;
1085  const GraphicObject& rGrfObj = pGrfNd->GetGrfObj(bPrn);
1086 
1087  GraphicAttr aGrfAttr;
1088  pGrfNd->GetGraphicAttr( aGrfAttr, this );
1089 
1090  if( !bPrn )
1091  {
1092  // #i73788#
1093  if ( pGrfNd->IsLinkedInputStreamReady() )
1094  {
1095  pGrfNd->UpdateLinkWithInputStream();
1096  }
1097  // #i85717#, #i90395# - check, if asynchronous retrieval
1098  // if input stream for the graphic is possible
1099  else if ( ( rGrfObj.GetType() == GraphicType::Default ||
1100  rGrfObj.GetType() == GraphicType::NONE ) &&
1101  pGrfNd->IsLinkedFile() &&
1103  {
1104  Size aTmpSz;
1105  ::sfx2::SvLinkSource* pGrfObj = pGrfNd->GetLink()->GetObj();
1106  if( !pGrfObj ||
1107  !pGrfObj->IsDataComplete() ||
1108  !(aTmpSz = pGrfNd->GetTwipSize()).Width() ||
1109  !aTmpSz.Height())
1110  {
1111  pGrfNd->TriggerAsyncRetrieveInputStream(); // #i73788#
1112  }
1113  OUString aText( pGrfNd->GetTitle() );
1114  if ( aText.isEmpty() )
1115  GetRealURL( *pGrfNd, aText );
1116  ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, false );
1117  bContinue = false;
1118  }
1119  }
1120 
1121  if( bContinue )
1122  {
1123  if( rGrfObj.GetGraphic().IsSupportedGraphic())
1124  {
1125  const bool bAnimate = rGrfObj.IsAnimated() &&
1126  !pShell->IsPreview() &&
1128  // #i9684# Stop animation during printing/pdf export
1129  pShell->GetWin();
1130 
1131  if( bAnimate &&
1132  FindFlyFrame() != ::GetFlyFromMarked( nullptr, pShell ))
1133  {
1134  OutputDevice* pVout;
1135  if( pOut == pShell->GetOut() && SwRootFrame::FlushVout() )
1136  {
1137  pVout = pOut;
1138  pOut = pShell->GetOut();
1139  }
1140  else if( pShell->GetWin() && pOut->IsVirtual() )
1141  {
1142  pVout = pOut;
1143  pOut = pShell->GetWin();
1144  }
1145  else
1146  pVout = nullptr;
1147 
1148  OSL_ENSURE( !pOut->IsVirtual() ||
1149  pShell->GetViewOptions()->IsPDFExport() || pShell->isOutputToWindow(),
1150  "pOut should not be a virtual device" );
1151 
1152  pGrfNd->StartGraphicAnimation(pOut, aAlignedGrfArea.Pos(),
1153  aAlignedGrfArea.SSize(), sal_IntPtr(this),
1154  pVout );
1155  }
1156  else
1157  {
1158  const basegfx::B2DHomMatrix aGraphicTransform(getFrameAreaTransformation());
1159 
1161  *pOut,
1162  rGrfObj,
1163  aGrfAttr,
1164  aGraphicTransform,
1165  nullptr == pGrfNd->GetFlyFormat() ? OUString() : pGrfNd->GetFlyFormat()->GetName(),
1166  rNoTNd.GetTitle(),
1167  rNoTNd.GetDescription());
1168  }
1169  }
1170  else
1171  {
1172  const char* pResId = nullptr;
1173 
1174  if( GraphicType::NONE == rGrfObj.GetType() )
1175  pResId = STR_COMCORE_READERROR;
1176  else if ( !rGrfObj.GetGraphic().IsSupportedGraphic() )
1177  pResId = STR_COMCORE_CANT_SHOW;
1178 
1179  OUString aText;
1180  if ( !pResId &&
1181  (aText = pGrfNd->GetTitle()).isEmpty() &&
1182  (!GetRealURL( *pGrfNd, aText ) || aText.isEmpty()))
1183  {
1184  pResId = STR_COMCORE_READERROR;
1185  }
1186  if (pResId)
1187  aText = SwResId(pResId);
1188 
1189  ::lcl_PaintReplacement( aAlignedGrfArea, aText, *pShell, this, true );
1190  }
1191  }
1192 
1193  if ( pShell->Imp()->GetDrawView()->IsAntiAliasing() )
1194  pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
1195  }
1196  else // bIsChart || pOLENd
1197  {
1198  // Fix for bug fdo#33781
1199  const AntialiasingFlags nFormerAntialiasingAtOutput( pOut->GetAntialiasing() );
1200  if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
1201  {
1202  AntialiasingFlags nNewAntialiasingAtOutput = nFormerAntialiasingAtOutput | AntialiasingFlags::EnableB2dDraw;
1203 
1204  // #i99665#
1205  // Adjust AntiAliasing mode at output device for chart OLE
1206  if ( pOLENd->IsChart() )
1207  nNewAntialiasingAtOutput |= AntialiasingFlags::PixelSnapHairline;
1208 
1209  pOut->SetAntialiasing( nNewAntialiasingAtOutput );
1210  }
1211 
1212  bool bDone(false);
1213 
1214  if(bIsChart)
1215  {
1216  basegfx::B2DRange aSourceRange;
1219  aSourceRange,
1220  bPrn));
1221 
1222  if(!aSequence.empty() && !aSourceRange.isEmpty())
1223  {
1224  const basegfx::B2DRange aTargetRange(
1225  aAlignedGrfArea.Left(), aAlignedGrfArea.Top(),
1226  aAlignedGrfArea.Right(), aAlignedGrfArea.Bottom());
1227 
1229  *pOut,
1230  aSequence,
1231  aSourceRange,
1232  aTargetRange);
1233  }
1234  }
1235 
1236  if(!bDone && pOLENd)
1237  {
1238  // SwOLENode does not have a known GraphicObject, need to
1239  // work with Graphic instead
1240  const Graphic* pGraphic = pOLENd->GetGraphic();
1241  const Point aPosition(aAlignedGrfArea.Pos());
1242  const Size aSize(aAlignedGrfArea.SSize());
1243 
1244  if ( pGraphic && pGraphic->GetType() != GraphicType::NONE )
1245  {
1246  pGraphic->Draw( pOut, aPosition, aSize );
1247 
1248  // shade the representation if the object is activated outplace
1249  uno::Reference < embed::XEmbeddedObject > xObj = pOLENd->GetOLEObj().GetOleRef();
1250  if ( xObj.is() && xObj->getCurrentState() == embed::EmbedStates::ACTIVE )
1251  {
1252 
1255  aPosition,
1256  aSize),
1257  pOut);
1258  }
1259  }
1260  else
1261  {
1263  tools::Rectangle(aPosition, aSize),
1264  pOLENd->GetOLEObj().GetCurrentPersistName(),
1265  pOut);
1266  }
1267 
1268  sal_Int64 nMiscStatus = pOLENd->GetOLEObj().GetOleRef()->getStatus( pOLENd->GetAspect() );
1269  if ( !bPrn && dynamic_cast< const SwCursorShell *>( pShell ) != nullptr &&
1270  (nMiscStatus & embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE))
1271  {
1272  const SwFlyFrame *pFly = FindFlyFrame();
1273  assert( pFly != nullptr );
1274  static_cast<SwFEShell*>(pShell)->ConnectObj( pOLENd->GetOLEObj().GetObject(), pFly->getFramePrintArea(), pFly->getFrameArea());
1275  }
1276  }
1277 
1278  // see #i99665#
1279  if (pShell->Imp()->GetDrawView()->IsAntiAliasing())
1280  {
1281  pOut->SetAntialiasing( nFormerAntialiasingAtOutput );
1282  }
1283  }
1284 }
1285 
1287 {
1288  const SwViewShell* pSh = getRootFrame()->GetCurrShell();
1289 
1290  if ( !pSh || !pSh->GetViewOptions()->IsGraphic() )
1291  {
1292  return true;
1293  }
1294 
1295  const SwGrfNode *pNd;
1296 
1297  if( nullptr != (pNd = GetNode()->GetGrfNode()) )
1298  {
1299  if(pNd->IsTransparent())
1300  {
1301  return true;
1302  }
1303  }
1304 
1305  // RotateFlyFrame3: If we are transformed, there are 'free' areas between
1306  // the Graphic and the Border/Padding stuff - at least as long as those
1307  // (Border and Padding) are not transformed, too
1309  {
1310  // we can be more specific - rotations of multiples of
1311  // 90 degrees will leave no gaps. Go from [0.0 .. F_2PI]
1312  // to [0 .. 360] and check modulo 90
1313  const long nRot(static_cast<long>(basegfx::rad2deg(getLocalFrameRotation())));
1314  const bool bMultipleOf90(0 == (nRot % 90));
1315 
1316  if(!bMultipleOf90)
1317  {
1318  return true;
1319  }
1320  }
1321 
1322  //#29381# OLE are always transparent
1323  if(nullptr != GetNode()->GetOLENode())
1324  {
1325  return true;
1326  }
1327 
1328  // return false by default to avoid background paint
1329  return false;
1330 }
1331 
1333 {
1334  // Stop animated graphics
1335  const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
1336 
1337  if( pGrfNd && pGrfNd->IsAnimated() )
1338  {
1339  const_cast< SwGrfNode* >(pGrfNd)->StopGraphicAnimation( pOut, sal_IntPtr(this) );
1340  }
1341 }
1342 
1344 {
1345  const SwGrfNode* pGrfNd = GetNode()->GetGrfNode();
1346  return pGrfNd && pGrfNd->IsAnimated();
1347 }
1348 
1349 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetFamily(FontFamily)
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
basegfx::B2DHomMatrix GetInverseViewTransformation() const
void SetClipRegion()
long Width() const
vcl::Region GetClipRegion() const
void transform(const basegfx::B2DHomMatrix &aTransform)
Definition: wsfrm.cxx:284
bool IsContour() const
Definition: fmtsrnd.hxx:53
const SwVirtFlyDrawObj * GetVirtDrawObj() const
Definition: fly.cxx:2721
Base class of the Writer layout elements.
Definition: frame.hxx:295
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const override
Definition: notxtfrm.cxx:591
TransformableSwFrame * getTransformableSwFrame()
Definition: notxtfrm.hxx:84
const SvxColorItem & GetColor(bool=true) const
Definition: charatr.hxx:131
#define RES_GRFATR_END
Definition: hintids.hxx:260
sal_Int64 GetAspect() const
Definition: ndole.hxx:136
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2810
Marks a position in the document model.
Definition: pam.hxx:35
bool IsRectangle() const
sal_Int32 GetLeft() const
void MakePrtArea(const SwBorderAttrs &)
Definition: calcmove.cxx:1069
const tools::SvRef< sfx2::SvBaseLink > & GetLink() const
Definition: ndgrf.hxx:133
void SetAntialiasing(AntialiasingFlags nMode)
const SvxUnderlineItem & GetUnderline(bool=true) const
GetMethods: Bool indicates whether to search only in Set (FALSE) or also in Parents.
Definition: charatr.hxx:121
SdrView * GetDrawView()
Definition: vnew.cxx:375
bool IsGrfNode() const
Definition: node.hxx:656
SwTwips Grow(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1462
double getHeight() const
void DrawGraphic(const SvxBrushItem *, vcl::RenderContext *, const SwRect &rOrg, const SwRect &rOut, const sal_uInt8 nGrfNum=GRFNUM_NO, const bool bConsiderBackgroundTransparency=false)
Definition: paintfrm.cxx:1797
SwOLENode * GetOLENode()
Inline methods from Node.hxx.
Definition: ndole.hxx:161
bool m_bRealHeight
should the real height be calculated?
Definition: crstate.hxx:141
SwRect getUntransformedFramePrintArea() const
Definition: wsfrm.cxx:186
#define RES_ATTRSET_CHG
Definition: hintids.hxx:287
long AdjustWidth(long n)
bool IsAntiAliasing() const
Definition: dview.cxx:124
virtual bool IsVirtual() const
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
SwViewShellImp * Imp()
Definition: viewsh.hxx:185
TransformableSwFrame * getTransformableSwFrame()
Definition: flyfrms.hxx:132
const SwAccessibilityOptions * GetAccessibilityOptions() const
Definition: viewsh.hxx:434
double normalizeToRange(double v, const double fRange)
long Height() const
bool IsGraphic() const
Definition: viewopt.hxx:294
#define RES_GRF_REREAD_AND_INCACHE
Definition: hintids.hxx:306
virtual ~SwNoTextFrame() override
Definition: notxtfrm.cxx:160
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const override
Definition: notxtfrm.cxx:579
SwNodeIndex nNode
Definition: pam.hxx:37
void SetCompletePaint() const
Definition: frame.hxx:970
constexpr::Color COL_RED(0x80, 0x00, 0x00)
virtual basegfx::B2DHomMatrix getFramePrintAreaTransformation() const
Definition: wsfrm.cxx:132
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
static void DrawShading(const tools::Rectangle &rRect, OutputDevice *pOut)
static SwCache & GetCache()
Definition: frame.hxx:500
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:913
SwNoTextFrame(SwNoTextNode *const, SwFrame *)
Definition: notxtfrm.cxx:140
bool IsSupportedGraphic() const
bool IsVisitedURL(const OUString &rURL)
Definition: visiturl.cxx:100
SVL_DLLPUBLIC OUString removePassword(OUString const &rURI, INetURLObject::EncodeMechanism eEncodeMechanism, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8)
void Height(long nNew)
Definition: swrect.hxx:189
VclPtr< OutputDevice > mpOut
Window, Printer, VirtDev, ...
Definition: viewsh.hxx:117
void SetWeight(FontWeight)
bool IsLinkedFile() const
Definition: ndgrf.hxx:165
SwNode & GetNode() const
Definition: ndindex.hxx:119
MirrorGraph
Definition: grfatr.hxx:31
long SwTwips
Definition: swtypes.hxx:49
void IntersectClipRegion(const tools::Rectangle &rRect)
GDIMetaFile * GetConnectMetaFile() const
friend class SwNoTextFrame
Definition: ndnotxt.hxx:33
void Pos(const Point &rNew)
Definition: swrect.hxx:167
RotateFlyFrame3: Helper class when you want to make your SwFrame derivate transformable.
Definition: frame.hxx:231
size_t GetIMapObjectCount() const
virtual void Calc(vcl::RenderContext *pRenderContext) const
Definition: trvlfrm.cxx:1787
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
void Format(vcl::RenderContext *pRenderContext, const SwBorderAttrs *pAttrs=nullptr) override
Calculate the Bitmap's site, if needed.
Definition: notxtfrm.cxx:647
virtual void MakeAll(vcl::RenderContext *pRenderContext) override
Definition: notxtfrm.cxx:473
Center
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
Definition: wsfrm.cxx:122
long AdjustHeight(long n)
constexpr double rad2deg(double v)
AntialiasingFlags GetAntialiasing() const
bool isFrameAreaDefinitionValid() const
Definition: frame.hxx:167
#define RES_LINKED_GRAPHIC_STREAM_ARRIVED
Definition: hintids.hxx:314
double getLocalFrameRotation() const
Definition: notxtfrm.cxx:624
std::unique_ptr< BaseProcessor2D > createProcessor2DFromOutputDevice(OutputDevice &rTargetOutDev, const drawinglayer::geometry::ViewInformation2D &rViewInformation2D)
bool IsLinkedInputStreamReady() const
Definition: ndgrf.hxx:145
WEIGHT_BOLD
SwRect & Intersection_(const SwRect &rRect)
Definition: swrect.cxx:78
bool IsChart() const
Definition: ndole.cxx:630
#define RES_UPDATE_ATTR
Definition: hintids.hxx:291
drawinglayer::primitive2d::Primitive2DContainer const & tryToGetChartContentAsPrimitive2DSequence(basegfx::B2DRange &rRange, bool bSynchron)
Definition: ndole.cxx:1044
bool IsAsyncRetrieveInputStreamPossible() const
Definition: ndgrf.cxx:853
B2DPolygon const & getB2DPolygon(sal_uInt32 nIndex) const
long Right() const
double getWidth() const
void Top(const long nTop)
Definition: swrect.hxx:202
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:377
void SwAlignRect(SwRect &rRect, const SwViewShell *pSh, const vcl::RenderContext *pRenderContext)
Function is also used outside this file.
Definition: paintfrm.cxx:1107
LINESTYLE_NONE
void restoreFrameAreas()
Definition: wsfrm.cxx:266
SwIndex nContent
Definition: pam.hxx:38
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: notxtfrm.cxx:713
const SwRect & getFrameArea() const
Definition: frame.hxx:175
void setX(long nX)
OUTDEV_WINDOW
void TriggerAsyncRetrieveInputStream()
Definition: ndgrf.cxx:792
GraphicAttr & GetGraphicAttr(GraphicAttr &, const SwFrame *pFrame) const
Returns the with our graphic attributes filled Graphic-Attr-Structure.
Definition: ndgrf.cxx:718
BASEGFX_DLLPUBLIC void transform(const B2DHomMatrix &rMatrix)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
bool isTransformableSwFrame() const
Definition: flyfrms.hxx:131
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:965
const OUString & GetName() const
Definition: format.hxx:111
bool DrawFillAttributes(const drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes, const SwRect &rOriginalLayoutRect, const SwRegionRects &rPaintRegion, const basegfx::utils::B2DClipState &rClipState, vcl::RenderContext &rOut)
Definition: paintfrm.cxx:1700
std::shared_ptr< SdrAllFillAttributesHelper > SdrAllFillAttributesHelperPtr
Definition: format.hxx:38
static void lcl_CalcRect(Point &rPt, Size &rDim, MirrorGraph nMirror)
Calculate the position and the size of the graphic in the Frame, corresponding to the current graphic...
Definition: notxtfrm.cxx:326
bool HasAnimation() const
Definition: notxtfrm.cxx:1343
#define RES_GRAPHIC_ARRIVED
Definition: hintids.hxx:300
const SwFormatSurround & GetSurround(bool=true) const
Definition: fmtsrnd.hxx:66
SwDoc * GetDoc() const
Definition: viewsh.hxx:284
long Top() const
void SetUnderline(FontLineStyle)
virtual bool GetCursorOfst(SwPosition *pPos, Point &aPoint, SwCursorMoveState *=nullptr, bool bTestBackground=false) const override
Definition: notxtfrm.cxx:694
SwFlyFrame * FindFlyFrame()
Definition: frame.hxx:1087
bool GetFileFilterNms(OUString *pFileNm, OUString *pFilterNm) const
Definition: ndgrf.cxx:479
void Right(const long nRight)
Definition: swrect.hxx:198
void setY(long nY)
const IDocumentDeviceAccess & getIDocumentDeviceAccess() const
Provides access to the document device interface.
Definition: node.cxx:2053
std::unique_ptr< TransformableSwFrame > mpTransformableSwFrame
Definition: notxtfrm.hxx:43
const OUString & GetCurrentPersistName() const
Definition: ndole.hxx:69
void DrawRect(const tools::Rectangle &rRect)
Base class for various Writer styles.
Definition: format.hxx:43
long getY() const
virtual void transform_translate(const Point &rOffset) override
Definition: notxtfrm.cxx:604
sal_uInt16 GetVirtPageNum() const
Definition: trvlfrm.cxx:1805
long getX() const
bool isEmpty() const
B2DHomMatrix createSourceRangeTargetRangeTransform(const B2DRange &rSourceRange, const B2DRange &rTargetRange)
#define RES_GRAPHIC_PIECE_ARRIVED
Definition: hintids.hxx:301
void StartGraphicAnimation(OutputDevice *pOut, const Point &rPt, const Size &rSz, long nExtraData, OutputDevice *pFirstFrameOutDev)
wrappers for non-const calls at GraphicObject
Definition: ndgrf.hxx:87
void SetLineColor()
void paintGraphicUsingPrimitivesHelper(vcl::RenderContext &rOutputDevice, GraphicObject const &rGrfObj, GraphicAttr const &rGraphicAttr, const basegfx::B2DHomMatrix &rGraphicTransform, const OUString &rName, const OUString &rTitle, const OUString &rDescription)
Definition: notxtfrm.cxx:920
void SetFamilyName(const OUString &rFamilyName)
void Draw(OutputDevice *pOutDev, const Point &rDestPt) const
void InvalidatePrt()
Definition: frame.hxx:1012
static void lcl_ClearArea(const SwFrame &rFrame, vcl::RenderContext &rOut, const SwRect &rPtArea, const SwRect &rGrfArea)
Definition: notxtfrm.cxx:169
Internet visited.
Definition: poolfmt.hxx:122
bool IsClipRegion() const
virtual bool IsDataComplete() const
GraphicType GetType() const
void PaintPicture(vcl::RenderContext *, const SwRect &) const
Paint the graphic.
Definition: notxtfrm.cxx:1040
void RepaintPagePreview(SwViewShell const *pVwSh, const SwRect &rRect)
Definition: edtwin3.cxx:116
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:198
bool IsAnimated() const
Definition: ndgrf.hxx:96
#define RES_GRFATR_ROTATION
Definition: hintids.hxx:244
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
virtual SwFormat * GetFormatFromPool(sal_uInt16 nId)=0
Return required automatic format base class.
int i
static void lcl_PaintReplacement(const SwRect &rRect, const OUString &rText, const SwViewShell &rSh, const SwNoTextFrame *pFrame, bool bDefect)
Definition: notxtfrm.cxx:90
const Graphic * GetGraphic()
Definition: ndole.cxx:242
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
bool IsPreview() const
Definition: viewsh.hxx:491
#define F_2PI
SwNoTextNode * GetNoTextNode()
Definition: ndnotxt.hxx:96
SwDoc * GetDoc()
Definition: node.hxx:702
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
static bool equalZero(const double &rfVal)
void SetFillColor()
AntialiasingFlags
bool isFramePrintAreaValid() const
Definition: frame.hxx:164
Internet normal.
Definition: poolfmt.hxx:121
long Bottom() const
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: notxtfrm.cxx:209
#define SET_CURR_SHELL(shell)
Definition: swtypes.hxx:101
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:396
const IDocumentSettingAccess * getIDocumentSettingAccess() const
Provides access to the document setting interface.
Definition: node.cxx:2052
bool IsPDFExport() const
Definition: viewopt.hxx:378
bool isFrameAreaPositionValid() const
Definition: frame.hxx:162
static bool paintUsingPrimitivesHelper(vcl::RenderContext &rOutputDevice, const drawinglayer::primitive2d::Primitive2DContainer &rSequence, const basegfx::B2DRange &rSourceRange, const basegfx::B2DRange &rTargetRange)
Definition: notxtfrm.cxx:874
const Size & GetSize() const
By returning the surrounding Fly's size which equals the graphic's size.
Definition: notxtfrm.cxx:464
bool isOutputToWindow() const
Definition: viewsh.cxx:142
ring_container GetRingContainer()
Definition: ring.hxx:240
OUString SwResId(const char *pId)
Definition: swmodule.cxx:190
OUString GetDescription() const
Definition: ndnotxt.cxx:281
void SSize(const Size &rNew)
Definition: swrect.hxx:176
Point m_aRealHeight
contains then the position/height of the cursor
Definition: crstate.hxx:137
bool isFrameAreaSizeValid() const
Definition: frame.hxx:163
#define RES_FMT_CHG
Definition: hintids.hxx:286
virtual SfxPrinter * getPrinter(bool bCreate) const =0
Return the printer set at the document.
const GraphicObject & GetGrfObj(bool bWait=false) const
Definition: ndgrf.cxx:365
bool IsTransparent() const
Definition: notxtfrm.cxx:1286
long X() const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
GraphicType GetType() const
virtual Size GetTwipSize() const override
Definition: ndgrf.cxx:419
#define RES_GRFATR_BEGIN
Definition: hintids.hxx:240
static bool GetRealURL(const SwGrfNode &rNd, OUString &rText)
Definition: notxtfrm.cxx:79
SwBorderAttrs * Get()
Definition: frmtool.cxx:2439
SwTwips Shrink(SwTwips, bool bTst=false, bool bInfo=false)
Definition: wsfrm.cxx:1507
void SetColor(const Color &)
void SetFrameInPaint(bool b)
Definition: ndgrf.hxx:105
static void DrawPaintReplacement(const tools::Rectangle &rRect, const OUString &rText, OutputDevice *pOut)
Point LogicToPixel(const Point &rLogicPt) const
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
sal_Int32 GetBottom() const
FontLineStyle GetLineStyle() const
const SwRect & GetUnclippedFrame() const
Definition: flyfrms.hxx:112
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
sal_Int32 GetTop() const
void Left(const long nLeft)
Definition: swrect.hxx:193
void Bottom(const long nBottom)
Definition: swrect.hxx:207
const SwContentNode * GetNode() const
Definition: notxtfrm.hxx:60
bool HasBorder(bool bTreatPaddingAsBorder) const
void SetStyleName(const OUString &rStyleName)
void Justify()
Definition: swrect.cxx:133
tools::Rectangle SVRect() const
Definition: swrect.hxx:282
void StopAnimation(OutputDevice *=nullptr) const
Definition: notxtfrm.cxx:1332
SwDrawView * GetDrawView()
Definition: viewimp.hxx:156
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
Color GetRetoucheColor() const
Definition: viewimp.cxx:252
const Graphic & GetGraphic() const
void GetGrfArea(SwRect &rRect, SwRect *) const
Calculate the Bitmap's position and the size within the passed rectangle.
Definition: notxtfrm.cxx:342
static void LeaveLock()
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
void ClrContourCache(const SdrObject *pObj)
Definition: txtfly.cxx:140
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
void Width(long nNew)
Definition: swrect.hxx:185
vcl::Window * GetWin() const
Definition: viewsh.hxx:340
SwFlyFrame * GetFlyFromMarked(const SdrMarkList *pLst, SwViewShell *pSh)
Definition: feshview.cxx:138
OUString GetTitle() const
Definition: ndnotxt.cxx:257
void InvalidateAll_()
Definition: frame.hxx:781
void SetTransparent(bool bTransparent)
void SwAlignGrfRect(SwRect *pGrfRect, const vcl::RenderContext &rOut)
Method to pixel-align rectangle for drawing graphic object.
Definition: paintfrm.cxx:1213
void ClearCache()
Definition: notxtfrm.cxx:703
FAMILY_SWISS
static void EnterLock()
void AdjustMarkHdl(SfxViewShell *pOtherShell=nullptr)
SwRect getUntransformedFrameArea() const
Definition: wsfrm.cxx:162
void UpdateLinkWithInputStream()
Definition: ndgrf.cxx:834
void setFrameAreaSizeValid(bool bNew)
Definition: wsfrm.cxx:89
SwFrameType mnFrameType
Definition: frame.hxx:395
const basegfx::B2DHomMatrix & getLocalFrameAreaTransformation() const
Definition: frame.hxx:251
virtual bool GetCharRect(SwRect &, const SwPosition &, SwCursorMoveState *=nullptr, bool bAllowFarAway=true) const override
Definition: notxtfrm.cxx:661
long Left() const
bool IsChart() const
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
sal_Int32 GetRight() const
basegfx::B2DPolyPolygon GetAsB2DPolyPolygon() const
IMapObject * GetIMapObject(size_t nPos) const
#define RES_BOX
Definition: hintids.hxx:213
#define RES_OBJECTDYING
Definition: hintids.hxx:285
bool IsVertical() const
Definition: frame.hxx:949
virtual void Calc(vcl::RenderContext *pRenderContext) const override
Definition: fly.cxx:2820
virtual void NotifyBackground(SwPageFrame *_pPageFrame, const SwRect &_rRect, PrepareHint _eHint)=0
method to trigger notification of 'background'
virtual void DestroyImpl() override
Definition: notxtfrm.cxx:153
bool IsTransparent() const
Definition: ndgrf.cxx:786
bool GetContour(tools::PolyPolygon &rContour, const bool _bForPaint=false) const
OD 16.04.2003 #i13147# - If called for paint and the contains a graphic, load of intrinsic graphic has to be avoided.
Definition: fly.cxx:2573
bool IsAnimated() const
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:155
virtual void MakePos()
Definition: calcmove.cxx:534
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
bool IsOver(const SwRect &rRect) const
Definition: swrect.cxx:125
FontLineStyle
void adaptFrameAreasToTransformations()
Definition: wsfrm.cxx:231
void SetOutDev(SwViewShell *pSh, OutputDevice *pOut)
Definition: notxtfrm.cxx:164
static bool FlushVout()
Output virtual Device (e.g. for animations)
Definition: virtoutp.cxx:29
void Push(PushFlags nFlags=PushFlags::ALL)
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
basegfx::B2DHomMatrix GetViewTransformation() const
void setWidth(long nWidth)
void createFrameAreaTransformations(double fRotation, const basegfx::B2DPoint &rCenter)
Definition: wsfrm.cxx:211
static void DrawEx(OutputDevice *pOutDev, const OUString &rText, vcl::Font &rFont, const BitmapEx &rBitmap, const Point &rDestPt, const Size &rDestSize)
const basegfx::B2DHomMatrix & getLocalFramePrintAreaTransformation() const
Definition: frame.hxx:257
SwFrameFormat * GetFlyFormat() const
If node is in a fly return the respective format.
Definition: node.cxx:708
virtual SwContentFrame * MakeFrame(SwFrame *) override
MakeFrame will be called for a certain layout pSib is another SwFrame of the same layout (e...
Definition: notxtfrm.cxx:148
const OUString & GetURL() const
bool isTransformableSwFrame() const
Definition: notxtfrm.hxx:83
sal_uInt16 Which() const
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
virtual void Modify(const SfxPoolItem *, const SfxPoolItem *) override
Definition: wsfrm.cxx:2302
virtual void transform_translate(const Point &rOffset)
Definition: wsfrm.cxx:145
long Y() const
const Color & GetValue() const
virtual void DestroyImpl() override
Definition: ssfrm.cxx:421
static void lcl_correctlyAlignRect(SwRect &rAlignedGrfArea, const SwRect &rInArea, vcl::RenderContext const *pOut)
Definition: notxtfrm.cxx:845
const OUString & GetURL() const
Definition: fmturl.hxx:66
Base class of the Writer document model elements.
Definition: node.hxx:79
void setHeight(long nHeight)
bool GetBackgroundBrush(drawinglayer::attribute::SdrAllFillAttributesHelperPtr &rFillAttributes, const SvxBrushItem *&rpBrush, const Color *&rpColor, SwRect &rOrigRect, bool bLowerMode, bool bConsiderTextBox) const
Determine the background brush for the frame: the background brush is taken from it-self or from its ...
Definition: paintfrm.cxx:7170