LibreOffice Module svx (master)  1
svdcrtv.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 
21 #include <svx/svdcrtv.hxx>
22 #include <svx/xlnclit.hxx>
23 #include <svx/svdocapt.hxx>
24 #include <svx/svdoedge.hxx>
25 #include <svx/svdpagv.hxx>
26 #include <svx/svdpage.hxx>
27 #include <svx/scene3d.hxx>
28 #include <svx/view3d.hxx>
29 #include <svx/xfillit0.hxx>
30 #include <svx/xflclit.hxx>
31 #include <svx/xlineit0.hxx>
32 #include <svx/svdouno.hxx>
33 #include <svx/svdopath.hxx>
36 #include <svx/sdrpaintwindow.hxx>
37 #include <fmobj.hxx>
38 #include <svx/svdocirc.hxx>
41 #include <vcl/ptrstyle.hxx>
42 
43 using namespace com::sun::star;
44 
46 {
47  // The OverlayObjects
49 
50  // The remembered target object
52 
53 public:
54  ImplConnectMarkerOverlay(const SdrCreateView& rView, SdrObject const & rObject);
55 
56  // The OverlayObjects are cleared using the destructor of OverlayObjectList.
57  // That destructor calls clear() at the list which removes all objects from the
58  // OverlayManager and deletes them.
59 
60  const SdrObject& GetTargetObject() const { return mrObject; }
61 };
62 
64 : mrObject(rObject)
65 {
66  basegfx::B2DPolyPolygon aB2DPolyPolygon(rObject.TakeXorPoly());
67 
68  for(sal_uInt32 a(0); a < rView.PaintWindowCount(); a++)
69  {
70  SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
71  const rtl::Reference< sdr::overlay::OverlayManager >& xTargetOverlay = pCandidate->GetOverlayManager();
72 
73  if(xTargetOverlay.is())
74  {
75  float fScalingFactor = xTargetOverlay->getOutputDevice().GetDPIScaleFactor();
76  Size aHalfLogicSize(xTargetOverlay->getOutputDevice().PixelToLogic(Size(4 * fScalingFactor, 4 * fScalingFactor)));
77 
78  // object
79  std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
80  aB2DPolyPolygon));
81  xTargetOverlay->add(*pNew);
82  maObjects.append(std::move(pNew));
83 
84  // gluepoints
85  for(sal_uInt16 i(0); i < 4; i++)
86  {
87  SdrGluePoint aGluePoint(rObject.GetVertexGluePoint(i));
88  const Point& rPosition = aGluePoint.GetAbsolutePos(rObject);
89 
90  basegfx::B2DPoint aTopLeft(rPosition.X() - aHalfLogicSize.Width(), rPosition.Y() - aHalfLogicSize.Height());
91  basegfx::B2DPoint aBottomRight(rPosition.X() + aHalfLogicSize.Width(), rPosition.Y() + aHalfLogicSize.Height());
92 
93  basegfx::B2DPolygon aTempPoly;
94  aTempPoly.append(aTopLeft);
95  aTempPoly.append(basegfx::B2DPoint(aBottomRight.getX(), aTopLeft.getY()));
96  aTempPoly.append(aBottomRight);
97  aTempPoly.append(basegfx::B2DPoint(aTopLeft.getX(), aBottomRight.getY()));
98  aTempPoly.setClosed(true);
99 
100  basegfx::B2DPolyPolygon aTempPolyPoly;
101  aTempPolyPoly.append(aTempPoly);
102 
103  std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew2(new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
104  aTempPolyPoly));
105  xTargetOverlay->add(*pNew2);
106  maObjects.append(std::move(pNew2));
107  }
108  }
109  }
110 }
111 
113 {
114  // The OverlayObjects for XOR replacement
116 
117 public:
120 
121  void CreateAndShowOverlay(const SdrCreateView& rView, const SdrObject* pObject, const basegfx::B2DPolyPolygon& rPolyPoly);
122  void HideOverlay();
123 };
124 
126 {
127 }
128 
130 {
131  HideOverlay();
132 }
133 
135 {
136  for(sal_uInt32 a(0); a < rView.PaintWindowCount(); a++)
137  {
138  SdrPaintWindow* pCandidate = rView.GetPaintWindow(a);
139  const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
140 
141  if (xOverlayManager.is())
142  {
143  if(pObject)
144  {
145  const sdr::contact::ViewContact& rVC = pObject->GetViewContact();
148  std::unique_ptr<sdr::overlay::OverlayObject> pNew(new sdr::overlay::OverlayPrimitive2DSequenceObject(std::move(aSequence)));
149 
150  xOverlayManager->add(*pNew);
151  maObjects.append(std::move(pNew));
152  }
153 
154  if(rPolyPoly.count())
155  {
156  std::unique_ptr<sdr::overlay::OverlayPolyPolygonStripedAndFilled> pNew(new sdr::overlay::OverlayPolyPolygonStripedAndFilled(
157  rPolyPoly));
158  xOverlayManager->add(*pNew);
159  maObjects.append(std::move(pNew));
160  }
161  }
162  }
163 }
164 
166 {
167  // the clear() call of the list removes all objects from the
168  // OverlayManager and deletes them.
169  maObjects.clear();
170 }
171 
172 
173 // CreateView
174 
175 
177 {
178  mpCoMaOverlay.reset();
179 }
180 
182  : SdrDragView(rSdrModel, pOut)
183  , mpCurrentCreate(nullptr)
184  , mpCreatePV(nullptr)
185  , mpCreateViewExtraData(new ImpSdrCreateViewExtraData())
186  , maCurrentCreatePointer(PointerStyle::Cross)
187  , mnAutoCloseDistPix(5)
188  , mnFreeHandMinDistPix(10)
189  , mnCurrentInvent(SdrInventor::Default)
190  , mnCurrentIdent(SdrObjKind::NONE)
191  , mb1stPointAsCenter(false)
192  , mbUseIncompatiblePathCreateInterface(false)
193 {
194 }
195 
197 {
199  mpCreateViewExtraData.reset();
201 }
202 
204 {
205  return SdrDragView::IsAction() || mpCurrentCreate!=nullptr;
206 }
207 
208 void SdrCreateView::MovAction(const Point& rPnt)
209 {
211  if (mpCurrentCreate != nullptr) {
212  MovCreateObj(rPnt);
213  }
214 }
215 
217 {
220 }
221 
223 {
224  if (mpCurrentCreate != nullptr) BckCreateObj();
226 }
227 
229 {
231  BrkCreateObj();
232 }
233 
235 {
236  if (mpCurrentCreate != nullptr)
237  {
238  rRect=maDragStat.GetActionRect();
239  if (rRect.IsEmpty())
240  {
242  }
243  }
244  else
245  {
247  }
248 }
249 
251 {
252  if (mpCurrentCreate != nullptr)
253  {
254  // is managed by EdgeObj
256  }
257 
259  {
261  return false;
262  }
263  else
264  {
265  // sal_True, if MouseMove should check Connect
266  return !IsAction();
267  }
268 }
269 
271 {
272  SdrObject* pTargetObject = rCon.pObj;
273 
274  if(pTargetObject)
275  {
276  // if target object changes, throw away overlay object to make room for changes
277  if(mpCoMaOverlay && pTargetObject != &mpCoMaOverlay->GetTargetObject())
278  {
280  }
281 
282  if(!mpCoMaOverlay)
283  {
284  mpCoMaOverlay.reset(new ImplConnectMarkerOverlay(*this, *pTargetObject));
285  }
286  }
287  else
288  {
290  }
291 }
292 
294 {
296 }
297 
299 {
300  if(CheckEdgeMode() && pWin)
301  {
302  SdrPageView* pPV = GetSdrPageView();
303 
304  if(pPV)
305  {
306  // TODO: Change default hit tolerance at IsMarkedHit() some time!
307  Point aPos(pWin->PixelToLogic(rMEvt.GetPosPixel()));
308  bool bMarkHit=PickHandle(aPos)!=nullptr || IsMarkedObjHit(aPos);
309  SdrObjConnection aCon;
310  if (!bMarkHit) SdrEdgeObj::ImpFindConnector(aPos,*pPV,aCon,nullptr,pWin);
311  SetConnectMarker(aCon);
312  }
313  }
314  return SdrDragView::MouseMove(rMEvt,pWin);
315 }
316 
318 {
322  || mnCurrentIdent==SdrObjKind::TitleText
323  || mnCurrentIdent==SdrObjKind::OutlineText);
324 }
325 
327 {
329 }
330 
332 {
334 }
335 
337 {
338  if (mnCurrentInvent!=nInvent || mnCurrentIdent!=nIdent)
339  {
340  mnCurrentInvent=nInvent;
341  mnCurrentIdent=nIdent;
342  SdrObject * pObj = (nIdent == SdrObjKind::NONE) ? nullptr :
344  *GetModel(),
345  nInvent,
346  nIdent);
347 
348  if(pObj)
349  {
350  // Using text tool, mouse cursor is usually I-Beam,
351  // crosshairs with tiny I-Beam appears only on MouseButtonDown.
352  if(IsTextTool())
353  {
354  // Here the correct pointer needs to be used
355  // if the default is set to vertical writing
356  maCurrentCreatePointer = PointerStyle::Text;
357  }
358  else
360 
361  SdrObject::Free( pObj );
362  }
363  else
364  {
365  maCurrentCreatePointer = PointerStyle::Cross;
366  }
367  }
368 
369  CheckEdgeMode();
371 }
372 
373 bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, const Point& rPnt, OutputDevice* pOut,
374  sal_Int16 nMinMov, const tools::Rectangle& rLogRect, SdrObject* pPreparedFactoryObject)
375 {
376  bool bRet=false;
377  UnmarkAllObj();
378  BrkAction();
379 
381 
383 
384  if (mpCreatePV != nullptr)
385  { // otherwise no side registered!
386  OUString aLay(maActualLayer);
387 
388  if(nInvent == SdrInventor::Default && nIdent == SdrObjKind::Measure && !maMeasureLayer.isEmpty())
389  {
390  aLay = maMeasureLayer;
391  }
392 
394  if (nLayer==SDRLAYER_NOTFOUND) nLayer = SdrLayerID(0);
395  if (!mpCreatePV->GetLockedLayers().IsSet(nLayer) && mpCreatePV->GetVisibleLayers().IsSet(nLayer))
396  {
397  if(pPreparedFactoryObject)
398  {
399  mpCurrentCreate = pPreparedFactoryObject;
400  }
401  else
402  {
404  *mpModel,
405  nInvent,
406  nIdent);
407  }
408 
409  Point aPnt(rPnt);
412  mnCurrentIdent != SdrObjKind::FreehandFill )) { // no snapping for Edge and Freehand
413  aPnt=GetSnapPos(aPnt, mpCreatePV);
414  }
415  if (mpCurrentCreate!=nullptr)
416  {
418 
419  // SW uses a naked SdrObject for frame construction. Normally, such an
420  // object should not be created. Since it is possible to use it as a helper
421  // object (e.g. in letting the user define an area with the interactive
422  // construction) at least no items should be set at that object.
423  if(nInvent != SdrInventor::Default || nIdent != SdrObjKind::NONE)
424  {
426  }
427 
428  if (mpModel && dynamic_cast<const SdrCaptionObj *>(mpCurrentCreate) != nullptr)
429  {
430  SfxItemSet aSet(mpModel->GetItemPool());
431  aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid
432  aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
433 
435  }
436  if (mpModel && nInvent==SdrInventor::Default && (nIdent==SdrObjKind::Text ||
438  {
439  // default for all text frames: no background, no border
440  SfxItemSet aSet(mpModel->GetItemPool());
441  aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid
442  aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
443  aSet.Put(XLineColorItem(OUString(),COL_BLACK)); // in case someone turns on Solid
444  aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
445 
447  }
448  if (!rLogRect.IsEmpty()) mpCurrentCreate->NbcSetLogicRect(rLogRect);
449 
450  // make sure drag start point is inside WorkArea
451  const tools::Rectangle& rWorkArea = GetWorkArea();
452 
453  if(!rWorkArea.IsEmpty())
454  {
455  if(aPnt.X() < rWorkArea.Left())
456  {
457  aPnt.setX( rWorkArea.Left() );
458  }
459 
460  if(aPnt.X() > rWorkArea.Right())
461  {
462  aPnt.setX( rWorkArea.Right() );
463  }
464 
465  if(aPnt.Y() < rWorkArea.Top())
466  {
467  aPnt.setY( rWorkArea.Top() );
468  }
469 
470  if(aPnt.Y() > rWorkArea.Bottom())
471  {
472  aPnt.setY( rWorkArea.Bottom() );
473  }
474  }
475 
476  maDragStat.Reset(aPnt);
477  maDragStat.SetView(static_cast<SdrView*>(this));
479  maDragStat.SetMinMove(ImpGetMinMovLogic(nMinMov,pOut));
480  mpDragWin=pOut;
482  {
483  ShowCreateObj(/*pOut,sal_True*/);
484  bRet=true;
485  }
486  else
487  {
489  mpCurrentCreate = nullptr;
490  mpCreatePV = nullptr;
491  }
492  }
493  }
494  }
495  return bRet;
496 }
497 
498 bool SdrCreateView::BegCreateObj(const Point& rPnt, OutputDevice* pOut, short nMinMov)
499 {
500  return ImpBegCreateObj(mnCurrentInvent,mnCurrentIdent,rPnt,pOut,nMinMov,tools::Rectangle(), nullptr);
501 }
502 
503 bool SdrCreateView::BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject)
504 {
505  SdrInventor nInvent(mnCurrentInvent);
506  SdrObjKind nIdent(mnCurrentIdent);
507 
508  if(pPreparedFactoryObject)
509  {
510  nInvent = pPreparedFactoryObject->GetObjInventor();
511  nIdent = pPreparedFactoryObject->GetObjIdentifier();
512  }
513 
514  return ImpBegCreateObj(nInvent, nIdent, rPnt, nullptr, nMinMov, tools::Rectangle(), pPreparedFactoryObject);
515 }
516 
517 bool SdrCreateView::BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz,
518  OutputDevice* pOut, short nMinMov)
519 {
521  tools::Rectangle(rPnt,Size(rObjSiz.Width()+1,rObjSiz.Height()+1)), nullptr);
522 }
523 
524 void SdrCreateView::MovCreateObj(const Point& rPnt)
525 {
526  if (mpCurrentCreate==nullptr)
527  return;
528 
529  Point aPnt(rPnt);
530  if (!maDragStat.IsNoSnap())
531  {
532  aPnt=GetSnapPos(aPnt, mpCreatePV);
533  }
534  if (IsOrtho())
535  {
538  }
539 
540  // If the drag point was limited and Ortho is active, do
541  // the small ortho correction (reduction) -> last parameter to FALSE.
542  bool bDidLimit(ImpLimitToWorkArea(aPnt));
543  if(bDidLimit && IsOrtho())
544  {
546  OrthoDistance8(maDragStat.GetPrev(), aPnt, false);
547  else if(maDragStat.IsOrtho4Possible())
548  OrthoDistance4(maDragStat.GetPrev(), aPnt, false);
549  }
550 
551  if (aPnt==maDragStat.GetNow()) return;
552  bool bIsMinMoved(maDragStat.IsMinMoved());
553  if (!maDragStat.CheckMinMoved(aPnt))
554  return;
555 
556  if (!bIsMinMoved) maDragStat.NextPoint();
557  maDragStat.NextMove(aPnt);
559 
560  // MovCreate changes the object, so use ActionChanged() on it
562 
563  // replace for DrawCreateObjDiff
564  HideCreateObj();
565  ShowCreateObj();
566 }
567 
568 void SdrCreateView::SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj)
569 {
570  const SdrLayerAdmin& rAd = pPageView->GetPage()->GetLayerAdmin();
571  SdrLayerID nLayer(0);
572 
573  // #i72535#
574  if(dynamic_cast<const FmFormObj*>( pObj) != nullptr)
575  {
576  // for FormControls, force to form layer
577  nLayer = rAd.GetLayerID(rAd.GetControlLayerName());
578  }
579  else
580  {
581  nLayer = rAd.GetLayerID(aActiveLayer);
582  }
583 
584  if(SDRLAYER_NOTFOUND == nLayer)
585  {
586  nLayer = SdrLayerID(0);
587  }
588 
589  pObj->SetLayer(nLayer);
590 }
591 
593 {
594  bool bRet=false;
595  SdrObject* pObjCreated=mpCurrentCreate;
596 
597  if (mpCurrentCreate!=nullptr)
598  {
599  sal_uInt32 nCount=maDragStat.GetPointCount();
600 
601  if (nCount<=1 && eCmd==SdrCreateCmd::ForceEnd)
602  {
603  BrkCreateObj(); // objects with only a single point don't exist (at least today)
604  return false; // sal_False = event not interpreted
605  }
606 
607  bool bPntsEq=nCount>1;
608  sal_uInt32 i=1;
609  Point aP0=maDragStat.GetPoint(0);
610  while (bPntsEq && i<nCount) { bPntsEq=aP0==maDragStat.GetPoint(i); i++; }
611 
613  {
614  HideCreateObj();
615 
616  if (!bPntsEq)
617  {
618  // otherwise Brk, because all points are equal
620  mpCurrentCreate=nullptr;
621 
623 
624  // recognize creation of a new 3D object inside a 3D scene
625  bool bSceneIntoScene(false);
626 
627  E3dScene* pObjScene = dynamic_cast<E3dScene*>(pObjCreated);
628  E3dScene* pCurrentScene = pObjScene ? dynamic_cast<E3dScene*>(mpCreatePV->GetCurrentGroup()) : nullptr;
629  if (pCurrentScene)
630  {
631  bool bDidInsert = static_cast<E3dView*>(this)->ImpCloneAll3DObjectsToDestScene(
632  pObjScene, pCurrentScene, Point(0, 0));
633 
634  if(bDidInsert)
635  {
636  // delete object, its content is cloned and inserted
637  SdrObject::Free( pObjCreated );
638  pObjCreated = nullptr;
639  bSceneIntoScene = true;
640  }
641  }
642 
643  if(!bSceneIntoScene)
644  {
645  // Here an interactively created SdrObject gets added, so
646  // take into account that interaction created an object in
647  // model coordinates. If we have e.g. a GirdOffset, this is a
648  // little bit tricky - we have an object in model coordinates,
649  // so the fetched offset is at the wrong point in principle
650  // since we need to 'substract' the offset here to get to
651  // 'real' model coordinates. But we have nothing better here,
652  // so go for it.
653  // The 2nd a little tricky thing is that this will early-create
654  // a ViewObjectContact for the new SdrObject, but these VOCs
655  // are anyways layouted for being create-on-demand. This will
656  // be adapted/replaced correctly later on.
657  // This *should* be the right place for getting all interactively
658  // created objects, see InsertObjectAtView below that calls
659  // CreateUndoNewObject.
660  basegfx::B2DVector aGridOffset(0.0, 0.0);
661  if(getPossibleGridOffsetForSdrObject(aGridOffset, pObj, mpCreatePV))
662  {
663  const Size aOffset(
664  basegfx::fround(-aGridOffset.getX()),
665  basegfx::fround(-aGridOffset.getY()));
666 
667  pObj->NbcMove(aOffset);
668  }
669 
670  // do the same as before
672  }
673 
674  mpCreatePV = nullptr;
675  bRet=true; // sal_True = event interpreted
676  }
677  else
678  {
679  BrkCreateObj();
680  }
681  }
682  else
683  { // more points
684  if (eCmd==SdrCreateCmd::ForceEnd || // nothing there -- force ending
685  nCount==0 || // no existing points (should never happen)
686  (nCount<=1 && !maDragStat.IsMinMoved())) { // MinMove not met
687  BrkCreateObj();
688  }
689  else
690  {
691  // replace for DrawCreateObjDiff
692  HideCreateObj();
693  ShowCreateObj();
694  maDragStat.ResetMinMoved(); // NextPoint is at MovCreateObj()
695  bRet=true;
696  }
697  }
698  }
699  return bRet;
700 }
701 
703 {
704  if (mpCurrentCreate==nullptr)
705  return;
706 
707  if (maDragStat.GetPointCount()<=2 )
708  {
709  BrkCreateObj();
710  }
711  else
712  {
713  HideCreateObj();
716  {
717  ShowCreateObj();
718  }
719  else
720  {
721  BrkCreateObj();
722  }
723  }
724 }
725 
727 {
728  if (mpCurrentCreate!=nullptr)
729  {
730  HideCreateObj();
733  mpCurrentCreate = nullptr;
734  mpCreatePV = nullptr;
735  }
736 }
737 
738 void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
739 {
740  if(!IsCreateObj() || maDragStat.IsShown())
741  return;
742 
743  if (mpCurrentCreate)
744  {
745  // for migration from XOR, replace DrawDragObj here to create
746  // overlay objects instead.
747  bool bUseSolidDragging(IsSolidDragging());
748 
749  // #i101648# check if dragged object is a naked SdrObject (not
750  // a derivation). This is e.g. used in SW Frame construction
751  // as placeholder. Do not use SolidDragging for naked SdrObjects,
752  // they cannot have a valid optical representation
753  if(bUseSolidDragging && SdrObjKind::NONE == mpCurrentCreate->GetObjIdentifier())
754  {
755  bUseSolidDragging = false;
756  }
757 
758  // check for objects with no fill and no line
759  if(bUseSolidDragging)
760  {
762  const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
763  const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
764 
765  if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
766  {
767  bUseSolidDragging = false;
768  }
769  }
770 
771  // check for form controls
772  if(bUseSolidDragging)
773  {
774  if (dynamic_cast<const SdrUnoObj*>(mpCurrentCreate) != nullptr)
775  {
776  bUseSolidDragging = false;
777  }
778  }
779 
780  // #i101781# force to non-solid dragging when not creating a full circle
781  if(bUseSolidDragging)
782  {
783  SdrCircObj* pCircObj = dynamic_cast<SdrCircObj*>(mpCurrentCreate);
784 
785  if(pCircObj && SdrObjKind::CircleOrEllipse != pCircObj->GetObjIdentifier())
786  {
787  // #i103058# Allow SolidDragging with four points
788  if(maDragStat.GetPointCount() < 4)
789  {
790  bUseSolidDragging = false;
791  }
792  }
793  }
794 
795  if(bUseSolidDragging)
796  {
797  basegfx::B2DPolyPolygon aDragPolyPolygon;
798 
799  if (dynamic_cast<const SdrRectObj*>(mpCurrentCreate) != nullptr)
800  {
801  // ensure object has some size, necessary for SdrTextObj because
802  // there are still untested divisions by that sizes
803  tools::Rectangle aCurrentSnapRect(mpCurrentCreate->GetSnapRect());
804 
805  if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
806  {
808  mpCurrentCreate->NbcSetSnapRect(aNewRect);
809  }
810  }
811 
812  if (auto pPathObj = dynamic_cast<SdrPathObj*>(mpCurrentCreate))
813  {
814  // The up-to-now created path needs to be set at the object to have something
815  // that can be visualized
816  const basegfx::B2DPolyPolygon aCurrentPolyPolygon(pPathObj->getObjectPolyPolygon(maDragStat));
817 
818  if(aCurrentPolyPolygon.count())
819  {
820  pPathObj->NbcSetPathPoly(aCurrentPolyPolygon);
821  }
822 
823  aDragPolyPolygon = pPathObj->getDragPolyPolygon(maDragStat);
824  }
825 
826  // use the SdrObject directly for overlay
827  mpCreateViewExtraData->CreateAndShowOverlay(*this, mpCurrentCreate, aDragPolyPolygon);
828  }
829  else
830  {
831  const ::basegfx::B2DPolyPolygon aPoly(mpCurrentCreate->TakeCreatePoly(maDragStat));
832 
833  mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
834  }
835 
836  // #i101679# Force changed overlay to be shown
837  for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
838  {
839  SdrPaintWindow* pCandidate = GetPaintWindow(a);
840  const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
841 
842  if (xOverlayManager.is())
843  {
844  xOverlayManager->flush();
845  }
846  }
847  }
848 
849  maDragStat.SetShown(true);
850 }
851 
853 {
854  if(IsCreateObj() && maDragStat.IsShown())
855  {
856  // for migration from XOR, replace DrawDragObj here to create
857  // overlay objects instead.
858  mpCreateViewExtraData->HideOverlay();
859 
860  //DrawCreateObj(pOut,bFull);
861  maDragStat.SetShown(false);
862  }
863 }
864 
865 
866 void SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const
867 {
868  if (mpCurrentCreate)
869  {
870  rTargetSet.Put(mpCurrentCreate->GetMergedItemSet());
871  }
872  else
873  {
874  SdrDragView::GetAttributes(rTargetSet, bOnlyHardAttr);
875  }
876 }
877 
878 bool SdrCreateView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
879 {
880  if (mpCurrentCreate)
881  {
882  mpCurrentCreate->SetMergedItemSetAndBroadcast(rSet, bReplaceAll);
883 
884  return true;
885  }
886  else
887  {
888  return SdrDragView::SetAttributes(rSet,bReplaceAll);
889  }
890 }
891 
893 {
894  if (mpCurrentCreate != nullptr)
895  {
896  return mpCurrentCreate->GetStyleSheet();
897  }
898  else
899  {
901  }
902 }
903 
904 void SdrCreateView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
905 {
906  if (mpCurrentCreate != nullptr)
907  {
908  mpCurrentCreate->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
909  }
910  else
911  {
912  SdrDragView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
913  }
914 }
915 
916 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
Definition: svdmrkv.cxx:2550
virtual bool BckCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1405
double getY() const
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1119
std::unique_ptr< ImplConnectMarkerOverlay > mpCoMaOverlay
Definition: svdcrtv.hxx:42
void SetMinMove(sal_uInt16 nDist)
Definition: svddrag.hxx:121
void append(const basegfx::B2DPoint &rPoint, sal_uInt32 nCount)
void Reset()
Definition: svddrag.cxx:36
OLE object.
Utility class SdrObjConnection.
Definition: svdoedge.hxx:39
bool EndCreateObj(SdrCreateCmd eCmd)
Definition: svdcrtv.cxx:592
virtual bool BegCreate(SdrDragStat &rStat)
Every object must be able to create itself interactively.
Definition: svdobj.cxx:1374
virtual bool IsAction() const override
Definition: svddrgv.cxx:71
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
void BckCreateObj()
Definition: svdcrtv.cxx:702
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svddrgv.cxx:106
bool IsShown() const
Definition: svddrag.hxx:115
bool BegCreateObj(const Point &rPnt, OutputDevice *pOut=nullptr, short nMinMov=-3)
Definition: svdcrtv.cxx:498
constexpr tools::Long Left() const
const Point & GetStart() const
Definition: svddrag.hxx:102
void ImpClearConnectMarker()
Definition: svdcrtv.cxx:176
bool BegCreatePreparedObject(const Point &rPnt, sal_Int16 nMinMov, SdrObject *pPreparedFactoryObject)
Definition: svdcrtv.cxx:503
SfxStyleSheet * GetStyleSheet() const
Definition: svdedxv.cxx:2299
bool IsEdgeTool() const
Definition: svdcrtv.cxx:326
bool CheckMinMoved(const Point &rPnt)
Definition: svddrag.cxx:86
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
OUString maMeasureLayer
Definition: svdpntv.hxx:131
void SetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2247
periodic cubic Spline (ni)
static SdrObject * MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
Definition: svdobj.cxx:3201
SdrDragStat maDragStat
Definition: svdpntv.hxx:140
bool CheckEdgeMode()
Definition: svdcrtv.cxx:250
SdrInventor
Definition: svdobj.hxx:99
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
const Point & GetPoint(sal_Int32 nNum) const
Definition: svddrag.hxx:100
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdcrtv.cxx:866
void append(std::unique_ptr< OverlayObject > pOverlayObject)
SfxStyleSheet * GetStyleSheet() const
Definition: svdcrtv.cxx:892
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
handle mouse over effects for handles
Definition: svdedxv.cxx:1930
open free-hand line
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:471
virtual SdrObjKind GetObjIdentifier() const
Definition: svdobj.cxx:649
static bool ImpFindConnector(const Point &rPt, const SdrPageView &rPV, SdrObjConnection &rCon, const SdrEdgeObj *pThis, OutputDevice *pOut=nullptr, SdrDragStat *pDragStat=nullptr)
Definition: svdoedge.cxx:2129
bool IsMeasureTool() const
Definition: svdcrtv.cxx:331
sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice *pOut) const
Definition: svdpntv.cxx:304
bool IsOrtho8Possible() const
Definition: svddrag.hxx:138
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
Definition: svdedtv.cxx:991
VclPtr< OutputDevice > mpDragWin
Definition: svdpntv.hxx:127
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:251
NONE
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1660
SdrObjKind
Definition: svdobjkind.hxx:24
SdrModel * mpModel
Definition: svdpntv.hxx:125
constexpr tools::Long Width() const
void ResetMinMoved()
Definition: svddrag.hxx:120
virtual void BckAction() override
Definition: svddrgv.cxx:94
static void SetupObjLayer(const SdrPageView *pPageView, const OUString &aActiveLayer, SdrObject *pObj)
Setup layer (eg. foreground / background) of the given object.
Definition: svdcrtv.cxx:568
virtual void BrkCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1401
virtual ~SdrCreateView() override
Definition: svdcrtv.cxx:196
virtual void MovAction(const Point &rPnt) override
Definition: svddrgv.cxx:76
bool IsOrtho() const
Definition: svdsnpv.hxx:246
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd)
Definition: svdobj.cxx:1393
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const
Definition: svdobj.cxx:2273
sdr::overlay::OverlayObjectList maObjects
Definition: svdcrtv.cxx:48
Point GetSnapPos(const Point &rPnt, const SdrPageView *pPV) const
Definition: svdsnpv.cxx:254
void HideCreateObj()
Definition: svdcrtv.cxx:852
int nCount
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2242
void SetMergedItemSet(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:1997
void MovCreateObj(const Point &rPnt)
Definition: svdcrtv.cxx:524
PointerStyle maCurrentCreatePointer
Definition: svdcrtv.hxx:48
B2IRange fround(const B2DRange &rRange)
bool IsMinMoved() const
Definition: svddrag.hxx:118
SdrInventor mnCurrentInvent
Definition: svdcrtv.hxx:52
constexpr bool IsEmpty() const
sal_uInt32 PaintWindowCount() const
Definition: svdpntv.hxx:218
virtual void EndAction() override
Definition: svddrgv.cxx:85
void BrkCreateObj()
Definition: svdcrtv.cxx:726
bool ImpLimitToWorkArea(Point &rPt) const
Definition: svdxcgv.cxx:64
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
handle mouse over effects for handles
Definition: svdcrtv.cxx:298
virtual bool MovCreate(SdrDragStat &rStat)
Definition: svdobj.cxx:1384
SfxStyleSheet * mpDefaultStyleSheet
Definition: svdpntv.hxx:128
connector object
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:210
virtual void SetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:690
void ImpSetGlueVisible3(bool bOn)
Definition: svdpntv.hxx:235
const OUString & GetControlLayerName() const
Definition: svdlayer.hxx:149
int i
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdocirc.cxx:178
uno_Any a
bool ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, const Point &rPnt, OutputDevice *pOut, sal_Int16 nMinMov, const tools::Rectangle &rLogRect, SdrObject *pPreparedFactoryObject)
Definition: svdcrtv.cxx:373
bool IsMarkedObjHit(const Point &rPnt, short nTol=-2) const
Definition: svdmrkv.cxx:1901
const tools::Rectangle & GetActionRect() const
Definition: svddrag.hxx:166
sal_Int32 GetPointCount() const
Definition: svddrag.hxx:101
void ActionChanged() const
Definition: svdobj.cxx:263
void ShowCreateObj()
Definition: svdcrtv.cxx:738
constexpr tools::Long Right() const
TitleText, special text object for StarDraw.
SdrCreateView(SdrModel &rSdrModel, OutputDevice *pOut)
Definition: svdcrtv.cxx:181
void SetMergedItemSetAndBroadcast(const SfxItemSet &rSet, bool bClearAllItems=false)
Definition: svdobj.cxx:2012
SdrHdl * PickHandle(const Point &rPnt) const
Definition: svdmrkv.cxx:1912
void OrthoDistance8(const Point &rPt0, Point &rPt, bool bBigOrtho)
Definition: svdtrans.cxx:522
void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default)
Definition: svdcrtv.cxx:336
constexpr tools::Long Top() const
const SdrLayerAdmin & GetLayerAdmin() const
changing the layers does not set the modified-flag!
Definition: svdpage.cxx:1719
void NextMove(const Point &rPnt)
Definition: svddrag.cxx:66
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdcrtv.cxx:904
SdrPageView * mpCreatePV
Definition: svdcrtv.hxx:41
o3tl::strong_int< sal_Int16, struct SdrLayerIDTag > SdrLayerID
Definition: svdtypes.hxx:56
void NextPoint()
Definition: svddrag.cxx:73
OUString maActualLayer
Definition: svdpntv.hxx:130
constexpr SdrLayerID SDRLAYER_NOTFOUND(-1)
bool IsTextTool() const
Definition: svdcrtv.cxx:317
Abstract DrawObject.
Definition: svdobj.hxx:259
bool IsCreateMode() const
Definition: svdmrkv.hxx:234
bool getPossibleGridOffsetForSdrObject(basegfx::B2DVector &rOffset, const SdrObject *pObj, const SdrPageView *pPV) const
Definition: svdmrkv.cxx:2206
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:644
const Point & GetPrev() const
Definition: svddrag.hxx:103
constexpr tools::Long Bottom() const
bool IsCreateObj() const
Definition: svdcrtv.hxx:119
SAL_WARN_UNUSED_RESULT Point PixelToLogic(const Point &rDevicePt) const
const SdrLayerIDSet & GetLockedLayers() const
Definition: svdpagv.hxx:214
virtual bool IsAction() const override
Definition: svdcrtv.cxx:203
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
bool IsSet(SdrLayerID a) const
Definition: svdsob.hxx:69
rectangle (round corners optional)
SdrViewEditMode meEditMode
Definition: svdmrkv.hxx:119
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SdrObject * mpCurrentCreate
Definition: svdcrtv.hxx:40
sdr::overlay::OverlayObjectList maObjects
Definition: svdcrtv.cxx:115
Derived class of SdrView to edit 3D objects.
Definition: view3d.hxx:41
sal_uInt32 count() const
void getViewIndependentPrimitive2DContainer(drawinglayer::primitive2d::Primitive2DDecompositionVisitor &rVisitor) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual void NbcSetSnapRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1665
constexpr tools::Long Height() const
virtual void NbcSetLogicRect(const tools::Rectangle &rRect)
Definition: svdobj.cxx:1675
SdrPage * GetPage() const
Definition: svdpagv.hxx:166
const SdrObject & mrObject
Definition: svdcrtv.cxx:51
virtual void NbcMove(const Size &rSiz)
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdobj.cxx:1427
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
bool IsSolidDragging() const
Definition: svddrgv.cxx:912
const SfxItemSet & GetMergedItemSet() const
Definition: svdobj.cxx:1972
virtual PointerStyle GetCreatePointer() const
get the cursor/pointer that signals creating this object
Definition: svdobj.cxx:1421
bool IsOrtho4Possible() const
Definition: svddrag.hxx:135
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdcrtv.cxx:878
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
const Point & GetPosPixel() const
const Point & GetNow() const
Definition: svddrag.hxx:105
PointerStyle
void CreateAndShowOverlay(const SdrCreateView &rView, const SdrObject *pObject, const basegfx::B2DPolyPolygon &rPolyPoly)
Definition: svdcrtv.cxx:134
void SetView(SdrView *pV)
Definition: svddrag.hxx:97
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:299
virtual void BrkAction() override
Definition: svddrgv.cxx:100
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svdcrtv.cxx:234
void SetConnectMarker(const SdrObjConnection &rCon)
Definition: svdcrtv.cxx:270
void PrevPoint()
Definition: svddrag.cxx:78
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdedxv.cxx:2151
bool BegCreateCaptionObj(const Point &rPnt, const Size &rObjSiz, OutputDevice *pOut=nullptr, short nMinMov=-3)
Definition: svdcrtv.cxx:517
void SetShown(bool bOn)
Definition: svddrag.hxx:116
virtual void MovAction(const Point &rPnt) override
Definition: svdcrtv.cxx:208
std::unique_ptr< ImpSdrCreateViewExtraData > mpCreateViewExtraData
Definition: svdcrtv.hxx:46
double getX() const
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:317
void SetPageView(SdrPageView *pPV)
Definition: svddrag.hxx:99
ImplConnectMarkerOverlay(const SdrCreateView &rView, SdrObject const &rObject)
Definition: svdcrtv.cxx:63
virtual void BrkAction() override
Definition: svdcrtv.cxx:228
void NbcSetStyleSheet(SfxStyleSheet *pNewStyleSheet, bool bDontRemoveHardAttr)
Definition: svdobj.cxx:2260
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdedxv.cxx:2320
SdrCreateCmd
Definition: svdtypes.hxx:26
bool IsBigOrtho() const
Definition: svdsnpv.hxx:258
closed Bezier-curve
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdedxv.cxx:2114
SdrLayerID GetLayerID(const OUString &rName) const
Definition: svdlayer.cxx:230
SdrObjKind mnCurrentIdent
Definition: svdcrtv.hxx:53
void OrthoDistance4(const Point &rPt0, Point &rPt, bool bBigOrtho)
Definition: svdtrans.cxx:538
SdrModel * GetModel() const
Definition: svdpntv.hxx:260
const SdrObject & GetTargetObject() const
Definition: svdcrtv.cxx:60
SfxItemSet maDefaultAttr
Definition: svdpntv.hxx:142
virtual void BckAction() override
Definition: svdcrtv.cxx:222
bool IsNoSnap() const
Definition: svddrag.hxx:130
const tools::Rectangle & GetWorkArea() const
Definition: svddrgv.hxx:210
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
Definition: svdpntv.cxx:75
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const
Polygon dragged by the user when creating the object.
Definition: svdobj.cxx:1410
void HideConnectMarker()
Definition: svdcrtv.cxx:293
SdrObject * pObj
Definition: svdoedge.hxx:46
virtual void EndAction() override
Definition: svdcrtv.cxx:216
object that represents a SdrPage
bool m_bDetectedRangeSegmentation false
SdrObject * GetCurrentGroup() const
Return current Group.
Definition: svdpagv.hxx:172