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