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
206void SdrCreateView::MovAction(const Point& rPnt)
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
369bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, const Point& rPnt, OutputDevice* pOut,
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 *mpModel,
401 nInvent,
402 nIdent);
403 }
404
405 Point aPnt(rPnt);
408 mnCurrentIdent != SdrObjKind::FreehandFill )) { // no snapping for Edge and Freehand
409 aPnt=GetSnapPos(aPnt, mpCreatePV);
410 }
411 if (mpCurrentCreate!=nullptr)
412 {
413 if (mpDefaultStyleSheet!=nullptr) mpCurrentCreate->NbcSetStyleSheet(mpDefaultStyleSheet, false);
414
415 // SW uses a naked SdrObject for frame construction. Normally, such an
416 // object should not be created. Since it is possible to use it as a helper
417 // object (e.g. in letting the user define an area with the interactive
418 // construction) at least no items should be set at that object.
419 if(nInvent != SdrInventor::Default || nIdent != SdrObjKind::NONE)
420 {
421 mpCurrentCreate->SetMergedItemSet(maDefaultAttr);
422 }
423
424 if (mpModel && dynamic_cast<const SdrCaptionObj *>(mpCurrentCreate.get()) != nullptr)
425 {
427 aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid
428 aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
429
430 mpCurrentCreate->SetMergedItemSet(aSet);
431 }
432 if (mpModel && nInvent==SdrInventor::Default && (nIdent==SdrObjKind::Text ||
434 {
435 // default for all text frames: no background, no border
437 aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid
438 aSet.Put(XFillStyleItem(drawing::FillStyle_NONE));
439 aSet.Put(XLineColorItem(OUString(),COL_BLACK)); // in case someone turns on Solid
440 aSet.Put(XLineStyleItem(drawing::LineStyle_NONE));
441
442 mpCurrentCreate->SetMergedItemSet(aSet);
443 }
444 if (!rLogRect.IsEmpty()) mpCurrentCreate->NbcSetLogicRect(rLogRect);
445
446 // make sure drag start point is inside WorkArea
447 const tools::Rectangle& rWorkArea = GetWorkArea();
448
449 if(!rWorkArea.IsEmpty())
450 {
451 if(aPnt.X() < rWorkArea.Left())
452 {
453 aPnt.setX( rWorkArea.Left() );
454 }
455
456 if(aPnt.X() > rWorkArea.Right())
457 {
458 aPnt.setX( rWorkArea.Right() );
459 }
460
461 if(aPnt.Y() < rWorkArea.Top())
462 {
463 aPnt.setY( rWorkArea.Top() );
464 }
465
466 if(aPnt.Y() > rWorkArea.Bottom())
467 {
468 aPnt.setY( rWorkArea.Bottom() );
469 }
470 }
471
472 maDragStat.Reset(aPnt);
473 maDragStat.SetView(static_cast<SdrView*>(this));
477 if (mpCurrentCreate->BegCreate(maDragStat))
478 {
479 ShowCreateObj(/*pOut,sal_True*/);
480 bRet=true;
481 }
482 else
483 {
484 mpCurrentCreate = nullptr;
485 mpCreatePV = nullptr;
486 }
487 }
488 }
489 }
490 return bRet;
491}
492
493bool SdrCreateView::BegCreateObj(const Point& rPnt, OutputDevice* pOut, short nMinMov)
494{
496}
497
498bool SdrCreateView::BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject)
499{
502
503 if(pPreparedFactoryObject)
504 {
505 nInvent = pPreparedFactoryObject->GetObjInventor();
506 nIdent = pPreparedFactoryObject->GetObjIdentifier();
507 }
508
509 return ImpBegCreateObj(nInvent, nIdent, rPnt, nullptr, nMinMov, tools::Rectangle(), pPreparedFactoryObject);
510}
511
512bool SdrCreateView::BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz,
513 OutputDevice* pOut, short nMinMov)
514{
516 tools::Rectangle(rPnt,Size(rObjSiz.Width()+1,rObjSiz.Height()+1)), nullptr);
517}
518
519void SdrCreateView::MovCreateObj(const Point& rPnt)
520{
521 if (mpCurrentCreate==nullptr)
522 return;
523
524 Point aPnt(rPnt);
525 if (!maDragStat.IsNoSnap())
526 {
527 aPnt=GetSnapPos(aPnt, mpCreatePV);
528 }
529 if (IsOrtho())
530 {
533 }
534
535 // If the drag point was limited and Ortho is active, do
536 // the small ortho correction (reduction) -> last parameter to FALSE.
537 bool bDidLimit(ImpLimitToWorkArea(aPnt));
538 if(bDidLimit && IsOrtho())
539 {
541 OrthoDistance8(maDragStat.GetPrev(), aPnt, false);
543 OrthoDistance4(maDragStat.GetPrev(), aPnt, false);
544 }
545
546 if (aPnt==maDragStat.GetNow()) return;
547 bool bIsMinMoved(maDragStat.IsMinMoved());
548 if (!maDragStat.CheckMinMoved(aPnt))
549 return;
550
551 if (!bIsMinMoved) maDragStat.NextPoint();
552 maDragStat.NextMove(aPnt);
553 mpCurrentCreate->MovCreate(maDragStat);
554
555 // MovCreate changes the object, so use ActionChanged() on it
556 mpCurrentCreate->ActionChanged();
557
558 // replace for DrawCreateObjDiff
561}
562
563void SdrCreateView::SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj)
564{
565 const SdrLayerAdmin& rAd = pPageView->GetPage()->GetLayerAdmin();
566 SdrLayerID nLayer(0);
567
568 // #i72535#
569 if(dynamic_cast<const FmFormObj*>( pObj) != nullptr)
570 {
571 // for FormControls, force to form layer
572 nLayer = rAd.GetLayerID(rAd.GetControlLayerName());
573 }
574 else
575 {
576 nLayer = rAd.GetLayerID(aActiveLayer);
577 }
578
579 if(SDRLAYER_NOTFOUND == nLayer)
580 {
581 nLayer = SdrLayerID(0);
582 }
583
584 pObj->SetLayer(nLayer);
585}
586
588{
589 bool bRet=false;
590 SdrObject* pObjCreated=mpCurrentCreate.get();
591
592 if (mpCurrentCreate!=nullptr)
593 {
594 sal_uInt32 nCount=maDragStat.GetPointCount();
595
596 if (nCount<=1 && eCmd==SdrCreateCmd::ForceEnd)
597 {
598 BrkCreateObj(); // objects with only a single point don't exist (at least today)
599 return false; // sal_False = event not interpreted
600 }
601
602 bool bPntsEq=nCount>1;
603 sal_uInt32 i=1;
605 while (bPntsEq && i<nCount) { bPntsEq=aP0==maDragStat.GetPoint(i); i++; }
606
607 if (mpCurrentCreate->EndCreate(maDragStat,eCmd))
608 {
610
611 if (!bPntsEq)
612 {
613 // otherwise Brk, because all points are equal
615
617
618 // recognize creation of a new 3D object inside a 3D scene
619 bool bSceneIntoScene(false);
620
621 E3dScene* pObjScene = DynCastE3dScene(pObjCreated);
622 E3dScene* pCurrentScene = pObjScene ? DynCastE3dScene(mpCreatePV->GetCurrentGroup()) : nullptr;
623 if (pCurrentScene)
624 {
625 bool bDidInsert = static_cast<E3dView*>(this)->ImpCloneAll3DObjectsToDestScene(
626 pObjScene, pCurrentScene, Point(0, 0));
627
628 if(bDidInsert)
629 {
630 pObjCreated = nullptr;
631 bSceneIntoScene = true;
632 }
633 }
634
635 if(!bSceneIntoScene)
636 {
637 // Here an interactively created SdrObject gets added, so
638 // take into account that interaction created an object in
639 // model coordinates. If we have e.g. a GirdOffset, this is a
640 // little bit tricky - we have an object in model coordinates,
641 // so the fetched offset is at the wrong point in principle
642 // since we need to 'substract' the offset here to get to
643 // 'real' model coordinates. But we have nothing better here,
644 // so go for it.
645 // The 2nd a little tricky thing is that this will early-create
646 // a ViewObjectContact for the new SdrObject, but these VOCs
647 // are anyways layouted for being create-on-demand. This will
648 // be adapted/replaced correctly later on.
649 // This *should* be the right place for getting all interactively
650 // created objects, see InsertObjectAtView below that calls
651 // CreateUndoNewObject.
652 basegfx::B2DVector aGridOffset(0.0, 0.0);
653 if(getPossibleGridOffsetForSdrObject(aGridOffset, pObj.get(), mpCreatePV))
654 {
655 const Size aOffset(
656 basegfx::fround(-aGridOffset.getX()),
657 basegfx::fround(-aGridOffset.getY()));
658
659 pObj->NbcMove(aOffset);
660 }
661
662 // do the same as before
663 InsertObjectAtView(pObj.get(), *mpCreatePV);
664 }
665
666 mpCreatePV = nullptr;
667 bRet=true; // sal_True = event interpreted
668 }
669 else
670 {
671 BrkCreateObj();
672 }
673 }
674 else
675 { // more points
676 if (eCmd==SdrCreateCmd::ForceEnd || // nothing there -- force ending
677 nCount==0 || // no existing points (should never happen)
678 (nCount<=1 && !maDragStat.IsMinMoved())) { // MinMove not met
679 BrkCreateObj();
680 }
681 else
682 {
683 // replace for DrawCreateObjDiff
686 maDragStat.ResetMinMoved(); // NextPoint is at MovCreateObj()
687 bRet=true;
688 }
689 }
690 }
691 return bRet;
692}
693
695{
696 if (mpCurrentCreate==nullptr)
697 return;
698
699 if (maDragStat.GetPointCount()<=2 )
700 {
701 BrkCreateObj();
702 }
703 else
704 {
707 if (mpCurrentCreate->BckCreate(maDragStat))
708 {
710 }
711 else
712 {
713 BrkCreateObj();
714 }
715 }
716}
717
719{
720 if (mpCurrentCreate!=nullptr)
721 {
723 mpCurrentCreate->BrkCreate(maDragStat);
724 mpCurrentCreate = nullptr;
725 mpCreatePV = nullptr;
726 }
727}
728
729void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/)
730{
731 if(!IsCreateObj() || maDragStat.IsShown())
732 return;
733
734 if (mpCurrentCreate)
735 {
736 // for migration from XOR, replace DrawDragObj here to create
737 // overlay objects instead.
738 bool bUseSolidDragging(IsSolidDragging());
739
740 // #i101648# check if dragged object is a naked SdrObject (not
741 // a derivation). This is e.g. used in SW Frame construction
742 // as placeholder. Do not use SolidDragging for naked SdrObjects,
743 // they cannot have a valid optical representation
744 if(bUseSolidDragging && SdrObjKind::NONE == mpCurrentCreate->GetObjIdentifier())
745 {
746 bUseSolidDragging = false;
747 }
748
749 // check for objects with no fill and no line
750 if(bUseSolidDragging)
751 {
752 const SfxItemSet& rSet = mpCurrentCreate->GetMergedItemSet();
753 const drawing::FillStyle eFill(rSet.Get(XATTR_FILLSTYLE).GetValue());
754 const drawing::LineStyle eLine(rSet.Get(XATTR_LINESTYLE).GetValue());
755
756 if(drawing::LineStyle_NONE == eLine && drawing::FillStyle_NONE == eFill)
757 {
758 bUseSolidDragging = false;
759 }
760 }
761
762 // check for form controls
763 if(bUseSolidDragging)
764 {
765 if (dynamic_cast<const SdrUnoObj*>(mpCurrentCreate.get()) != nullptr)
766 {
767 bUseSolidDragging = false;
768 }
769 }
770
771 // #i101781# force to non-solid dragging when not creating a full circle
772 if(bUseSolidDragging)
773 {
774 SdrCircObj* pCircObj = dynamic_cast<SdrCircObj*>(mpCurrentCreate.get());
775
776 if(pCircObj && SdrObjKind::CircleOrEllipse != pCircObj->GetObjIdentifier())
777 {
778 // #i103058# Allow SolidDragging with four points
779 if(maDragStat.GetPointCount() < 4)
780 {
781 bUseSolidDragging = false;
782 }
783 }
784 }
785
786 if(bUseSolidDragging)
787 {
788 basegfx::B2DPolyPolygon aDragPolyPolygon;
789
790 if (dynamic_cast<const SdrRectObj*>(mpCurrentCreate.get()) != nullptr)
791 {
792 // ensure object has some size, necessary for SdrTextObj because
793 // there are still untested divisions by that sizes
794 tools::Rectangle aCurrentSnapRect(mpCurrentCreate->GetSnapRect());
795
796 if(aCurrentSnapRect.GetWidth() <= 1 || aCurrentSnapRect.GetHeight() <= 1)
797 {
799 mpCurrentCreate->NbcSetSnapRect(aNewRect);
800 }
801 }
802
803 if (auto pPathObj = dynamic_cast<SdrPathObj*>(mpCurrentCreate.get()))
804 {
805 // The up-to-now created path needs to be set at the object to have something
806 // that can be visualized
807 const basegfx::B2DPolyPolygon aCurrentPolyPolygon(pPathObj->getObjectPolyPolygon(maDragStat));
808
809 if(aCurrentPolyPolygon.count())
810 {
811 pPathObj->NbcSetPathPoly(aCurrentPolyPolygon);
812 }
813
814 aDragPolyPolygon = pPathObj->getDragPolyPolygon(maDragStat);
815 }
816
817 // use the SdrObject directly for overlay
818 mpCreateViewExtraData->CreateAndShowOverlay(*this, mpCurrentCreate.get(), aDragPolyPolygon);
819 }
820 else
821 {
822 const ::basegfx::B2DPolyPolygon aPoly(mpCurrentCreate->TakeCreatePoly(maDragStat));
823
824 mpCreateViewExtraData->CreateAndShowOverlay(*this, nullptr, aPoly);
825 }
826
827 // #i101679# Force changed overlay to be shown
828 for(sal_uInt32 a(0); a < PaintWindowCount(); a++)
829 {
830 SdrPaintWindow* pCandidate = GetPaintWindow(a);
831 const rtl::Reference<sdr::overlay::OverlayManager>& xOverlayManager = pCandidate->GetOverlayManager();
832
833 if (xOverlayManager.is())
834 {
835 xOverlayManager->flush();
836 }
837 }
838 }
839
840 maDragStat.SetShown(true);
841}
842
844{
846 {
847 // for migration from XOR, replace DrawDragObj here to create
848 // overlay objects instead.
849 mpCreateViewExtraData->HideOverlay();
850
851 //DrawCreateObj(pOut,bFull);
852 maDragStat.SetShown(false);
853 }
854}
855
856
857void SdrCreateView::GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const
858{
859 if (mpCurrentCreate)
860 {
861 rTargetSet.Put(mpCurrentCreate->GetMergedItemSet());
862 }
863 else
864 {
865 SdrDragView::GetAttributes(rTargetSet, bOnlyHardAttr);
866 }
867}
868
869bool SdrCreateView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll)
870{
871 if (mpCurrentCreate)
872 {
873 mpCurrentCreate->SetMergedItemSetAndBroadcast(rSet, bReplaceAll);
874
875 return true;
876 }
877 else
878 {
879 return SdrDragView::SetAttributes(rSet,bReplaceAll);
880 }
881}
882
884{
885 if (mpCurrentCreate != nullptr)
886 {
887 return mpCurrentCreate->GetStyleSheet();
888 }
889 else
890 {
892 }
893}
894
895void SdrCreateView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr)
896{
897 if (mpCurrentCreate != nullptr)
898 {
899 mpCurrentCreate->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
900 }
901 else
902 {
903 SdrDragView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr);
904 }
905}
906
907/* 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
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdocirc.cxx:178
PointerStyle maCurrentCreatePointer
Definition: svdcrtv.hxx:48
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdcrtv.cxx:895
bool BegCreateObj(const Point &rPnt, OutputDevice *pOut=nullptr, short nMinMov=-3)
Definition: svdcrtv.cxx:493
bool IsTextTool() const
Definition: svdcrtv.cxx:315
bool IsMeasureTool() const
Definition: svdcrtv.cxx:329
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdcrtv.cxx:857
bool IsCreateObj() const
Definition: svdcrtv.hxx:119
void ShowCreateObj()
Definition: svdcrtv.cxx:729
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:563
bool BegCreatePreparedObject(const Point &rPnt, sal_Int16 nMinMov, SdrObject *pPreparedFactoryObject)
Definition: svdcrtv.cxx:498
void HideCreateObj()
Definition: svdcrtv.cxx:843
void ImpClearConnectMarker()
Definition: svdcrtv.cxx:176
bool EndCreateObj(SdrCreateCmd eCmd)
Definition: svdcrtv.cxx:587
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:694
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:512
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:883
void BrkCreateObj()
Definition: svdcrtv.cxx:718
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdcrtv.cxx:869
virtual ~SdrCreateView() override
Definition: svdcrtv.cxx:195
void MovCreateObj(const Point &rPnt)
Definition: svdcrtv.cxx:519
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:85
const tools::Rectangle & GetWorkArea() const
Definition: svddrgv.hxx:210
bool IsSolidDragging() const
Definition: svddrgv.cxx:912
virtual void MovAction(const Point &rPnt) override
Definition: svddrgv.cxx:76
virtual void BckAction() override
Definition: svddrgv.cxx:94
virtual bool IsAction() const override
Definition: svddrgv.cxx:71
virtual void BrkAction() override
Definition: svddrgv.cxx:100
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svddrgv.cxx:106
static bool ImpFindConnector(const Point &rPt, const SdrPageView &rPV, SdrObjConnection &rCon, const SdrEdgeObj *pThis, OutputDevice *pOut=nullptr, SdrDragStat *pDragStat=nullptr)
Definition: svdoedge.cxx:2132
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
Definition: svdedtv.cxx:981
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:1931
bool IsMarkedObjHit(const Point &rPnt, short nTol=-2) const
Definition: svdmrkv.cxx:1920
void UnmarkAllObj(SdrPageView const *pPV=nullptr)
Definition: svdmrkv.cxx:2565
SdrViewEditMode meEditMode
Definition: svdmrkv.hxx:119
bool getPossibleGridOffsetForSdrObject(basegfx::B2DVector &rOffset, const SdrObject *pObj, const SdrPageView *pPV) const
Definition: svdmrkv.cxx:2225
bool IsCreateMode() const
Definition: svdmrkv.hxx:234
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:318
Utility class SdrObjConnection.
Definition: svdoedge.hxx:40
SdrObject * pObj
Definition: svdoedge.hxx:46
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdedxv.cxx:2296
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
handle mouse over effects for handles
Definition: svdedxv.cxx:2074
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdedxv.cxx:2258
SfxStyleSheet * GetStyleSheet() const
Definition: svdedxv.cxx:2441
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdedxv.cxx:2462
static rtl::Reference< SdrObject > MakeNewObject(SdrModel &rSdrModel, SdrInventor nInventor, SdrObjKind nObjIdentifier, const tools::Rectangle *pSnapRect=nullptr)
Definition: svdobj.cxx:3238
Abstract DrawObject.
Definition: svdobj.hxx:261
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
Definition: svdobj.cxx:1096
virtual SdrInventor GetObjInventor() const
Definition: svdobj.cxx:621
virtual SdrObjKind GetObjIdentifier() const
Definition: svdobj.cxx:626
virtual void SetLayer(SdrLayerID nLayer)
Definition: svdobj.cxx:667
virtual SdrGluePoint GetVertexGluePoint(sal_uInt16 nNum) const
Definition: svdobj.cxx:2278
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:1734
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
Definition: svdpntv.cxx:75
sal_uInt16 ImpGetMinMovLogic(short nMinMov, const OutputDevice *pOut) const
Definition: svdpntv.cxx:305
SfxItemSet maDefaultAttr
Definition: svdpntv.hxx:142
OUString maMeasureLayer
Definition: svdpntv.hxx:131
SdrModel * GetModel() const
Definition: svdpntv.hxx:261
SdrDragStat maDragStat
Definition: svdpntv.hxx:140
sal_uInt32 PaintWindowCount() const
Definition: svdpntv.hxx:219
SfxStyleSheet * mpDefaultStyleSheet
Definition: svdpntv.hxx:128
OUString maActualLayer
Definition: svdpntv.hxx:130
void ImpSetGlueVisible3(bool bOn)
Definition: svdpntv.hxx:236
SdrPageView * GetSdrPageView() const
Definition: svdpntv.hxx:300
VclPtr< OutputDevice > mpDragWin
Definition: svdpntv.hxx:127
SdrModel * mpModel
Definition: svdpntv.hxx:125
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:3203
SdrInventor
Definition: svdobj.hxx:99
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:538
void OrthoDistance8(const Point &rPt0, Point &rPt, bool bBigOrtho)
Definition: svdtrans.cxx:522
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)