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