LibreOffice Module sw (master)  1
dflyobj.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 <comphelper/lok.hxx>
22 #include <tools/mapunit.hxx>
23 #include <svx/svdtrans.hxx>
24 #include <editeng/protitem.hxx>
25 #include <editeng/opaqitem.hxx>
26 #include <svx/svdpage.hxx>
27 #include <vcl/canvastools.hxx>
28 #include <vcl/svapp.hxx>
29 #include <vcl/ptrstyle.hxx>
30 
31 #include <fmtclds.hxx>
32 #include <fmtornt.hxx>
33 #include <fmtfsize.hxx>
34 #include <fmturl.hxx>
35 #include <viewsh.hxx>
36 #include <viewimp.hxx>
37 #include <cntfrm.hxx>
38 #include <frmatr.hxx>
39 #include <doc.hxx>
40 #include <IDocumentUndoRedo.hxx>
41 #include <dview.hxx>
42 #include <dflyobj.hxx>
43 #include <flyfrm.hxx>
44 #include <frmfmt.hxx>
45 #include <viewopt.hxx>
46 #include <frmtool.hxx>
47 #include <flyfrms.hxx>
48 #include <ndnotxt.hxx>
49 #include <grfatr.hxx>
50 #include <pagefrm.hxx>
51 #include <rootfrm.hxx>
52 #include <textboxhelper.hxx>
53 #include <wrtsh.hxx>
54 #include <ndgrf.hxx>
55 #include <frmmgr.hxx>
56 
61 
62 // AW: For VCOfDrawVirtObj and stuff
66 #include <sw_primitivetypes2d.hxx>
69 #include <notxtfrm.hxx>
70 
71 using namespace ::com::sun::star;
72 
73 static bool bInResize = false;
74 
75 
76 namespace sdr
77 {
78  namespace contact
79  {
89  {
90  protected:
96 
97  public:
100  : ViewContactOfSdrObj(rObj)
101  {
102  }
103  };
104 
106  {
107  // currently gets not visualized, return empty sequence
109  }
110 
111  } // end of namespace contact
112 } // end of namespace sdr
113 
114 std::unique_ptr<sdr::properties::BaseProperties> SwFlyDrawObj::CreateObjectSpecificProperties()
115 {
116  // create default properties
117  return std::make_unique<sdr::properties::DefaultProperties>(*this);
118 }
119 
120 std::unique_ptr<sdr::contact::ViewContact> SwFlyDrawObj::CreateObjectSpecificViewContact()
121 {
122  // needs an own VC since createViewIndependentPrimitive2DSequence()
123  // is called when RecalcBoundRect() is used
124  return std::make_unique<sdr::contact::VCOfSwFlyDrawObj>(*this);
125 }
126 
128 : SdrObject(rSdrModel)
129 {
130 }
131 
133 {
134 }
135 
136 // SwFlyDrawObj - Factory-Methods
138 {
139  return SdrInventor::Swg;
140 }
141 
143 {
144  return SwFlyDrawObjIdentifier;
145 }
146 
147 // TODO: Need own primitive to get the FlyFrame paint working
148 namespace drawinglayer
149 {
150  namespace primitive2d
151  {
153  {
154  private:
157 
158  protected:
160  virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
161 
162  public:
164  const SwVirtFlyDrawObj& rSwVirtFlyDrawObj,
165  const basegfx::B2DRange &rOuterRange)
167  mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
168  maOuterRange(rOuterRange)
169  {
170  }
171 
172  virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
173 
174  virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
175 
176  // override to allow callbacks to wrap_DoPaintObject
177  virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
178 
179  // data read access
181  const basegfx::B2DRange& getOuterRange() const { return maOuterRange; }
182 
185  };
186  } // end of namespace primitive2d
187 } // end of namespace drawinglayer
188 
189 namespace drawinglayer
190 {
191  namespace primitive2d
192  {
194  {
195  if(!getOuterRange().isEmpty())
196  {
197  // currently this SW object has no primitive representation. As long as this is the case,
198  // create invisible geometry to allow correct HitTest and BoundRect calculations for the
199  // object. Use a filled primitive to get 'inside' as default object hit. The special cases from
200  // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj;
201  // this removed the 'hack' to get a view from inside model data or to react on null-tolerance
202  // as it was done in the old implementation
203  rContainer.push_back(
205  true,
206  getOuterRange()));
207  }
208  }
209 
211  {
212  if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
213  {
214  const SwVirtFlyDrawObjPrimitive& rCompare = static_cast<const SwVirtFlyDrawObjPrimitive&>(rPrimitive);
215 
216  return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
217  && getOuterRange() == rCompare.getOuterRange());
218  }
219 
220  return false;
221  }
222 
224  {
225  return getOuterRange();
226  }
227 
229  {
230  // This is the callback to keep the FlyFrame painting in SW alive as long as it
231  // is not changed to primitives. This is the method which will be called by the processors
232  // when they do not know this primitive (and they do not). Inside wrap_DoPaintObject
233  // there needs to be a test that paint is only done during SW repaints (see there).
234  // Using this mechanism guarantees the correct Z-Order of the VirtualObject-based FlyFrames.
235  getSwVirtFlyDrawObj().wrap_DoPaintObject(rViewInformation);
236 
237  // call parent
238  BufferedDecompositionPrimitive2D::get2DDecomposition(rVisitor, rViewInformation);
239  }
240 
241  // provide unique ID
243 
244  } // end of namespace primitive2d
245 } // end of namespace drawinglayer
246 
247 // AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
248 // since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
249 // For paint, that offset is used by setting at the OutputDevice; for primitives this is
250 // not possible since we have no OutputDevice, but define the geometry itself.
251 
252 namespace sdr
253 {
254  namespace contact
255  {
257  {
258  protected:
264 
265  public:
268  : ViewContactOfVirtObj(rObj)
269  {
270  }
271 
274  {
275  return static_cast<SwVirtFlyDrawObj&>(mrObject);
276  }
277  };
278  } // end of namespace contact
279 } // end of namespace sdr
280 
281 namespace sdr
282 {
283  namespace contact
284  {
286  {
288  const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
289 
290  if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr)
291  {
292  // create an own specialized primitive which is used as repaint callpoint and HitTest
293  // for HitTest processor (see primitive implementation above)
294  const basegfx::B2DRange aOuterRange(GetSwVirtFlyDrawObj().getOuterBound());
295 
296  if(!aOuterRange.isEmpty())
297  {
301  aOuterRange));
302 
303  xRetval = drawinglayer::primitive2d::Primitive2DContainer { xPrimitive };
304  }
305  }
306 
307  return xRetval;
308  }
309 
310  } // end of namespace contact
311 } // end of namespace sdr
312 
314 {
315  basegfx::B2DRange aOuterRange;
316  const SdrObject& rReferencedObject = GetReferencedObj();
317 
318  if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr)
319  {
320  const SwFlyFrame* pFlyFrame = GetFlyFrame();
321 
322  if(pFlyFrame)
323  {
324  const tools::Rectangle aOuterRectangle(pFlyFrame->getFrameArea().Pos(), pFlyFrame->getFrameArea().SSize());
325 
326  if(!aOuterRectangle.IsEmpty())
327  {
328  aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Left(), aOuterRectangle.Top()));
329  aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Right(), aOuterRectangle.Bottom()));
330  }
331  }
332  }
333 
334  return aOuterRange;
335 }
336 
338 {
339  basegfx::B2DRange aInnerRange;
340  const SdrObject& rReferencedObject = GetReferencedObj();
341 
342  if(dynamic_cast<const SwFlyDrawObj*>( &rReferencedObject) != nullptr)
343  {
344  const SwFlyFrame* pFlyFrame = GetFlyFrame();
345 
346  if(pFlyFrame)
347  {
348  const tools::Rectangle aInnerRectangle(pFlyFrame->getFrameArea().Pos() + pFlyFrame->getFramePrintArea().Pos(), pFlyFrame->getFramePrintArea().SSize());
349 
350  if(!aInnerRectangle.IsEmpty())
351  {
352  aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Left(), aInnerRectangle.Top()));
353  aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Right(), aInnerRectangle.Bottom()));
354  }
355  }
356  }
357 
358  return aInnerRange;
359 }
360 
362 {
363  // RotGrfFlyFrame: Check if this is a SwGrfNode
364  const SwFlyFrame* pFlyFrame(GetFlyFrame());
365 
366  if(nullptr != pFlyFrame && pFlyFrame->Lower() && pFlyFrame->Lower()->IsNoTextFrame())
367  {
368  const SwNoTextFrame *const pNTF(static_cast<const SwNoTextFrame*>(pFlyFrame->Lower()));
369 
370  const SwGrfNode *const pGrfNd(pNTF->GetNode()->GetGrfNode());
371 
372  return nullptr != pGrfNd;
373  }
374 
375  return false;
376 }
377 
379 {
380  // RotGrfFlyFrame: If true, this SdrObject supports only limited rotation.
381  // This is the case for SwGrfNode instances
382  return ContainsSwGrfNode();
383 }
384 
385 void SwVirtFlyDrawObj::Rotate(const Point& rRef, long nAngle, double sn, double cs)
386 {
387  if(ContainsSwGrfNode())
388  {
389  // RotGrfFlyFrame: Here is where the positively completed rotate interaction is executed.
390  // Rotation is in 1/100th degree and may be signed (!)
391  nAngle /= 10;
392 
393  while(nAngle < 0)
394  {
395  nAngle += 3600;
396  }
397 
398  SwWrtShell *pShForAngle = nAngle ? dynamic_cast<SwWrtShell*>(GetFlyFrame()->getRootFrame()->GetCurrShell()) : nullptr;
399  if (pShForAngle)
400  {
401  // RotGrfFlyFrame: Add transformation to placeholder object
402  Size aSize;
403  const sal_uInt16 nOldRot(SwVirtFlyDrawObj::getPossibleRotationFromFraphicFrame(aSize));
404  SwFlyFrameAttrMgr aMgr(false, pShForAngle, Frmmgr_Type::NONE);
405 
406  aMgr.SetRotation(nOldRot, (nOldRot + static_cast<sal_uInt16>(nAngle)) % 3600, aSize);
407  }
408  }
409  else
410  {
411  // call parent
412  SdrVirtObj::Rotate(rRef, nAngle, sn, cs);
413  }
414 }
415 
416 std::unique_ptr<sdr::contact::ViewContact> SwVirtFlyDrawObj::CreateObjectSpecificViewContact()
417 {
418  // need an own ViewContact (VC) to allow creation of a specialized primitive
419  // for being able to visualize the FlyFrames in primitive renderers
420  return std::make_unique<sdr::contact::VCOfSwVirtFlyDrawObj>(*this);
421 }
422 
424  SdrModel& rSdrModel,
425  SdrObject& rNew,
426  SwFlyFrame* pFly)
427 : SdrVirtObj(rSdrModel, rNew),
428  m_pFlyFrame(pFly)
429 {
431  bMovProt = rP.IsPosProtected();
432  bSizProt = rP.IsSizeProtected();
433 }
434 
436 {
437  if ( getSdrPageFromSdrObject() ) //Withdraw SdrPage the responsibility.
439 }
440 
442 {
443  return GetFlyFrame()->GetFormat();
444 }
446 {
447  return GetFlyFrame()->GetFormat();
448 }
449 
450 // --> OD #i102707#
451 namespace
452 {
453  class RestoreMapMode
454  {
455  public:
456  explicit RestoreMapMode( SwViewShell const * pViewShell )
457  : mbMapModeRestored( false )
458  , mpOutDev( pViewShell->GetOut() )
459  {
460  if ( pViewShell->getPrePostMapMode() != mpOutDev->GetMapMode() )
461  {
462  mpOutDev->Push(PushFlags::MAPMODE);
463 
464  GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile();
465  if ( pMetaFile &&
466  pMetaFile->IsRecord() && !pMetaFile->IsPause() )
467  {
468  OSL_FAIL( "MapMode restoration during meta file creation is somehow suspect - using <SetRelativeMapMode(..)>, but not sure, if correct." );
469  mpOutDev->SetRelativeMapMode( pViewShell->getPrePostMapMode() );
470  }
471  else
472  {
473  mpOutDev->SetMapMode( pViewShell->getPrePostMapMode() );
474  }
475 
476  mbMapModeRestored = true;
477  }
478  };
479 
480  ~RestoreMapMode()
481  {
482  if ( mbMapModeRestored )
483  {
484  mpOutDev->Pop();
485  }
486  };
487 
488  private:
489  bool mbMapModeRestored;
490  VclPtr<OutputDevice> mpOutDev;
491  };
492 }
493 // <--
494 
496  drawinglayer::geometry::ViewInformation2D const& rViewInformation) const
497 {
499 
500  // Only paint when we have a current shell and a DrawingLayer paint is in progress.
501  // This avoids evtl. problems with renderers which do processing stuff,
502  // but no paints. IsPaintInProgress() depends on SW repaint, so, as long
503  // as SW paints self and calls DrawLayer() for Heaven and Hell, this will
504  // be correct
505  if ( pShell && pShell->IsDrawingLayerPaintInProgress() )
506  {
507  bool bDrawObject(true);
508 
509  if ( !SwFlyFrame::IsPaint( const_cast<SwVirtFlyDrawObj*>(this), pShell ) )
510  {
511  bDrawObject = false;
512  }
513 
514  if ( bDrawObject )
515  {
516  // if there's no viewport set, all fly-frames will be painted,
517  // which is slow, wastes memory, and can cause other trouble.
518  (void) rViewInformation; // suppress "unused parameter" warning
519  assert(comphelper::LibreOfficeKit::isActive() || !rViewInformation.getViewport().isEmpty());
521  {
522  // it is also necessary to restore the VCL MapMode from ViewInformation since e.g.
523  // the VCL PixelRenderer resets it at the used OutputDevice. Unfortunately, this
524  // excludes shears and rotates which are not expressible in MapMode.
525  // OD #i102707#
526  // new helper class to restore MapMode - restoration, only if
527  // needed and consideration of paint for meta file creation .
528  RestoreMapMode aRestoreMapModeIfNeeded( pShell );
529 
530  // paint the FlyFrame (use standard VCL-Paint)
532  }
533  }
534  }
535 }
536 
538 {
539  rInfo.bMoveAllowed =
540  rInfo.bResizeFreeAllowed = rInfo.bResizePropAllowed = true;
541 
542  // RotGrfFlyFrame: Some rotation may be allowed
544 
545  rInfo.bMirrorFreeAllowed = rInfo.bMirror45Allowed =
546  rInfo.bMirror90Allowed = rInfo.bShearAllowed =
547  rInfo.bCanConvToPath = rInfo.bCanConvToPoly =
549 }
550 
551 // SwVirtFlyDrawObj - Size Determination
552 
554 {
555  if ( GetFlyFrame()->getFrameArea().HasArea() )
556  const_cast<SwVirtFlyDrawObj*>(this)->aOutRect = GetFlyFrame()->getFrameArea().SVRect();
557  else
558  const_cast<SwVirtFlyDrawObj*>(this)->aOutRect = tools::Rectangle();
559 }
560 
562 {
563  SetRect();
564  return aOutRect;
565 }
566 
568 {
569  return GetCurrentBoundRect();
570 }
571 
573 {
574  SetRect();
575 }
576 
578 {
579  SetRect();
580 }
581 
583 {
584  SetRect();
585  return aOutRect;
586 }
587 
589 {
591  SetRect();
592  SetChanged();
594  if (pUserCall!=nullptr)
595  pUserCall->Changed(*this, SdrUserCallType::Resize, aTmp);
596 }
597 
599 {
600  SetRect();
601 }
602 
604 {
605  SetRect();
606  return aOutRect;
607 }
608 
610 {
612  SetRect();
613  SetChanged();
615  if (pUserCall!=nullptr)
616  pUserCall->Changed(*this, SdrUserCallType::Resize, aTmp);
617 }
618 
620 {
621  SetRect();
622 }
623 
625 {
626  const tools::Rectangle aSourceRectangle(GetFlyFrame()->getFrameArea().SVRect());
627  const ::basegfx::B2DRange aSourceRange = vcl::unotools::b2DRectangleFromRectangle(aSourceRectangle);
629 
630  aRetval.append(::basegfx::utils::createPolygonFromRect(aSourceRange));
631 
632  return aRetval;
633 }
634 
635 // SwVirtFlyDrawObj::Move() and Resize()
637 {
638  if(GetFlyFrame()->IsFlyFreeFrame() && static_cast< SwFlyFreeFrame* >(GetFlyFrame())->isTransformableSwFrame())
639  {
640  // RotateFlyFrame3: When we have a change and are in transformed state (e.g. rotation used),
641  // we need to fall back to the un-transformed state to keep the old code below
642  // working properly. Restore FrameArea and use aOutRect from old FrameArea.
643  TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
644  pTransformableSwFrame->restoreFrameAreas();
646  }
647 
648  aOutRect.Move( rSiz );
649  const Point aOldPos( GetFlyFrame()->getFrameArea().Pos() );
650  const Point aNewPos( aOutRect.TopLeft() );
651  const SwRect aFlyRect( aOutRect );
652 
653  //If the Fly has a automatic align (right or top),
654  //so preserve the automatic.
655  SwFrameFormat *pFormat = GetFlyFrame()->GetFormat();
656  const sal_Int16 eHori = pFormat->GetHoriOrient().GetHoriOrient();
657  const sal_Int16 eVert = pFormat->GetVertOrient().GetVertOrient();
658  const sal_Int16 eRelHori = pFormat->GetHoriOrient().GetRelationOrient();
659  const sal_Int16 eRelVert = pFormat->GetVertOrient().GetRelationOrient();
660  //On paragraph bound Flys starting from the new position a new
661  //anchor must be set. Anchor and the new RelPos is calculated and
662  //placed by the Fly itself.
663  if( GetFlyFrame()->IsFlyAtContentFrame() )
664  {
665  static_cast<SwFlyAtContentFrame*>(GetFlyFrame())->SetAbsPos( aNewPos );
666  }
667  else
668  {
669  const SwFrameFormat *pTmpFormat = GetFormat();
670  const SwFormatVertOrient &rVert = pTmpFormat->GetVertOrient();
671  const SwFormatHoriOrient &rHori = pTmpFormat->GetHoriOrient();
672  long lXDiff = aNewPos.X() - aOldPos.X();
673  if( rHori.IsPosToggle() && text::HoriOrientation::NONE == eHori &&
675  lXDiff = -lXDiff;
676 
678  text::HoriOrientation::NONE == eHori )
679  lXDiff = -lXDiff;
680 
681  long lYDiff = aNewPos.Y() - aOldPos.Y();
682  if( GetFlyFrame()->GetAnchorFrame()->IsVertical() )
683  {
684  //lXDiff -= rVert.GetPos();
685  //lYDiff += rHori.GetPos();
686 
687  if ( GetFlyFrame()->GetAnchorFrame()->IsVertLR() )
688  {
689  lXDiff += rVert.GetPos();
690  lXDiff = -lXDiff;
691  }
692  else
693  {
694  lXDiff -= rVert.GetPos();
695  lYDiff += rHori.GetPos();
696  }
697  }
698  else
699  {
700  lXDiff += rHori.GetPos();
701  lYDiff += rVert.GetPos();
702  }
703 
704  if( GetFlyFrame()->GetAnchorFrame()->IsRightToLeft() &&
705  text::HoriOrientation::NONE != eHori )
706  lXDiff = GetFlyFrame()->GetAnchorFrame()->getFrameArea().Width() -
707  aFlyRect.Width() - lXDiff;
708 
709  const Point aTmp( lXDiff, lYDiff );
710  GetFlyFrame()->ChgRelPos( aTmp );
711  }
712 
713  SwAttrSet aSet( pFormat->GetDoc()->GetAttrPool(),
715  SwFormatHoriOrient aHori( pFormat->GetHoriOrient() );
716  SwFormatVertOrient aVert( pFormat->GetVertOrient() );
717  bool bPut = false;
718 
719  if( !GetFlyFrame()->IsFlyLayFrame() &&
720  ::GetHtmlMode(pFormat->GetDoc()->GetDocShell()) )
721  {
722  //In HTML-Mode only automatic aligns are allowed.
723  //Only we can try a snap to left/right respectively left-/right border
724  const SwFrame* pAnch = GetFlyFrame()->GetAnchorFrame();
725  bool bNextLine = false;
726 
727  if( !GetFlyFrame()->IsAutoPos() || text::RelOrientation::PAGE_FRAME != aHori.GetRelationOrient() )
728  {
729  if( text::RelOrientation::CHAR == eRelHori )
730  {
731  aHori.SetHoriOrient( text::HoriOrientation::LEFT );
732  aHori.SetRelationOrient( text::RelOrientation::CHAR );
733  }
734  else
735  {
736  bNextLine = true;
737  //Horizontal Align:
738  const bool bLeftFrame =
739  aFlyRect.Left() < pAnch->getFrameArea().Left() + pAnch->getFramePrintArea().Left(),
740  bLeftPrt = aFlyRect.Left() + aFlyRect.Width() <
741  pAnch->getFrameArea().Left() + pAnch->getFramePrintArea().Width()/2;
742  if ( bLeftFrame || bLeftPrt )
743  {
744  aHori.SetHoriOrient( text::HoriOrientation::LEFT );
745  aHori.SetRelationOrient( bLeftFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
746  }
747  else
748  {
749  const bool bRightFrame = aFlyRect.Left() >
750  pAnch->getFrameArea().Left() + pAnch->getFramePrintArea().Width();
751  aHori.SetHoriOrient( text::HoriOrientation::RIGHT );
752  aHori.SetRelationOrient( bRightFrame ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
753  }
754  }
755  aSet.Put( aHori );
756  }
757  //Vertical alignment simply is retained principally,
758  //only on manual align will be switched over.
759  bool bRelChar = text::RelOrientation::CHAR == eRelVert;
760  aVert.SetVertOrient( eVert != text::VertOrientation::NONE ? eVert :
761  GetFlyFrame()->IsFlyInContentFrame() ? text::VertOrientation::CHAR_CENTER :
762  bRelChar && bNextLine ? text::VertOrientation::CHAR_TOP : text::VertOrientation::TOP );
763  if( bRelChar )
764  aVert.SetRelationOrient( text::RelOrientation::CHAR );
765  else
766  aVert.SetRelationOrient( text::RelOrientation::PRINT_AREA );
767  aSet.Put( aVert );
768  bPut = true;
769  }
770 
771  //We want preferably not to lose the automatic alignments.
772  if ( !bPut && bInResize )
773  {
774  if ( text::HoriOrientation::NONE != eHori )
775  {
776  aHori.SetHoriOrient( eHori );
777  aHori.SetRelationOrient( eRelHori );
778  aSet.Put( aHori );
779  bPut = true;
780  }
781  if ( text::VertOrientation::NONE != eVert )
782  {
783  aVert.SetVertOrient( eVert );
784  aVert.SetRelationOrient( eRelVert );
785  aSet.Put( aVert );
786  bPut = true;
787  }
788  }
789  if ( bPut )
790  pFormat->SetFormatAttr( aSet );
791 }
792 
793 
794 void SwVirtFlyDrawObj::NbcCrop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact)
795 {
796  // Get Wrt Shell
797  SwWrtShell *pSh = dynamic_cast<SwWrtShell*>( GetFlyFrame()->getRootFrame()->GetCurrShell() );
798 
799  if (!pSh)
800  {
801  return;
802  }
803 
804  GraphicObject const *pGraphicObject = pSh->GetGraphicObj();
805 
806  if (!pGraphicObject)
807  {
808  return;
809  }
810 
811  // Get graphic object size in 100th of mm
812  const MapMode aMapMode100thmm(MapUnit::Map100thMM);
813  Size aGraphicSize(pGraphicObject->GetPrefSize());
814 
815  if( MapUnit::MapPixel == pGraphicObject->GetPrefMapMode().GetMapUnit() )
816  {
817  aGraphicSize = Application::GetDefaultDevice()->PixelToLogic( aGraphicSize, aMapMode100thmm );
818  }
819  else
820  {
821  aGraphicSize = OutputDevice::LogicToLogic( aGraphicSize, pGraphicObject->GetPrefMapMode(), aMapMode100thmm);
822  }
823 
824  if( aGraphicSize.Width() == 0 || aGraphicSize.Height() == 0 )
825  {
826  return ;
827  }
828 
829  const bool bIsTransformableSwFrame(
830  GetFlyFrame()->IsFlyFreeFrame() &&
831  static_cast< SwFlyFreeFrame* >(GetFlyFrame())->isTransformableSwFrame());
832 
833  if(bIsTransformableSwFrame)
834  {
835  // When we have a change and are in transformed state (e.g. rotation used),
836  // we need to fall back to the un-transformed state to keep the old code below
837  // working properly. Restore FrameArea and use aOutRect from old FrameArea.
838  TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
839  pTransformableSwFrame->restoreFrameAreas();
841  }
842 
843  // Compute old and new rect. This will give us the deformation to apply to
844  // the object to crop. OldRect is the inner frame, see getFullDragClone()
845  // below where getFramePrintAreaTransformation is used as object geometry for Crop
846  const tools::Rectangle aOldRect(
847  GetFlyFrame()->getFrameArea().TopLeft() + GetFlyFrame()->getFramePrintArea().TopLeft(),
848  GetFlyFrame()->getFramePrintArea().SSize());
849  const long nOldWidth(aOldRect.GetWidth());
850  const long nOldHeight(aOldRect.GetHeight());
851 
852  if (!nOldWidth || !nOldHeight)
853  {
854  return;
855  }
856 
857  // rRef is relative to the Crop-Action, si in X/Y-Ranges of [0.0 .. 1.0],
858  // to get the correct absolute position, transform using the old Rect
859  const Point aRef(
860  aOldRect.Left() + basegfx::fround(aOldRect.GetWidth() * rRef.getX()),
861  aOldRect.Top() + basegfx::fround(aOldRect.GetHeight() * rRef.getY()));
862 
863  // apply transformation, use old ResizeRect for now
864  tools::Rectangle aNewRect( aOldRect );
865  ResizeRect(
866  aNewRect,
867  aRef,
868  Fraction(fxFact),
869  Fraction(fyFact));
870 
871  // Get old values for crop in 10th of mm
873  pSh->GetCurAttr( aSet );
874  SwCropGrf aCrop( aSet.Get(RES_GRFATR_CROPGRF) );
875 
876  tools::Rectangle aCropRectangle(
877  convertTwipToMm100(aCrop.GetLeft()),
878  convertTwipToMm100(aCrop.GetTop()),
879  convertTwipToMm100(aCrop.GetRight()),
880  convertTwipToMm100(aCrop.GetBottom()) );
881 
882  // Compute delta to apply
883  double fScaleX = ( aGraphicSize.Width() - aCropRectangle.Left() - aCropRectangle.Right() ) / static_cast<double>(nOldWidth);
884  double fScaleY = ( aGraphicSize.Height() - aCropRectangle.Top() - aCropRectangle.Bottom() ) / static_cast<double>(nOldHeight);
885 
886  sal_Int32 nDiffLeft = aNewRect.Left() - aOldRect.Left();
887  sal_Int32 nDiffTop = aNewRect.Top() - aOldRect.Top();
888  sal_Int32 nDiffRight = aNewRect.Right() - aOldRect.Right();
889  sal_Int32 nDiffBottom = aNewRect.Bottom() - aOldRect.Bottom();
890 
891  // Compute new values in 10th of mm
892  sal_Int32 nLeftCrop = static_cast<sal_Int32>( aCropRectangle.Left() + nDiffLeft * fScaleX );
893  sal_Int32 nTopCrop = static_cast<sal_Int32>( aCropRectangle.Top() + nDiffTop * fScaleY );
894  sal_Int32 nRightCrop = static_cast<sal_Int32>( aCropRectangle.Right() - nDiffRight * fScaleX );
895  sal_Int32 nBottomCrop = static_cast<sal_Int32>( aCropRectangle.Bottom() - nDiffBottom * fScaleY );
896 
897  // Apply values
898  pSh->StartAllAction();
899  // pSh->StartUndo(SwUndoId::START);
900 
901  // Set new crop values in twips
902  aCrop.SetLeft (convertMm100ToTwip(nLeftCrop));
903  aCrop.SetTop (convertMm100ToTwip(nTopCrop));
904  aCrop.SetRight (convertMm100ToTwip(nRightCrop));
905  aCrop.SetBottom(convertMm100ToTwip(nBottomCrop));
906  pSh->SetAttrItem(aCrop);
907 
908  // Set new frame size
909  SwFrameFormat *pFormat = GetFormat();
910  SwFormatFrameSize aSz( pFormat->GetFrameSize() );
911  const long aNewWidth(aNewRect.GetWidth() + (aOutRect.GetWidth() - aOldRect.GetWidth()));
912  const long aNewHeight(aNewRect.GetHeight() + (aOutRect.GetHeight() - aOldRect.GetHeight()));
913  aSz.SetWidth(aNewWidth);
914  aSz.SetHeight(aNewHeight);
915  pFormat->GetDoc()->SetAttr( aSz, *pFormat );
916 
917  // add move - to make result look better. Fill with defaults
918  // for the untransformed case
919  Point aNewTopLeft(aNewRect.TopLeft());
920  const Point aOldTopLeft(aOldRect.TopLeft());
921 
922  if(bIsTransformableSwFrame)
923  {
924  // Need to correct the NewTopLeft position in transformed state to make
925  // the interaction look correct. First, extract rotation
926  basegfx::B2DVector aScale, aTranslate;
927  double fRotate, fShearX;
928  GetFlyFrame()->getFrameAreaTransformation().decompose(aScale, aTranslate, fRotate, fShearX);
929 
930  // calc the center of the unchanged object
931  const basegfx::B2DPoint aFormerCenter(
932  GetFlyFrame()->getFrameAreaTransformation() * basegfx::B2DPoint(0.5, 0.5));
933 
934  // define the existing rotation around that former center
935  const basegfx::B2DHomMatrix aRotFormerCenter(
937  aFormerCenter.getX(),
938  aFormerCenter.getY(),
939  fRotate));
940 
941  // use the new center of the unrotated object, rotate it around the
942  // former center
943  const Point aNewCenter(aNewRect.Center());
944  const basegfx::B2DPoint aRotNewCenter(
945  aRotFormerCenter * basegfx::B2DPoint(aNewCenter.X(), aNewCenter.Y()));
946 
947  // Create the new TopLeft of the unrotated, cropped object by creating
948  // as if re-creating the unrotated geometry
949  aNewTopLeft = Point(
950  basegfx::fround(aRotNewCenter.getX() - (0.5 * aNewRect.getWidth())),
951  basegfx::fround(aRotNewCenter.getY() - (0.5 * aNewRect.getHeight())));
952  }
953 
954  // check if we have movement and execute if yes
955  const Size aDeltaMove(
956  aNewTopLeft.X() - aOldTopLeft.X(),
957  aNewTopLeft.Y() - aOldTopLeft.Y());
958 
959  if(0 != aDeltaMove.Width() || 0 != aDeltaMove.Height())
960  {
961  NbcMove(aDeltaMove);
962  }
963 
964  // pSh->EndUndo(SwUndoId::END);
965  pSh->EndAllAction();
966 }
967 
968 void SwVirtFlyDrawObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
969 {
970  const SwFrame* pTmpFrame = GetFlyFrame()->GetAnchorFrame();
971 
972  if( !pTmpFrame )
973  {
974  pTmpFrame = GetFlyFrame();
975  }
976 
977  const bool bVertX(pTmpFrame->IsVertical());
978  const bool bRTL(pTmpFrame->IsRightToLeft());
979  const bool bVertL2RX(pTmpFrame->IsVertLR());
980  const bool bUseRightEdge((bVertX && !bVertL2RX ) || bRTL);
981  const bool bIsTransformableSwFrame(
982  GetFlyFrame()->IsFlyFreeFrame() &&
983  static_cast< SwFlyFreeFrame* >(GetFlyFrame())->isTransformableSwFrame());
984 
985  if(bIsTransformableSwFrame)
986  {
987  // When we have a change in transformed state, we need to fall back to the
988  // state without possible transformations.
989  // In the Resize case to correctly handle the changes, apply to the transformation
990  // and extract the new, untransformed state from that modified transformation
991  basegfx::B2DHomMatrix aNewMat(GetFlyFrame()->getFrameAreaTransformation());
992  const basegfx::B2DPoint aRef(rRef.X(), rRef.Y());
993 
994  // apply state to already valid transformation
995  aNewMat.translate(-aRef.getX(), -aRef.getY());
996  aNewMat.scale(double(xFact), double(yFact));
997  aNewMat.translate(aRef.getX(), aRef.getY());
998 
999  // get center of transformed state
1000  const basegfx::B2DPoint aCenter(aNewMat * basegfx::B2DPoint(0.5, 0.5));
1001 
1002  // decompose to extract scale
1003  basegfx::B2DVector aScale, aTranslate;
1004  double fRotate, fShearX;
1005  aNewMat.decompose(aScale, aTranslate, fRotate, fShearX);
1006  const basegfx::B2DVector aAbsScale(basegfx::absolute(aScale));
1007 
1008  // create new modified, but untransformed OutRect
1010  basegfx::fround(aCenter.getX() - (0.5 * aAbsScale.getX())),
1011  basegfx::fround(aCenter.getY() - (0.5 * aAbsScale.getY())),
1012  basegfx::fround(aCenter.getX() + (0.5 * aAbsScale.getX())),
1013  basegfx::fround(aCenter.getY() + (0.5 * aAbsScale.getY())));
1014 
1015  // restore FrameAreas so that actions below not adapted to new
1016  // full transformations take the correct actions
1017  TransformableSwFrame* pTransformableSwFrame(static_cast<SwFlyFreeFrame*>(GetFlyFrame())->getTransformableSwFrame());
1018  pTransformableSwFrame->restoreFrameAreas();
1019  }
1020  else
1021  {
1022  ResizeRect( aOutRect, rRef, xFact, yFact );
1023  }
1024 
1025  // Position may also change, remember old one. This is now already
1026  // the one in the unrotated, old coordinate system
1027  Point aOldPos(bUseRightEdge ? GetFlyFrame()->getFrameArea().TopRight() : GetFlyFrame()->getFrameArea().Pos());
1028 
1029  // get target size in old coordinate system
1030  Size aSz( aOutRect.Right() - aOutRect.Left() + 1, aOutRect.Bottom()- aOutRect.Top() + 1 );
1031 
1032  // compare with restored FrameArea
1033  if( aSz != GetFlyFrame()->getFrameArea().SSize() )
1034  {
1035  //The width of the columns should not be too narrow
1036  if ( GetFlyFrame()->Lower() && GetFlyFrame()->Lower()->IsColumnFrame() )
1037  {
1039  const SwBorderAttrs &rAttrs = *aAccess.Get();
1040  long nMin = rAttrs.CalcLeftLine()+rAttrs.CalcRightLine();
1041  const SwFormatCol& rCol = rAttrs.GetAttrSet().GetCol();
1042  if ( rCol.GetColumns().size() > 1 )
1043  {
1044  for ( const auto &rC : rCol.GetColumns() )
1045  {
1046  nMin += rC.GetLeft() + rC.GetRight() + MINFLY;
1047  }
1048  nMin -= MINFLY;
1049  }
1050  aSz.setWidth( std::max( aSz.Width(), nMin ) );
1051  }
1052 
1053  SwFrameFormat *pFormat = GetFormat();
1054  const SwFormatFrameSize aOldFrameSz( pFormat->GetFrameSize() );
1055  GetFlyFrame()->ChgSize( aSz );
1056  SwFormatFrameSize aFrameSz( pFormat->GetFrameSize() );
1057 
1058  if ( aFrameSz.GetWidthPercent() || aFrameSz.GetHeightPercent() )
1059  {
1060  long nRelWidth, nRelHeight;
1061  const SwFrame *pRel = GetFlyFrame()->IsFlyLayFrame() ?
1064  const SwViewShell *pSh = GetFlyFrame()->getRootFrame()->GetCurrShell();
1065 
1066  if ( pSh && pRel->IsBodyFrame() &&
1067  pSh->GetViewOptions()->getBrowseMode() &&
1068  pSh->VisArea().HasArea() )
1069  {
1070  nRelWidth = pSh->GetBrowseWidth();
1071  nRelHeight = pSh->VisArea().Height();
1072  const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
1073  nRelHeight -= 2*aBorder.Height();
1074  }
1075  else
1076  {
1077  nRelWidth = pRel->getFramePrintArea().Width();
1078  nRelHeight = pRel->getFramePrintArea().Height();
1079  }
1080 
1081  if ( aFrameSz.GetWidthPercent() && aFrameSz.GetWidthPercent() != SwFormatFrameSize::SYNCED &&
1082  aOldFrameSz.GetWidth() != aFrameSz.GetWidth() )
1083  {
1084  aFrameSz.SetWidthPercent( sal_uInt8(aSz.Width() * 100.0 / nRelWidth + 0.5) );
1085  }
1086 
1087  if ( aFrameSz.GetHeightPercent() && aFrameSz.GetHeightPercent() != SwFormatFrameSize::SYNCED &&
1088  aOldFrameSz.GetHeight() != aFrameSz.GetHeight() )
1089  {
1090  aFrameSz.SetHeightPercent( sal_uInt8(aSz.Height() * 100.0 / nRelHeight + 0.5) );
1091  }
1092 
1093  pFormat->GetDoc()->SetAttr( aFrameSz, *pFormat );
1094  }
1095  }
1096 
1097  //Position can also be changed, get new one
1098  const Point aNewPos(bUseRightEdge ? aOutRect.Right() + 1 : aOutRect.Left(), aOutRect.Top());
1099 
1100  if ( aNewPos != aOldPos )
1101  {
1102  // Former late change in aOutRect by ChgSize
1103  // is now taken into account directly by calculating
1104  // aNewPos *after* calling ChgSize (see old code).
1105  // Still need to adapt aOutRect since the 'Move' is already applied
1106  // here (see ResizeRect) and it's the same SdrObject
1107  const Size aDeltaMove(
1108  aNewPos.X() - aOldPos.X(),
1109  aNewPos.Y() - aOldPos.Y());
1110  aOutRect.Move(-aDeltaMove.Width(), -aDeltaMove.Height());
1111 
1112  // Now, move as needed (no empty delta which was a hack anyways)
1113  if(bIsTransformableSwFrame)
1114  {
1115  // need to save aOutRect to FrameArea, will be restored to aOutRect in
1116  // SwVirtFlyDrawObj::NbcMove currently for TransformableSwFrames
1118  aFrm.setSwRect(aOutRect);
1119  }
1120 
1121  // keep old hack - not clear what happens here
1122  bInResize = true;
1123  NbcMove(aDeltaMove);
1124  bInResize = false;
1125  }
1126 }
1127 
1128 void SwVirtFlyDrawObj::Move(const Size& rSiz)
1129 {
1130  NbcMove( rSiz );
1131  SetChanged();
1133 }
1134 
1136  const Fraction& xFact, const Fraction& yFact, bool /*bUnsetRelative*/)
1137 {
1138  NbcResize( rRef, xFact, yFact );
1139  SetChanged();
1141 }
1142 
1143 void SwVirtFlyDrawObj::Crop(const basegfx::B2DPoint& rRef, double fxFact, double fyFact)
1144 {
1145  NbcCrop( rRef, fxFact, fyFact );
1146  SetChanged();
1148 }
1149 
1150 // RotGrfFlyFrame: Helper to access possible rotation of Graphic contained in FlyFrame
1152 {
1153  sal_uInt16 nRetval(0);
1154  const SwNoTextFrame* pNoTx = dynamic_cast< const SwNoTextFrame* >(GetFlyFrame()->Lower());
1155 
1156  if(pNoTx)
1157  {
1158  SwNoTextNode& rNoTNd = const_cast< SwNoTextNode& >(*static_cast<const SwNoTextNode*>(pNoTx->GetNode()));
1159  SwGrfNode* pGrfNd = rNoTNd.GetGrfNode();
1160 
1161  if(nullptr != pGrfNd)
1162  {
1163  const SwAttrSet& rSet = pGrfNd->GetSwAttrSet();
1164  const SwRotationGrf& rRotation = rSet.GetRotationGrf();
1165 
1166  rSize = rRotation.GetUnrotatedSize();
1167  nRetval = rRotation.GetValue();
1168  }
1169  }
1170 
1171  return nRetval;
1172 }
1173 
1175 {
1176  if(ContainsSwGrfNode())
1177  {
1178  Size aSize;
1180  }
1181  else
1182  {
1183  return SdrVirtObj::GetRotateAngle();
1184  }
1185 }
1186 
1188 {
1189  // call parent
1191 
1192  if(pRetval && GetFlyFrame() && ContainsSwGrfNode())
1193  {
1194  // RotGrfFlyFrame3: get inner bounds/transformation
1195  const basegfx::B2DHomMatrix aTargetTransform(GetFlyFrame()->getFramePrintAreaTransformation());
1196 
1197  pRetval->TRSetBaseGeometry(aTargetTransform, basegfx::B2DPolyPolygon());
1198  }
1199 
1200  return pRetval;
1201 }
1202 
1204 {
1205  // RotGrfFlyFrame: Adapt to possible rotated Graphic contained in FlyFrame
1206  if(GetFlyFrame()->getFrameArea().HasArea())
1207  {
1208  // Use InnerBound, OuterBound (same as GetFlyFrame()->getFrameArea().SVRect())
1209  // may have a distance to InnerBound which needs to be taken into account.
1210  // The Graphic is mapped to InnerBound, as is the rotated Graphic.
1211  const basegfx::B2DRange aTargetRange(getInnerBound());
1212 
1213  if(!aTargetRange.isEmpty())
1214  {
1215  // RotGrfFlyFrame3: get inner bounds/transformation
1216  const basegfx::B2DHomMatrix aTargetTransform(GetFlyFrame()->getFramePrintAreaTransformation());
1217 
1218  // break up matrix
1219  basegfx::B2DTuple aScale;
1220  basegfx::B2DTuple aTranslate;
1221  double fRotate(0.0);
1222  double fShearX(0.0);
1223  aTargetTransform.decompose(aScale, aTranslate, fRotate, fShearX);
1224  basegfx::B2DPoint aPos;
1225 
1226  aPos = aTargetTransform * basegfx::B2DPoint(0.0, 0.0);
1227  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperLeft, fShearX, fRotate));
1228  aPos = aTargetTransform * basegfx::B2DPoint(0.5, 0.0);
1229  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Upper, fShearX, fRotate));
1230  aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.0);
1231  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::UpperRight, fShearX, fRotate));
1232  aPos = aTargetTransform * basegfx::B2DPoint(0.0, 0.5);
1233  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Left , fShearX, fRotate));
1234  aPos = aTargetTransform * basegfx::B2DPoint(1.0, 0.5);
1235  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Right, fShearX, fRotate));
1236  aPos = aTargetTransform * basegfx::B2DPoint(0.0, 1.0);
1237  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerLeft, fShearX, fRotate));
1238  aPos = aTargetTransform * basegfx::B2DPoint(0.5, 1.0);
1239  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::Lower, fShearX, fRotate));
1240  aPos = aTargetTransform * basegfx::B2DPoint(1.0, 1.0);
1241  rTarget.AddHdl(std::make_unique<SdrCropHdl>(Point(basegfx::fround(aPos.getX()), basegfx::fround(aPos.getY())), SdrHdlKind::LowerRight, fShearX, fRotate));
1242  }
1243  }
1244 }
1245 
1246 // Macro
1247 
1249  const SdrObjMacroHitRec& ) const
1250 {
1251  return PointerStyle::RefHand;
1252 }
1253 
1255 {
1256  const SwFormatURL &rURL = m_pFlyFrame->GetFormat()->GetURL();
1257  return rURL.GetMap() || !rURL.GetURL().isEmpty();
1258 }
1259 
1261 {
1262  const SwFormatURL &rURL = m_pFlyFrame->GetFormat()->GetURL();
1263  if( rURL.GetMap() || !rURL.GetURL().isEmpty() )
1264  {
1265  SwRect aRect;
1266  if ( m_pFlyFrame->Lower() && m_pFlyFrame->Lower()->IsNoTextFrame() )
1267  {
1268  aRect = m_pFlyFrame->getFramePrintArea();
1269  aRect += m_pFlyFrame->getFrameArea().Pos();
1270  }
1271  else
1272  aRect = m_pFlyFrame->getFrameArea();
1273 
1274  if( aRect.IsInside( rRec.aPos ) )
1275  {
1276  aRect.Pos().setX(aRect.Pos().getX() + rRec.nTol);
1277  aRect.Pos().setY(aRect.Pos().getY() + rRec.nTol);
1278  aRect.SSize().AdjustHeight( -(2 * rRec.nTol) );
1279  aRect.SSize().AdjustWidth( -(2 * rRec.nTol) );
1280 
1281  if( aRect.IsInside( rRec.aPos ) )
1282  {
1283  if( !rURL.GetMap() ||
1285  return const_cast<SwVirtFlyDrawObj*>(this);
1286 
1287  return nullptr;
1288  }
1289  }
1290  }
1291  return SdrObject::CheckMacroHit( rRec );
1292 }
1293 
1295 {
1297 }
1298 
1299 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
vcl::RenderContext * GetOut() const
Definition: viewsh.hxx:341
Point TopLeft() const
long getHeight() const
Base class of the Writer layout elements.
Definition: frame.hxx:295
long GetWidth() const
void expand(const B2DTuple &rTuple)
bool IsFlyLayFrame() const
Definition: flyfrm.hxx:195
virtual SdrObject * getFullDragClone() const override
Definition: dflyobj.cxx:1187
virtual const SwFlyFrameFormat * GetFormat() const override
Definition: fly.cxx:2814
const basegfx::B2DRange & getViewport() const
long GetHeight() const
ImplPrimitive2DIDBlock(BorderLinePrimitive2D, PRIMITIVE2D_ID_BORDERLINEPRIMITIVE2D) Primitive2DReference tryMergeBorderLinePrimitive2D(const Primitive2DReference &rCandidateA
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
Definition: dflyobj.cxx:228
const basegfx::B2DRange & getOuterRange() const
Definition: dflyobj.cxx:181
SwVirtFlyDrawObjPrimitive(const SwVirtFlyDrawObj &rSwVirtFlyDrawObj, const basegfx::B2DRange &rOuterRange)
Definition: dflyobj.cxx:163
SdrObjUserCall * pUserCall
virtual void addCropHandles(SdrHdlList &rTarget) const override
Definition: dflyobj.cxx:1203
B2DTuple absolute(const B2DTuple &rTup)
SwDocShell * GetDocShell()
Definition: doc.hxx:1340
virtual long GetRotateAngle() const override
#define RES_HORI_ORIENT
Definition: hintids.hxx:208
Point LogicToLogic(const Point &rPtSource, const MapMode *pMapModeSource, const MapMode *pMapModeDest) const
#define DeclPrimitive2DIDBlock()
long Height() const
virtual void get2DDecomposition(Primitive2DDecompositionVisitor &rVisitor, const geometry::ViewInformation2D &rViewInformation) const override
basegfx::B2DRange getInnerBound() const
Definition: dflyobj.cxx:337
const SwFormatVertOrient & GetVertOrient(bool=true) const
Definition: fmtornt.hxx:106
VCOfSwVirtFlyDrawObj(SwVirtFlyDrawObj &rObj)
basic constructor, used from SdrObject.
Definition: dflyobj.cxx:267
long getWidth() const
void setSwRect(const SwRect &rNew)
Definition: frame.hxx:194
#define MINFLY
Definition: swtypes.hxx:65
SwTwips GetPos() const
Definition: fmtornt.hxx:92
const SwRect & getFramePrintArea() const
Definition: frame.hxx:176
static SwCache & GetCache()
Definition: frame.hxx:500
void SetRect() const
Definition: dflyobj.cxx:553
double getX() const
virtual void create2DDecomposition(Primitive2DContainer &rContainer, const geometry::ViewInformation2D &rViewInformation) const override
method which is to be used to implement the local decomposition of a 2D primitive ...
Definition: dflyobj.cxx:193
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override
This method is responsible for creating the graphical visualisation data.
Definition: dflyobj.cxx:105
sal_uInt16 GetValue() const
void Height(long nNew)
Definition: swrect.hxx:189
double getY() const
SdrInventor
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
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:176
const Size & GetUnrotatedSize() const
Definition: grfatr.hxx:108
bool IsRecord() const
Of course Writer needs its own rectangles.
Definition: swrect.hxx:34
bool IsSizeProtected() const
virtual void PaintSwFrame(vcl::RenderContext &rRenderContext, SwRect const &, SwPrintData const *const pPrintData=nullptr) const override
Definition: paintfrm.cxx:3849
static bool bInResize
Definition: dflyobj.cxx:73
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:55
void EndAllAction()
Definition: edws.cxx:96
virtual basegfx::B2DHomMatrix getFrameAreaTransformation() const
Definition: wsfrm.cxx:121
sal_Int32 GetBrowseWidth() const
Definition: viewsh.cxx:2001
bool ContainsSwGrfNode() const
Definition: dflyobj.cxx:361
void Move(long nHorzMoveDelta, long nVertMoveDelta)
const MapMode & getPrePostMapMode() const
Definition: viewsh.hxx:230
static OutputDevice * GetDefaultDevice()
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const
Used by the UI to modify the document model.
Definition: wrtsh.hxx:86
const SwVirtFlyDrawObj & getSwVirtFlyDrawObj() const
Definition: dflyobj.cxx:180
virtual bool operator==(const BasePrimitive2D &rPrimitive) const override
Definition: dflyobj.cxx:210
sal_uInt16 CalcLeftLine() const
Definition: frmtool.hxx:487
long Right() const
SdrPage * getSdrPageFromSdrObject() const
void restoreFrameAreas()
Definition: wsfrm.cxx:265
const SwRect & getFrameArea() const
Definition: frame.hxx:175
bool getBrowseMode() const
Definition: viewopt.hxx:426
#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
Definition: docfmt.cxx:478
basegfx::B2DRange getOuterBound() const
Definition: dflyobj.cxx:313
static bool isTextBox(const SwFrameFormat *pFormat, sal_uInt16 nType)
Is the frame format a text box?
virtual ~SwFlyDrawObj() override
Definition: dflyobj.cxx:132
virtual SdrObject * getFullDragClone() const override
virtual long GetRotateAngle() const override
Definition: dflyobj.cxx:1174
bool OnRightPage() const
Definition: frame.hxx:711
Size GetPrefSize() const
const SdrObject & GetReferencedObj() const
long Top() const
virtual ~SwVirtFlyDrawObj() override
Definition: dflyobj.cxx:435
bool IsFlyInContentFrame() const
Definition: flyfrm.hxx:193
virtual bool HasMacro() const override
Definition: dflyobj.cxx:1254
virtual sal_uInt16 GetObjIdentifier() const override
Definition: dflyobj.cxx:142
B2IRange fround(const B2DRange &rRange)
virtual void Changed(const SdrObject &rObj, SdrUserCallType eType, const tools::Rectangle &rOldBoundRect)
MapMode GetPrefMapMode() const
SwVirtFlyDrawObj(SdrModel &rSdrModel, SdrObject &rNew, SwFlyFrame *pFly)
Definition: dflyobj.cxx:423
#define RES_FLYFRMFMT
Definition: hintids.hxx:274
bool IsColumnFrame() const
Definition: frame.hxx:1158
virtual PointerStyle GetMacroPointer(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1248
bool isEmpty() const
virtual void RecalcSnapRect() override
Definition: dflyobj.cxx:577
const SfxItemPool & GetAttrPool() const
Definition: viewsh.hxx:614
void ResizeRect(tools::Rectangle &rRect, const Point &rRef, const Fraction &rxFact, const Fraction &ryFact)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: dflyobj.cxx:968
virtual drawinglayer::primitive2d::Primitive2DContainer createViewIndependentPrimitive2DSequence() const override
This method is responsible for creating the graphical visualisation data.
Definition: dflyobj.cxx:285
Style of a layout element.
Definition: frmfmt.hxx:57
void wrap_DoPaintObject(drawinglayer::geometry::ViewInformation2D const &) const
Definition: dflyobj.cxx:495
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:165
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: dflyobj.cxx:114
const SwColumns & GetColumns() const
Definition: fmtclds.hxx:112
const SwRect & VisArea() const
Definition: viewsh.cxx:570
virtual SdrInventor GetObjInventor() const override
Definition: dflyobj.cxx:137
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:619
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
const SwFormatHoriOrient & GetHoriOrient(bool=true) const
Definition: fmtornt.hxx:108
SwPageFrame * FindPageFrame()
Definition: frame.hxx:658
#define RES_VERT_ORIENT
Definition: hintids.hxx:207
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon)
tools::Rectangle aOutRect
const SwFrame * Lower() const
Definition: layfrm.hxx:100
void SetAttrItem(const SfxPoolItem &, SetAttrMode nFlags=SetAttrMode::DEFAULT, const bool bParagraphSetting=false)
Definition: edatmisc.cxx:113
void BroadcastObjectChange() const
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
const sal_uInt16 SwFlyDrawObjIdentifier
Definition: dflyobj.hxx:31
sal_uInt16 GetHtmlMode(const SwDocShell *pShell)
Definition: viewopt.cxx:339
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: dflyobj.cxx:537
const GraphicObject * GetGraphicObj() const
Definition: editsh.cxx:263
virtual void Resize(const Point &rRef, const Fraction &xFact, const Fraction &yFact, bool bUnsetRelative=true) override
Definition: dflyobj.cxx:1135
const SwFormatURL & GetURL(bool=true) const
Definition: fmturl.hxx:78
SwLayoutFrame * GetUpper()
Definition: frame.hxx:656
bool HasArea() const
Definition: swrect.hxx:290
virtual SdrObject * CheckMacroHit(const SdrObjMacroHitRec &rRec) const override
Definition: dflyobj.cxx:1260
long Bottom() const
void scale(double fX, double fY)
sal_Int16 GetHoriOrient() const
Definition: fmtornt.hxx:87
sal_uInt32 GetOrdNum() const
const SwAttrSet & GetAttrSet() const
Definition: frmtool.hxx:360
sal_uInt16 getPossibleRotationFromFraphicFrame(Size &rSize) const
Definition: dflyobj.cxx:1151
MapUnit GetMapUnit() const
virtual void NbcCrop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:794
const SwRotationGrf & GetRotationGrf(bool=true) const
Definition: grfatr.hxx:284
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
void SSize(const Size &rNew)
Definition: swrect.hxx:176
virtual SdrObject * RemoveObject(size_t nObjNum)
long X() const
virtual void Move(const Size &rSiz) override
Definition: dflyobj.cxx:1128
SwBorderAttrs * Get()
Definition: frmtool.cxx:2374
IMapObject * GetIMapObject(const Point &rPoint, const SwFlyFrame *pFly=nullptr) const
Definition: atrfrm.cxx:3372
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
basegfx::B2DRange b2DRectangleFromRectangle(const ::tools::Rectangle &rRect)
Point PixelToLogic(const Point &rDevicePt) const
bool IsPause() const
const ImageMap * GetMap() const
Definition: fmturl.hxx:68
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:460
virtual void DoDrawUndo(bool const bDoUndo)=0
Enable/Disable Undo for Drawing objects.
SwFlyFrame * m_pFlyFrame
Definition: dflyobj.hxx:61
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D &rViewInformation) const override
Definition: dflyobj.cxx:223
void Left(const long nLeft)
Definition: swrect.hxx:193
virtual const tools::Rectangle & GetLogicRect() const override
Definition: dflyobj.cxx:603
SwVirtFlyDrawObj & GetSwVirtFlyDrawObj() const
access to SwVirtFlyDrawObj
Definition: dflyobj.cxx:273
bool IsPosToggle() const
Definition: fmtornt.hxx:95
const SwContentNode * GetNode() const
Definition: notxtfrm.hxx:60
SwFlyFrame * GetFlyFrame()
Definition: dflyobj.hxx:127
bool bSizProt
bool IsVertLR() const
Definition: frame.hxx:955
tools::Rectangle SVRect() const
Definition: swrect.hxx:282
general base class for all free-flowing frames
Definition: flyfrm.hxx:60
sal_Int16 GetRelationOrient() const
Definition: fmtornt.hxx:88
unsigned char sal_uInt8
const SwViewOption * GetViewOptions() const
Definition: viewsh.hxx:426
void Width(long nNew)
Definition: swrect.hxx:185
SwTwips GetPos() const
Definition: fmtornt.hxx:59
virtual const tools::Rectangle & GetLastBoundRect() const override
Definition: dflyobj.cxx:567
virtual void SetLogicRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:609
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
virtual Size ChgSize(const Size &aNewSize) override
Definition: fly.cxx:2074
bool IsInside(const Point &rPOINT) const
Definition: swrect.cxx:110
bool IsNoTextFrame() const
Definition: frame.hxx:1214
Primitive2DReference createHiddenGeometryPrimitives2D(const basegfx::B2DHomMatrix &rMatrix)
bool bMovProt
bool IsRightToLeft() const
Definition: frame.hxx:963
virtual void Crop(const basegfx::B2DPoint &rRef, double fxFact, double fyFact) override
Definition: dflyobj.cxx:1143
virtual void NbcSetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:598
#define RES_GRFATR_CROPGRF
Definition: hintids.hxx:240
const Size & GetBrowseBorder() const
Definition: viewsh.cxx:1996
css::uno::Reference< css::graphic::XPrimitive2D > Primitive2DReference
sal_Int16 GetVertOrient() const
Definition: fmtornt.hxx:54
long Left() const
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:416
void translate(double fX, double fY)
static bool IsPaint(SdrObject *pObj, const SwViewShell *pSh)
Definition: paintfrm.cxx:3745
PointerStyle
virtual ::basegfx::B2DPolyPolygon TakeXorPoly() const override
Definition: dflyobj.cxx:624
bool GetCurAttr(SfxItemSet &, const bool bMergeIndentValuesOfNumRule=false) const
Definition: edattr.cxx:181
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:723
SwFlyDrawObj(SdrModel &rSdrModel)
Definition: dflyobj.cxx:127
virtual const tools::Rectangle & GetSnapRect() const override
Definition: dflyobj.cxx:582
virtual void RecalcBoundRect() override
Definition: dflyobj.cxx:572
constexpr sal_Int64 convertTwipToMm100(sal_Int64 n)
bool IsVertical() const
Definition: frame.hxx:949
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: dflyobj.cxx:120
void SetRotation(sal_uInt16 nOld, sal_uInt16 nNew, const Size &rUnrotatedSize)
Definition: frmmgr.cxx:578
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:82
const SwFrame * GetAnchorFrame() const
SwGrfNode * GetGrfNode()
Definition: ndgrf.hxx:155
virtual bool HasLimitedRotation() const override
Definition: dflyobj.cxx:378
constexpr sal_Int64 convertMm100ToTwip(sal_Int64 n)
virtual void SetChanged()
void StartAllAction()
For all views of this document.
Definition: edws.cxx:85
bool IsBodyFrame() const
Definition: frame.hxx:1182
SwViewShell * GetCurrShell() const
Definition: rootfrm.hxx:204
void ChgRelPos(const Point &rAbsPos)
Change the relative position.
Definition: fly.cxx:1073
virtual void Rotate(const Point &rRef, long nAngle, double sn, double cs) override
Definition: dflyobj.cxx:385
bool IsDrawingLayerPaintInProgress() const
Definition: viewsh.hxx:242
virtual void NbcMove(const Size &rSiz) override
Definition: dflyobj.cxx:636
virtual void SetSnapRect(const tools::Rectangle &rRect) override
Definition: dflyobj.cxx:588
SwRootFrame * getRootFrame()
Definition: frame.hxx:657
virtual bool IsTextBox() const override
Definition: dflyobj.cxx:1294
const SwFrameFormat * GetFormat() const
Definition: dflyobj.cxx:441
Point Center() const
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
long Y() const
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1307
bool IsPosProtected() const
const OUString & GetURL() const
Definition: fmturl.hxx:66
sal_uInt16 CalcRightLine() const
Definition: frmtool.hxx:493
virtual const tools::Rectangle & GetCurrentBoundRect() const override
Definition: dflyobj.cxx:561
VCOfSwFlyDrawObj(SwFlyDrawObj &rObj)
basic constructor, used from SdrObject.
Definition: dflyobj.cxx:99
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo