1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: svdcrtv.cxx,v $
10 * $Revision: 1.29.18.1 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_svx.hxx"
34 #include <svx/svdcrtv.hxx>
36 #include <svx/svdundo.hxx>
37 #include <svx/svdocapt.hxx> // Spezialbehandlung: Nach dem Create transparente Fuellung
38 #include <svx/svdoedge.hxx>
39 #include <svx/svdpagv.hxx>
40 #include <svx/svdpage.hxx>
41 #include <svx/svdetc.hxx>
42 #include <svx/scene3d.hxx>
43 #include <svx/view3d.hxx>
44 #include <svx/sdr/contact/objectcontactofobjlistpainter.hxx>
45 #include <svx/sdr/contact/displayinfo.hxx>
46 #include <svx/svdouno.hxx>
47 #define XOR_CREATE_PEN PEN_SOLID
48 #include <svx/svdopath.hxx>
49 #include <svx/sdr/overlay/overlaypolypolygon.hxx>
50 #include <svx/sdr/overlay/overlaymanager.hxx>
51 #include <sdrpaintwindow.hxx>
53 #include <svx/svdocirc.hxx>
54 #include <svx/sdr/contact/viewcontact.hxx>
55 #include <svx/sdr/overlay/overlayprimitive2dsequenceobject.hxx>
56 #include <svx/sdr/overlay/overlaymanager.hxx>
58 ////////////////////////////////////////////////////////////////////////////////////////////////////
60 class ImplConnectMarkerOverlay
63 ::sdr::overlay::OverlayObjectList maObjects
;
65 // The remembered target object
66 const SdrObject
& mrObject
;
69 ImplConnectMarkerOverlay(const SdrCreateView
& rView
, SdrObject
& rObject
);
70 ~ImplConnectMarkerOverlay();
72 const SdrObject
& GetTargetObject() const { return mrObject
; }
75 ImplConnectMarkerOverlay::ImplConnectMarkerOverlay(const SdrCreateView
& rView
, SdrObject
& rObject
)
78 basegfx::B2DPolyPolygon
aB2DPolyPolygon(rObject
.TakeXorPoly());
80 for(sal_uInt32
a(0L); a
< rView
.PaintWindowCount(); a
++)
82 SdrPaintWindow
* pCandidate
= rView
.GetPaintWindow(a
);
83 ::sdr::overlay::OverlayManager
* pTargetOverlay
= pCandidate
->GetOverlayManager();
87 Size
aHalfLogicSize(pTargetOverlay
->getOutputDevice().PixelToLogic(Size(4, 4)));
90 ::sdr::overlay::OverlayPolyPolygonStriped
* pNew
= new ::sdr::overlay::OverlayPolyPolygonStriped(aB2DPolyPolygon
);
91 pTargetOverlay
->add(*pNew
);
92 maObjects
.append(*pNew
);
95 if(rView
.IsAutoVertexConnectors())
97 for(sal_uInt16
i(0); i
< 4; i
++)
99 SdrGluePoint
aGluePoint(rObject
.GetVertexGluePoint(i
));
100 const Point
& rPosition
= aGluePoint
.GetAbsolutePos(rObject
);
102 basegfx::B2DPoint
aTopLeft(rPosition
.X() - aHalfLogicSize
.Width(), rPosition
.Y() - aHalfLogicSize
.Height());
103 basegfx::B2DPoint
aBottomRight(rPosition
.X() + aHalfLogicSize
.Width(), rPosition
.Y() + aHalfLogicSize
.Height());
105 basegfx::B2DPolygon aTempPoly
;
106 aTempPoly
.append(aTopLeft
);
107 aTempPoly
.append(basegfx::B2DPoint(aBottomRight
.getX(), aTopLeft
.getY()));
108 aTempPoly
.append(aBottomRight
);
109 aTempPoly
.append(basegfx::B2DPoint(aTopLeft
.getX(), aBottomRight
.getY()));
110 aTempPoly
.setClosed(true);
112 basegfx::B2DPolyPolygon aTempPolyPoly
;
113 aTempPolyPoly
.append(aTempPoly
);
115 pNew
= new ::sdr::overlay::OverlayPolyPolygonStriped(aTempPolyPoly
);
116 pTargetOverlay
->add(*pNew
);
117 maObjects
.append(*pNew
);
124 ImplConnectMarkerOverlay::~ImplConnectMarkerOverlay()
126 // The OverlayObjects are cleared using the destructor of OverlayObjectList.
127 // That destructor calls clear() at the list which removes all objects from the
128 // OverlayManager and deletes them.
131 ////////////////////////////////////////////////////////////////////////////////////////////////////
133 class ImpSdrCreateViewExtraData
135 // The OverlayObjects for XOR replacement
136 ::sdr::overlay::OverlayObjectList maObjects
;
139 ImpSdrCreateViewExtraData();
140 ~ImpSdrCreateViewExtraData();
142 void CreateAndShowOverlay(const SdrCreateView
& rView
, const SdrObject
* pObject
, const basegfx::B2DPolyPolygon
& rPolyPoly
);
146 ImpSdrCreateViewExtraData::ImpSdrCreateViewExtraData()
150 ImpSdrCreateViewExtraData::~ImpSdrCreateViewExtraData()
155 void ImpSdrCreateViewExtraData::CreateAndShowOverlay(const SdrCreateView
& rView
, const SdrObject
* pObject
, const basegfx::B2DPolyPolygon
& rPolyPoly
)
157 for(sal_uInt32
a(0L); a
< rView
.PaintWindowCount(); a
++)
159 SdrPaintWindow
* pCandidate
= rView
.GetPaintWindow(a
);
160 ::sdr::overlay::OverlayManager
* pOverlayManager
= pCandidate
->GetOverlayManager();
166 const sdr::contact::ViewContact
& rVC
= pObject
->GetViewContact();
167 const drawinglayer::primitive2d::Primitive2DSequence aSequence
= rVC
.getViewIndependentPrimitive2DSequence();
168 sdr::overlay::OverlayObject
* pNew
= new sdr::overlay::OverlayPrimitive2DSequenceObject(aSequence
);
170 pOverlayManager
->add(*pNew
);
171 maObjects
.append(*pNew
);
174 if(rPolyPoly
.count())
176 ::sdr::overlay::OverlayPolyPolygonStriped
* pNew
= new ::sdr::overlay::OverlayPolyPolygonStriped(rPolyPoly
);
177 pOverlayManager
->add(*pNew
);
178 maObjects
.append(*pNew
);
184 void ImpSdrCreateViewExtraData::HideOverlay()
186 // the clear() call at the list removes all objects from the
187 // OverlayManager and deletes them.
191 ////////////////////////////////////////////////////////////////////////////////////////////////////
192 ////////////////////////////////////////////////////////////////////////////////////////////////////
194 // @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
195 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
196 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
197 // @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@
198 // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
199 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
200 // @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
202 ////////////////////////////////////////////////////////////////////////////////////////////////////
203 ////////////////////////////////////////////////////////////////////////////////////////////////////
205 void SdrCreateView::ImpClearConnectMarker()
209 delete mpCoMaOverlay
;
214 void SdrCreateView::ImpClearVars()
216 nAktInvent
=SdrInventor
;
221 b1stPointAsCenter
=FALSE
;
222 aAktCreatePointer
=Pointer(POINTER_CROSS
);
223 bUseIncompatiblePathCreateInterface
=FALSE
;
224 bAutoClosePolys
=TRUE
;
226 nFreeHandMinDistPix
=10;
228 ImpClearConnectMarker();
231 void SdrCreateView::ImpMakeCreateAttr()
235 SdrCreateView::SdrCreateView(SdrModel
* pModel1
, OutputDevice
* pOut
)
236 : SdrDragView(pModel1
,pOut
),
238 mpCreateViewExtraData(new ImpSdrCreateViewExtraData())
244 SdrCreateView::~SdrCreateView()
246 ImpClearConnectMarker();
247 delete mpCreateViewExtraData
;
248 SdrObject::Free( pAktCreate
);
251 void SdrCreateView::ImpDelCreateAttr()
255 BOOL
SdrCreateView::IsAction() const
257 return SdrDragView::IsAction() || pAktCreate
!=NULL
;
260 void SdrCreateView::MovAction(const Point
& rPnt
)
262 SdrDragView::MovAction(rPnt
);
263 if (pAktCreate
!=NULL
) {
268 void SdrCreateView::EndAction()
270 if (pAktCreate
!=NULL
) EndCreateObj(SDRCREATE_FORCEEND
);
271 SdrDragView::EndAction();
274 void SdrCreateView::BckAction()
276 if (pAktCreate
!=NULL
) BckCreateObj();
277 SdrDragView::BckAction();
280 void SdrCreateView::BrkAction()
282 SdrDragView::BrkAction();
286 void SdrCreateView::TakeActionRect(Rectangle
& rRect
) const
288 if (pAktCreate
!=NULL
)
290 rRect
=aDragStat
.GetActionRect();
293 rRect
=Rectangle(aDragStat
.GetPrev(),aDragStat
.GetNow());
298 SdrDragView::TakeActionRect(rRect
);
302 BOOL
SdrCreateView::CheckEdgeMode()
304 UINT32 nInv
=nAktInvent
;
305 UINT16 nIdn
=nAktIdent
;
306 if (pAktCreate
!=NULL
)
308 nInv
=pAktCreate
->GetObjInventor();
309 nIdn
=pAktCreate
->GetObjIdentifier();
310 // wird vom EdgeObj gemanaged
311 if (nAktInvent
==SdrInventor
&& nAktIdent
==OBJ_EDGE
) return FALSE
;
314 if (!IsCreateMode() || nAktInvent
!=SdrInventor
|| nAktIdent
!=OBJ_EDGE
)
316 ImpClearConnectMarker();
321 // TRUE heisst: MouseMove soll Connect checken
326 void SdrCreateView::SetConnectMarker(const SdrObjConnection
& rCon
, const SdrPageView
& /*rPV*/)
328 SdrObject
* pTargetObject
= rCon
.pObj
;
332 // if target object changes, throw away overlay object to make room for changes
333 if(mpCoMaOverlay
&& pTargetObject
!= &mpCoMaOverlay
->GetTargetObject())
335 ImpClearConnectMarker();
340 mpCoMaOverlay
= new ImplConnectMarkerOverlay(*this, *pTargetObject
);
345 ImpClearConnectMarker();
349 void SdrCreateView::HideConnectMarker()
351 ImpClearConnectMarker();
354 BOOL
SdrCreateView::MouseMove(const MouseEvent
& rMEvt
, Window
* pWin
)
356 if(CheckEdgeMode() && pWin
)
358 SdrPageView
* pPV
= GetSdrPageView();
362 // Defaultete Hit-Toleranz bei IsMarkedHit() mal aendern !!!!
363 Point
aPos(pWin
->PixelToLogic(rMEvt
.GetPosPixel()));
364 BOOL bMarkHit
=PickHandle(aPos
)!=NULL
|| IsMarkedObjHit(aPos
);
365 SdrObjConnection aCon
;
366 if (!bMarkHit
) SdrEdgeObj::ImpFindConnector(aPos
,*pPV
,aCon
,NULL
,pWin
);
367 SetConnectMarker(aCon
,*pPV
);
370 return SdrDragView::MouseMove(rMEvt
,pWin
);
373 BOOL
SdrCreateView::IsTextTool() const
375 return eEditMode
==SDREDITMODE_CREATE
&& nAktInvent
==SdrInventor
&& (nAktIdent
==OBJ_TEXT
|| nAktIdent
==OBJ_TEXTEXT
|| nAktIdent
==OBJ_TITLETEXT
|| nAktIdent
==OBJ_OUTLINETEXT
);
378 BOOL
SdrCreateView::IsEdgeTool() const
380 return eEditMode
==SDREDITMODE_CREATE
&& nAktInvent
==SdrInventor
&& (nAktIdent
==OBJ_EDGE
);
383 BOOL
SdrCreateView::IsMeasureTool() const
385 return eEditMode
==SDREDITMODE_CREATE
&& nAktInvent
==SdrInventor
&& (nAktIdent
==OBJ_MEASURE
);
388 void SdrCreateView::SetCurrentObj(UINT16 nIdent
, UINT32 nInvent
)
390 if (nAktInvent
!=nInvent
|| nAktIdent
!=nIdent
)
394 SdrObject
* pObj
= SdrObjFactory::MakeNewObject(nInvent
,nIdent
,NULL
,NULL
);
398 // Auf pers. Wunsch von Marco:
399 // Mauszeiger bei Textwerkzeug immer I-Beam. Fadenkreuz
400 // mit kleinem I-Beam erst bai MouseButtonDown
403 // #81944# AW: Here the correct pointer needs to be used
404 // if the default is set to vertical writing
405 aAktCreatePointer
= POINTER_TEXT
;
408 aAktCreatePointer
= pObj
->GetCreatePointer();
410 SdrObject::Free( pObj
);
414 aAktCreatePointer
= Pointer(POINTER_CROSS
);
419 ImpSetGlueVisible3(IsEdgeTool());
422 BOOL
SdrCreateView::ImpBegCreateObj(UINT32 nInvent
, UINT16 nIdent
, const Point
& rPnt
, OutputDevice
* pOut
,
423 short nMinMov
, SdrPageView
* pPV
, const Rectangle
& rLogRect
, SdrObject
* pPreparedFactoryObject
)
429 ImpClearConnectMarker();
437 pCreatePV
= GetSdrPageView();
440 { // ansonsten keine Seite angemeldet!
441 String
aLay(aAktLayer
);
443 if(nInvent
== SdrInventor
&& nIdent
== OBJ_MEASURE
&& aMeasureLayer
.Len())
445 aLay
= aMeasureLayer
;
448 SdrLayerID nLayer
=pCreatePV
->GetPage()->GetLayerAdmin().GetLayerID(aLay
,TRUE
);
449 if (nLayer
==SDRLAYER_NOTFOUND
) nLayer
=0;
450 if (!pCreatePV
->GetLockedLayers().IsSet(nLayer
) && pCreatePV
->GetVisibleLayers().IsSet(nLayer
))
452 if(pPreparedFactoryObject
)
454 pAktCreate
= pPreparedFactoryObject
;
456 if(pCreatePV
->GetPage())
458 pAktCreate
->SetPage(pCreatePV
->GetPage());
462 pAktCreate
->SetModel(pMod
);
467 pAktCreate
= SdrObjFactory::MakeNewObject(nInvent
, nIdent
, pCreatePV
->GetPage(), pMod
);
471 if (nAktInvent
!=SdrInventor
|| (nAktIdent
!=USHORT(OBJ_EDGE
) &&
472 nAktIdent
!=USHORT(OBJ_FREELINE
) &&
473 nAktIdent
!=USHORT(OBJ_FREEFILL
) )) { // Kein Fang fuer Edge und Freihand!
474 aPnt
=GetSnapPos(aPnt
,pCreatePV
);
476 if (pAktCreate
!=NULL
)
478 BOOL bStartEdit
=FALSE
; // nach Ende von Create automatisch TextEdit starten
479 if (pDefaultStyleSheet
!=NULL
) pAktCreate
->NbcSetStyleSheet(pDefaultStyleSheet
, sal_False
);
481 // #101618# SW uses a naked SdrObject for frame construction. Normally, such an
482 // object should not be created. Since it is possible to use it as a helper
483 // object (e.g. in letting the user define an area with the interactive
484 // construction) at least no items should be set at that object.
485 if(nInvent
!= SdrInventor
|| nIdent
!= OBJ_NONE
)
487 pAktCreate
->SetMergedItemSet(aDefaultAttr
);
490 if (HAS_BASE(SdrCaptionObj
,pAktCreate
))
492 SfxItemSet
aSet(pMod
->GetItemPool());
493 aSet
.Put(XFillColorItem(String(),Color(COL_WHITE
))); // Falls einer auf Solid umschaltet
494 aSet
.Put(XFillStyleItem(XFILL_NONE
));
496 pAktCreate
->SetMergedItemSet(aSet
);
500 if (nInvent
==SdrInventor
&& (nIdent
==OBJ_TEXT
|| nIdent
==OBJ_TEXTEXT
||
501 nIdent
==OBJ_TITLETEXT
|| nIdent
==OBJ_OUTLINETEXT
))
503 // Fuer alle Textrahmen default keinen Hintergrund und keine Umrandung
504 SfxItemSet
aSet(pMod
->GetItemPool());
505 aSet
.Put(XFillColorItem(String(),Color(COL_WHITE
))); // Falls einer auf Solid umschaltet
506 aSet
.Put(XFillStyleItem(XFILL_NONE
));
507 aSet
.Put(XLineColorItem(String(),Color(COL_BLACK
))); // Falls einer auf Solid umschaltet
508 aSet
.Put(XLineStyleItem(XLINE_NONE
));
510 pAktCreate
->SetMergedItemSet(aSet
);
514 if (!rLogRect
.IsEmpty()) pAktCreate
->NbcSetLogicRect(rLogRect
);
516 // #90129# make sure drag start point is inside WorkArea
517 const Rectangle
& rWorkArea
= ((SdrDragView
*)this)->GetWorkArea();
519 if(!rWorkArea
.IsEmpty())
521 if(aPnt
.X() < rWorkArea
.Left())
523 aPnt
.X() = rWorkArea
.Left();
526 if(aPnt
.X() > rWorkArea
.Right())
528 aPnt
.X() = rWorkArea
.Right();
531 if(aPnt
.Y() < rWorkArea
.Top())
533 aPnt
.Y() = rWorkArea
.Top();
536 if(aPnt
.Y() > rWorkArea
.Bottom())
538 aPnt
.Y() = rWorkArea
.Bottom();
542 aDragStat
.Reset(aPnt
);
543 aDragStat
.SetView((SdrView
*)this);
544 aDragStat
.SetPageView(pCreatePV
);
545 aDragStat
.SetMinMove(ImpGetMinMovLogic(nMinMov
,pOut
));
547 if (pAktCreate
->BegCreate(aDragStat
))
549 ShowCreateObj(/*pOut,TRUE*/);
554 SdrObject::Free( pAktCreate
);
564 BOOL
SdrCreateView::BegCreateObj(const Point
& rPnt
, OutputDevice
* pOut
, short nMinMov
, SdrPageView
* pPV
)
566 return ImpBegCreateObj(nAktInvent
,nAktIdent
,rPnt
,pOut
,nMinMov
,pPV
,Rectangle(), 0L);
569 sal_Bool
SdrCreateView::BegCreatePreparedObject(const Point
& rPnt
, sal_Int16 nMinMov
, SdrObject
* pPreparedFactoryObject
)
571 sal_uInt32
nInvent(nAktInvent
);
572 sal_uInt16
nIdent(nAktIdent
);
574 if(pPreparedFactoryObject
)
576 nInvent
= pPreparedFactoryObject
->GetObjInventor();
577 nIdent
= pPreparedFactoryObject
->GetObjIdentifier();
580 return ImpBegCreateObj(nInvent
, nIdent
, rPnt
, 0L, nMinMov
, 0L, Rectangle(), pPreparedFactoryObject
);
583 BOOL
SdrCreateView::BegCreateCaptionObj(const Point
& rPnt
, const Size
& rObjSiz
,
584 OutputDevice
* pOut
, short nMinMov
, SdrPageView
* pPV
)
586 return ImpBegCreateObj(SdrInventor
,OBJ_CAPTION
,rPnt
,pOut
,nMinMov
,pPV
,
587 Rectangle(rPnt
,Size(rObjSiz
.Width()+1,rObjSiz
.Height()+1)), 0L);
590 void SdrCreateView::MovCreateObj(const Point
& rPnt
)
592 if (pAktCreate
!=NULL
) {
594 if (!aDragStat
.IsNoSnap())
596 aPnt
=GetSnapPos(aPnt
,pCreatePV
);
600 if (aDragStat
.IsOrtho8Possible()) OrthoDistance8(aDragStat
.GetPrev(),aPnt
,IsBigOrtho());
601 else if (aDragStat
.IsOrtho4Possible()) OrthoDistance4(aDragStat
.GetPrev(),aPnt
,IsBigOrtho());
604 // #77734# If the drag point was limited and Ortho is active, do
605 // the small ortho correction (reduction) -> last parameter to FALSE.
606 sal_Bool
bDidLimit(ImpLimitToWorkArea(aPnt
));
607 if(bDidLimit
&& IsOrtho())
609 if(aDragStat
.IsOrtho8Possible())
610 OrthoDistance8(aDragStat
.GetPrev(), aPnt
, FALSE
);
611 else if(aDragStat
.IsOrtho4Possible())
612 OrthoDistance4(aDragStat
.GetPrev(), aPnt
, FALSE
);
615 if (aPnt
==aDragStat
.GetNow()) return;
616 bool bMerk(aDragStat
.IsMinMoved());
617 if (aDragStat
.CheckMinMoved(aPnt
))
620 if (!bMerk
) aDragStat
.NextPoint();
621 aDragStat
.NextMove(aPnt
);
622 pAktCreate
->MovCreate(aDragStat
);
624 // MovCreate changes the object, so use ActionChanged() on it
625 pAktCreate
->ActionChanged();
627 // replace for DrawCreateObjDiff
634 BOOL
SdrCreateView::EndCreateObj(SdrCreateCmd eCmd
)
637 SdrObject
* pObjMerk
=pAktCreate
;
638 SdrPageView
* pPVMerk
=pCreatePV
;
640 if (pAktCreate
!=NULL
)
642 ULONG nAnz
=aDragStat
.GetPointAnz();
644 if (nAnz
<=1 && eCmd
==SDRCREATE_FORCEEND
)
646 BrkCreateObj(); // Objekte mit nur einem Punkt gibt's nicht (zumindest noch nicht)
647 return FALSE
; // FALSE=Event nicht ausgewertet
652 Point aP0
=aDragStat
.GetPoint(0);
653 while (bPntsEq
&& i
<nAnz
) { bPntsEq
=aP0
==aDragStat
.GetPoint(i
); i
++; }
655 if (pAktCreate
->EndCreate(aDragStat
,eCmd
))
661 // sonst Brk, weil alle Punkte gleich sind.
662 SdrObject
* pObj
=pAktCreate
;
665 const SdrLayerAdmin
& rAd
= pCreatePV
->GetPage()->GetLayerAdmin();
666 SdrLayerID
nLayer(0);
669 if(pObj
->ISA(FmFormObj
))
671 // for FormControls, force to form layer
672 nLayer
= rAd
.GetLayerID(rAd
.GetControlLayerName(), true);
676 nLayer
= rAd
.GetLayerID(aAktLayer
, TRUE
);
679 if(SDRLAYER_NOTFOUND
== nLayer
)
684 pObj
->SetLayer(nLayer
);
686 // #83403# recognize creation of a new 3D object inside a 3D scene
687 BOOL
bSceneIntoScene(FALSE
);
690 && pObjMerk
->ISA(E3dScene
)
692 && pCreatePV
->GetAktGroup()
693 && pCreatePV
->GetAktGroup()->ISA(E3dScene
))
695 BOOL bDidInsert
= ((E3dView
*)this)->ImpCloneAll3DObjectsToDestScene(
696 (E3dScene
*)pObjMerk
, (E3dScene
*)pCreatePV
->GetAktGroup(), Point(0, 0));
700 // delete object, it's content is cloned and inserted
701 SdrObject::Free( pObjMerk
);
704 bSceneIntoScene
= TRUE
;
710 // do the same as before
711 InsertObjectAtView(pObj
, *pCreatePV
);
715 bRet
=TRUE
; // TRUE=Event ausgewertet
724 if (eCmd
==SDRCREATE_FORCEEND
|| // nix da, Ende erzwungen
725 nAnz
==0 || // keine Punkte da (kann eigentlich nicht vorkommen)
726 (nAnz
<=1 && !aDragStat
.IsMinMoved())) { // MinMove nicht erfuellt
731 // replace for DrawCreateObjDiff
734 aDragStat
.ResetMinMoved(); // NextPoint gibt's bei MovCreateObj()
738 if (bRet
&& pObjMerk
!=NULL
&& IsTextEditAfterCreate())
740 SdrTextObj
* pText
=PTR_CAST(SdrTextObj
,pObjMerk
);
741 if (pText
!=NULL
&& pText
->IsTextFrame())
743 SdrBeginTextEdit(pText
, pPVMerk
, (Window
*)0L, sal_True
, (SdrOutliner
*)0L, (OutlinerView
*)0L);
750 void SdrCreateView::BckCreateObj()
752 if (pAktCreate
!=NULL
)
754 if (aDragStat
.GetPointAnz()<=2 )
761 aDragStat
.PrevPoint();
762 if (pAktCreate
->BckCreate(aDragStat
))
774 void SdrCreateView::BrkCreateObj()
776 if (pAktCreate
!=NULL
)
779 pAktCreate
->BrkCreate(aDragStat
);
780 SdrObject::Free( pAktCreate
);
786 void SdrCreateView::ShowCreateObj(/*OutputDevice* pOut, BOOL bFull*/)
788 if(IsCreateObj() && !aDragStat
.IsShown())
792 // for migration from XOR, replace DrawDragObj here to create
793 // overlay objects instead.
794 sal_Bool
bUseSolidDragging(IsSolidDragging());
796 // #i101648# check if dragged object is a naked SdrObject (no
797 // derivation of). This is e.g. used in SW Frame construction
798 // as placeholder. Do not use SolidDragging for naked SDrObjects,
799 // they cannot have a valid optical representation
800 if(bUseSolidDragging
&& OBJ_NONE
== pAktCreate
->GetObjIdentifier())
802 bUseSolidDragging
= false;
805 // check for objects with no fill and no line
806 if(bUseSolidDragging
)
808 const SfxItemSet
& rSet
= pAktCreate
->GetMergedItemSet();
809 const XFillStyle
eFill(((XFillStyleItem
&)(rSet
.Get(XATTR_FILLSTYLE
))).GetValue());
810 const XLineStyle
eLine(((XLineStyleItem
&)(rSet
.Get(XATTR_LINESTYLE
))).GetValue());
812 if(XLINE_NONE
== eLine
&& XFILL_NONE
== eFill
)
814 bUseSolidDragging
= sal_False
;
818 // check for form controls
819 if(bUseSolidDragging
)
821 if(pAktCreate
->ISA(SdrUnoObj
))
823 bUseSolidDragging
= sal_False
;
827 // #i101781# force to non-solid dragging when not creating a full circle
828 if(bUseSolidDragging
)
830 SdrCircObj
* pCircObj
= dynamic_cast< SdrCircObj
* >(pAktCreate
);
832 if(pCircObj
&& OBJ_CIRC
!= pCircObj
->GetObjIdentifier())
834 // #i103058# Allow SolidDragging with four points
835 if(aDragStat
.GetPointAnz() < 4)
837 bUseSolidDragging
= false;
842 if(bUseSolidDragging
)
844 basegfx::B2DPolyPolygon aDragPolyPolygon
;
846 if(pAktCreate
->ISA(SdrRectObj
))
848 // ensure object has some size, necessary for SdrTextObj because
849 // there are still untested divisions by that sizes
850 Rectangle
aCurrentSnapRect(pAktCreate
->GetSnapRect());
852 if(!(aCurrentSnapRect
.GetWidth() > 1 && aCurrentSnapRect
.GetHeight() > 1))
854 Rectangle
aNewRect(aDragStat
.GetStart(), aDragStat
.GetStart() + Point(2, 2));
855 pAktCreate
->NbcSetSnapRect(aNewRect
);
859 if(pAktCreate
->ISA(SdrPathObj
))
861 // The up-to-now created path needs to be set at the object to have something
862 // that can be visualized
863 SdrPathObj
& rPathObj((SdrPathObj
&)(*pAktCreate
));
864 const basegfx::B2DPolyPolygon
aCurrentPolyPolygon(rPathObj
.getObjectPolyPolygon(aDragStat
));
866 if(aCurrentPolyPolygon
.count())
868 rPathObj
.NbcSetPathPoly(aCurrentPolyPolygon
);
871 aDragPolyPolygon
= rPathObj
.getDragPolyPolygon(aDragStat
);
874 // use directly the SdrObject for overlay
875 mpCreateViewExtraData
->CreateAndShowOverlay(*this, pAktCreate
, aDragPolyPolygon
);
879 mpCreateViewExtraData
->CreateAndShowOverlay(*this, 0, pAktCreate
->TakeCreatePoly(aDragStat
));
882 // #i101679# Force changed overlay to be shown
883 for(sal_uInt32
a(0); a
< PaintWindowCount(); a
++)
885 SdrPaintWindow
* pCandidate
= GetPaintWindow(a
);
886 sdr::overlay::OverlayManager
* pOverlayManager
= pCandidate
->GetOverlayManager();
890 pOverlayManager
->flush();
895 aDragStat
.SetShown(TRUE
);
899 void SdrCreateView::HideCreateObj()
901 if(IsCreateObj() && aDragStat
.IsShown())
903 // for migration from XOR, replace DrawDragObj here to create
904 // overlay objects instead.
905 mpCreateViewExtraData
->HideOverlay();
907 //DrawCreateObj(pOut,bFull);
908 aDragStat
.SetShown(FALSE
);
912 ////////////////////////////////////////////////////////////////////////////////////////////////////
914 /* new interface src537 */
915 BOOL
SdrCreateView::GetAttributes(SfxItemSet
& rTargetSet
, BOOL bOnlyHardAttr
) const
919 rTargetSet
.Put(pAktCreate
->GetMergedItemSet());
924 return SdrDragView::GetAttributes(rTargetSet
, bOnlyHardAttr
);
928 BOOL
SdrCreateView::SetAttributes(const SfxItemSet
& rSet
, BOOL bReplaceAll
)
932 pAktCreate
->SetMergedItemSetAndBroadcast(rSet
, bReplaceAll
);
938 return SdrDragView::SetAttributes(rSet
,bReplaceAll
);
942 SfxStyleSheet
* SdrCreateView::GetStyleSheet() const // SfxStyleSheet* SdrCreateView::GetStyleSheet(BOOL& rOk) const
944 if (pAktCreate
!=NULL
)
947 return pAktCreate
->GetStyleSheet();
951 return SdrDragView::GetStyleSheet(); // SdrDragView::GetStyleSheet(rOk);
955 BOOL
SdrCreateView::SetStyleSheet(SfxStyleSheet
* pStyleSheet
, BOOL bDontRemoveHardAttr
)
957 if (pAktCreate
!=NULL
)
959 pAktCreate
->SetStyleSheet(pStyleSheet
,bDontRemoveHardAttr
);
964 return SdrDragView::SetStyleSheet(pStyleSheet
,bDontRemoveHardAttr
);