28#include <svx/strings.hrc>
91 mnCount(rView.GetMarkedObjectCount()),
147 if(xTargetOverlay.is())
153 -aMirrorAxisA.
X(), -aMirrorAxisA.
Y()));
155 aMatrixTransform.
scale(1.0, -1.0);
157 aMatrixTransform.
translate(aMirrorAxisA.
X(), aMirrorAxisA.
Y());
179 xTargetOverlay->add(*pNew);
185 for(
size_t b = 0; b <
mnCount; ++b)
189 aPolyPolygon.
transform(aMatrixTransform);
192 std::move(aPolyPolygon)));
193 xTargetOverlay->add(*pNew);
215 bool bSpecialHandling =
false;
219 for(
size_t nObjs = 0; nObjs < nCnt; ++nObjs)
229 bSpecialHandling =
true;
237 if(
nullptr != pScene)
248 for(
size_t nObjs = 0; nObjs < nCnt; ++nObjs)
256 if(
nullptr != pScene)
263 for(
size_t nObjs = 0; nObjs < nCnt; ++nObjs)
269 p3DObj->SetSelected(
true);
274 if(
nullptr != pScene)
285 for(
size_t nObjs = 0; nObjs < nCnt; ++nObjs)
293 if(
nullptr != pScene)
313 bool bSpecialHandling(
false);
317 for(
size_t nObjs = 0; nObjs <
nCount; ++nObjs)
321 if(!bSpecialHandling)
330 bSpecialHandling =
true;
339 if(
nullptr != pScene)
346 if(!bSpecialHandling)
352 std::unique_ptr<SdrModel> pNewModel;
357 for(
size_t nObjs = 0; nObjs <
nCount; ++nObjs)
364 p3DObj->SetSelected(
true);
365 aSelectedSnapRect.
Union(p3DObj->GetSnapRect());
374 rCurrentMarkList = aNewML;
376 for(
size_t nObjs = 0; nObjs <
nCount; ++nObjs)
397 for(sal_uInt16 nPg(0); nPg < pNewModel->GetPageCount(); nPg++)
399 const SdrPage* pSrcPg=pNewModel->GetPage(nPg);
402 for(
size_t nOb = 0; nOb < nObjCount; ++nOb)
408 pScene =
const_cast<E3dScene*
>(p3dscene);
422 rCurrentMarkList = aOldML;
433 bool bRetval =
false;
446 if(
nullptr != pDstScene)
451 for(sal_uInt16 nPg(0); nPg < rMod.
GetPageCount(); nPg++)
461 for(
size_t nOb = 0; nOb < nObjCount; ++nOb)
487 if(pSrcScene && pDstScene)
489 for(
size_t i = 0;
i < pSrcScene->
GetSubList()->GetObjCount(); ++
i)
502 aSceneRange.
transform(aSceneToWorldTrans);
511 aObjectRange.
transform(aObjectToWorldTrans);
520 const double fSizeFactor(0.5);
522 if(aObjectScale.
getX() * fScale > aSceneScale.
getX() * fSizeFactor)
524 const double fObjSize(aObjectScale.
getX() * fScale);
529 if(aObjectScale.
getY() * fScale > aSceneScale.
getY() * fSizeFactor)
531 const double fObjSize(aObjectScale.
getY() * fScale);
536 if(aObjectScale.
getZ() * fScale > aSceneScale.
getZ() * fSizeFactor)
538 const double fObjSize(aObjectScale.
getZ() * fScale);
555 aModifyingTransform.
scale(fScale, fScale, fScale);
563 aModifyingTransform = aWorldToObject * aModifyingTransform;
566 pNewCompoundObj->SetTransform(aModifyingTransform * aNewObjectTrans);
569 pNewCompoundObj->NbcSetLayer(pCompoundObj->
GetLayer());
570 pNewCompoundObj->NbcSetStyleSheet(pCompoundObj->
GetStyleSheet(),
true);
576 AddUndo(
GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj));
588 bool bGroupSelected(
false);
609 bool& rGroupSelected)
const
628 rGroupSelected =
true;
660 auto pPathObj =
dynamic_cast<const SdrPathObj*
>( pObj);
669 if(pPathObj->IsClosed()
670 && eLineStyle == drawing::LineStyle_SOLID
672 && eFillStyle != drawing::FillStyle_NONE)
696 aDefault.SetDefaultExtrudeCharacterMode(
true);
700 aDefault.SetDefaultLatheCharacterMode(
true);
712 if(!pPath->
IsClosed() || eFillStyle == drawing::FillStyle_NONE)
716 aDefault.SetDefaultExtrudeCloseFront(
false);
717 aDefault.SetDefaultExtrudeCloseBack(
false);
749 p3DObj->NbcSetLayer(pObj->
GetLayer());
751 p3DObj->SetMergedItemSet(aSet);
784 if(pNewObj1->IsGroupObject())
802 if(pNewObj2->IsGroupObject())
856 fRot3D = atan2(aDiff.
getY(), aDiff.
getX()) - M_PI_2;
868 if (rPnt2.
getX() != 0.0)
875 aLatheMat.
translate(
static_cast<double>(-aRect.
Left()), 0.0);
894 aRot *= aInvLatheMat;
901 aRot *= aInvLatheMat;
908 aRot *= aInvLatheMat;
915 aRot *= aInvLatheMat;
931 if(pScene->GetSubList() && pScene->GetSubList()->GetObjCount() != 0)
942 pScene->SetTransform(aMatrix * pScene->GetTransform());
945 pScene->NbcSetSnapRect(aRect);
959 if(!bExtrude && fRot3D != 0.0)
962 aRotate.
rotate(0.0, 0.0, fRot3D);
963 pScene->SetTransform(aRotate * pScene->GetTransform());
973 pScene->SetTransform(aRotate * pScene->GetTransform());
986struct E3dDepthNeighbour
988 E3dExtrudeObj* mpObj;
993 maPreparedPolyPolygon(
std::move(aPreparedPolyPolygon))
1000 E3dDepthLayer* mpDown;
1001 std::vector<E3dDepthNeighbour> mvNeighbours;
1018 E3dDepthLayer* pBaseLayer =
nullptr;
1019 E3dDepthLayer* pLayer =
nullptr;
1020 sal_Int32 nNumLayers = 0;
1024 E3dExtrudeObj* pExtrudeObj =
dynamic_cast< E3dExtrudeObj*
>(aIter.
Next());
1030 const SfxItemSet& rLocalSet = pExtrudeObj->GetMergedItemSet();
1031 const drawing::FillStyle eLocalFillStyle = rLocalSet.
Get(
XATTR_FILLSTYLE).GetValue();
1038 bool bOverlap(
false);
1040 for(
const auto& rAct : pLayer->mvNeighbours)
1047 rAct.maPreparedPolyPolygon));
1049 if(aAndPolyPolygon.
count() != 0)
1052 const SfxItemSet& rCompareSet = rAct.mpObj->GetMergedItemSet();
1056 if(eLocalFillStyle == eCompareFillStyle)
1058 if(eLocalFillStyle == drawing::FillStyle_SOLID)
1062 if(aCompareColor == aLocalColor)
1067 else if(eLocalFillStyle == drawing::FillStyle_NONE)
1081 pLayer->mpDown =
new E3dDepthLayer;
1082 pLayer = pLayer->mpDown;
1084 pLayer->mvNeighbours.emplace_back(pExtrudeObj, aExtrudePoly);
1089 pLayer->mvNeighbours.emplace(pLayer->mvNeighbours.begin(), pExtrudeObj, aExtrudePoly);
1095 pBaseLayer =
new E3dDepthLayer;
1096 pLayer = pBaseLayer;
1098 pLayer->mvNeighbours.emplace_back(pExtrudeObj, aExtrudePoly);
1107 double fMinDepth = fDepth * 0.8;
1108 double fStep = (fDepth - fMinDepth) /
static_cast<double>(nNumLayers);
1109 pLayer = pBaseLayer;
1114 for(
auto& rAct : pLayer->mvNeighbours)
1121 pLayer = pLayer->mpDown;
1129 pLayer = pBaseLayer->mpDown;
1131 pBaseLayer = pLayer;
1138 SdrHdl* pHdl,
short nMinMov,
1148 bool bOwnActionNecessary;
1149 if (pHdl ==
nullptr)
1151 bOwnActionNecessary =
true;
1155 bOwnActionNecessary =
true;
1159 bOwnActionNecessary =
false;
1165 bool bThereAreRootScenes =
false;
1166 bool bThereAre3DObjects =
false;
1168 for(
size_t nObjs = 0; nObjs < nCnt; ++nObjs)
1174 if( pScene->getRootE3dSceneFromE3dObject() == pObj )
1175 bThereAreRootScenes =
true;
1179 bThereAre3DObjects =
true;
1183 if( bThereAre3DObjects )
1226 if(!bThereAreRootScenes)
1252 DBG_ASSERT(p3DObj !=
nullptr,
"Who puts in a NULL-pointer here");
1266 pScene->InsertObject(p3DObj);
1267 pScene->NbcSetSnapRect(aRect);
1281 basegfx::B3DPoint aCamPos(0.0, 0.0, fCamZ < fDefaultCamPosZ ? fDefaultCamPosZ : fCamZ);
1302 if (
pOut !=
nullptr)
1304 nMinLen =
pOut->PixelToLogic(
Size(0,50)).Height();
1305 nObjDst =
pOut->PixelToLogic(
Size(0,20)).Height();
1309 nOutMin = -
pOut->GetMapMode().GetOrigin().Y();
1310 nOutMax =
pOut->GetOutputSize().Height() - 1 + nOutMin;
1314 if (nOutMax - nOutMin < nDst)
1316 nOutMin += nOutMax + 1;
1318 nOutMin -= (nDst + 1) / 2;
1319 nOutMax = nOutMin + nDst;
1322 nOutHgt = nOutMax - nOutMin;
1325 if (nTemp > nMinLen) nMinLen = nTemp;
1341 if (nHgt < nMinLen) nHgt = nMinLen;
1346 if (
pOut && (nMinLen > nOutHgt)) nMinLen = nOutHgt;
1352 if (nY2 < nY1 + nMinLen) nY2 = nY1 + nMinLen;
1357 if (nY1 > nY2 - nMinLen) nY1 = nY2 - nMinLen;
1429 if(bUseDefaultValuesForMirrorAxes)
1484 if(!p3dObject->IsBreakObjPossible())
1539 pNewObj->SetChanged();
1540 pNewObj->BroadcastObjectChange();
1556 bool bCompound =
false;
1557 bool b3DObject =
false;
1558 for(
size_t nObjs = 0; (nObjs < nMarkCnt) && !bCompound; ++nObjs)
void SetAutoAdjustProjection(bool bAdjust)
void SetFocalLength(double fLen)
void SetPosAndLookAt(const basegfx::B3DPoint &rNewPos, const basegfx::B3DPoint &rNewLookAt)
void SetViewWindow(double fX, double fY, double fW, double fH)
Helper for 3d object changes affecting 2d geometry.
const basegfx::B3DRange & GetBoundVolume() const
const basegfx::B3DHomMatrix & GetTransform() const
const basegfx::B3DHomMatrix & GetFullTransform() const
virtual rtl::Reference< SdrAttrObj > GetBreakObj()
virtual E3dScene * getRootE3dSceneFromE3dObject() const override
virtual void SetSelected(bool bNew) override
void removeAllNonSelectedObjects()
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE) override
virtual SdrObjList * GetSubList() const override
void SetDrawOnlySelected(bool bNew)
void SetCamera(const Camera3D &rNewCamera)
const Camera3D & GetCamera() const
Derived class of SdrView to edit 3D objects.
E3dDefaultAttributes & Get3DDefaultAttributes()
void ConvertMarkedObjTo3D(bool bExtrude=true, const basegfx::B2DPoint &rPnt1=basegfx::B2DPoint(0.0, 0.0), const basegfx::B2DPoint &rPnt2=basegfx::B2DPoint(0.0, 1.0))
void End3DCreation(bool bUseDefaultValuesForMirrorAxes=false)
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr) override
bool IsConvertTo3DObjPossible() const
bool Is3DRotationCreationActive() const
virtual void DrawMarkedObj(OutputDevice &rOut) const override
void BreakSingle3DObj(E3dObject *pObj)
bool IsBreak3DObjPossible() const
E3dView(SdrModel &rSdrModel, OutputDevice *pOut)
std::unique_ptr< Impl3DMirrorConstructOverlay > mpMirrorOverlay
virtual void CheckPossibilities() override
void ImpCreateSingle3DObjectFlat(E3dScene *pScene, SdrObject *pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix const &rLatheMat)
static void DoDepthArrange(E3dScene const *pScene, double fDepth)
void ImpChangeSomeAttributesFor3DConversion(SdrObject *pObj)
void ImpIsConvertTo3DPossible(SdrObject const *pObj, bool &rAny3D, bool &rGroupSelected) const
void ImpChangeSomeAttributesFor3DConversion2(SdrObject *pObj)
virtual ~E3dView() override
rtl::Reference< E3dScene > SetCurrent3DObj(E3dObject *p3DObj)
bool ImpCloneAll3DObjectsToDestScene(E3dScene const *pSrcScene, E3dScene *pDstScene, Point aOffset)
double GetDefaultCamFocal()
void InitScene(E3dScene *pScene, double fW, double fH, double fCamZ)
void ResetCreationActive()
void ImpCreate3DObject(E3dScene *pScene, SdrObject *pObj, bool bExtrude, double fDepth, basegfx::B2DHomMatrix const &rLatheMat)
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions) override
virtual void MovAction(const Point &rPnt) override
double GetDefaultCamPosZ()
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const override
~Impl3DMirrorConstructOverlay()
void SetMirrorAxis(Point aMirrorAxisA, Point aMirrorAxisB)
sdr::overlay::OverlayObjectList maObjects
drawinglayer::primitive2d::Primitive2DContainer maFullOverlay
Impl3DMirrorConstructOverlay(const Impl3DMirrorConstructOverlay &)=delete
Impl3DMirrorConstructOverlay & operator=(const Impl3DMirrorConstructOverlay &)=delete
basegfx::B2DPolyPolygon * mpPolygons
constexpr tools::Long Y() const
void setX(tools::Long nX)
void setY(tools::Long nY)
constexpr tools::Long X() const
virtual void MovAction(const Point &rPnt) override
virtual bool BegDragObj(const Point &rPnt, OutputDevice *pOut, SdrHdl *pHdl, short nMinMov=-3, SdrDragMethod *pForcedMeth=nullptr)
bool IsSolidDragging() const
virtual void SetMarkHandles(SfxViewShell *pOtherShell) override
SdrHdl * GetDragHdl() const
virtual void CheckPossibilities()
bool IsConvertToPolyObjPossible() const
void ReplaceObjectAtView(SdrObject *pOldObj, SdrPageView &rPV, SdrObject *pNewObj, bool bMark=true)
bool IsUndoEnabled() const
bool IsConvertToPathObjPossible() const
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
bool InsertObjectAtView(SdrObject *pObj, SdrPageView &rPV, SdrInsertFlags nOptions=SdrInsertFlags::NONE)
bool IsImportMtfPossible() const
void ImpGetPasteObjList(Point &rPos, SdrObjList *&rpLst)
virtual void DrawMarkedObj(OutputDevice &rOut) const
virtual bool Paste(const SdrModel &rMod, const Point &rPos, SdrObjList *pLst, SdrInsertFlags nOptions)
virtual std::unique_ptr< SdrModel > CreateMarkedObjModel() const
SdrHdl * GetHdl(size_t nNum) const
SdrHdlKind GetKind() const
const Point & GetPos() const
SdrMark * GetMark(size_t nNum) const
bool IsObjMarked(SdrObject const *pObj) const
const SdrMarkList & GetMarkedObjectList() const
bool AreObjectsMarked() const
void SortMarkedObjects() const
SdrObject * GetMarkedObjectByIndex(size_t nNum) const
const SdrHdlList & GetHdlList() const
SdrMarkList & GetMarkedObjectListWriteAccess()
size_t GetMarkedObjectCount() const
SdrMark * GetSdrMarkByIndex(size_t nNum) const
SdrPageView * GetSdrPageViewOfMarkedByIndex(size_t nNum) const
const tools::Rectangle & GetAllMarkedRect() const
bool MarkObj(const Point &rPnt, short nTol=-2, bool bToggle=false, bool bDeep=false)
Everything a View needs to know about a selected object.
SdrObject * GetMarkedSdrObj() const
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
const SdrPage * GetPage(sal_uInt16 nPgNum) const
sal_uInt16 GetPageCount() const
virtual void MarkListHasChanged() override
const tools::Rectangle & GetAllObjBoundRect() const
SdrObject * GetObj(size_t nNum) const
size_t GetObjCount() const
virtual SdrObject * getSdrObjectFromSdrObjList() const
virtual basegfx::B2DPolyPolygon TakeXorPoly() const
The Xor-Polygon is required by the View to drag the object.
void SingleObjectPainter(OutputDevice &rOut) const
virtual SdrObjList * GetSubList() const
rtl::Reference< SdrObject > ConvertToPolyObj(bool bBezier, bool bLineToArea) const
static rtl::Reference< T > Clone(T const &rObj, SdrModel &rTargetModel)
SdrModel & getSdrModelFromSdrObject() const
virtual const tools::Rectangle & GetSnapRect() const
SfxStyleSheet * GetStyleSheet() const
bool IsGroupObject() const
SdrPage * getSdrPageFromSdrObject() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
rtl::Reference< SdrObject > ConvertToContourObj(SdrObject *pRet, bool bForceLineDash=false) const
const SfxItemSet & GetMergedItemSet() const
virtual SdrLayerID GetLayer() const
void SetMergedItem(const SfxPoolItem &rItem)
sal_uInt32 PageWindowCount() const
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
SdrPaintWindow * GetPaintWindow(sal_uInt32 nIndex) const
OutputDevice * GetFirstOutputDevice() const
sal_uInt32 PaintWindowCount() const
SdrPageView * GetSdrPageView() const
SdrModel & GetModel() const
rtl::Reference< sdr::overlay::OverlayManager > const & GetOverlayManager() const
const basegfx::B2DPolyPolygon & GetPathPoly() const
virtual void DeleteMarked()
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
const Color & GetValue() const
void rotate(double fRadiant)
void translate(double fX, double fY)
void scale(double fX, double fY)
void transform(const basegfx::B2DHomMatrix &rMatrix)
B2DPoint getCenter() const
void rotate(double fAngleX, double fAngleY, double fAngleZ)
void translate(double fX, double fY, double fZ)
void scale(double fX, double fY, double fZ)
BASEGFX_DLLPUBLIC void transform(const B3DHomMatrix &rMatrix)
B3DVector getRange() const
B3DPoint getCenter() const
void expand(const Tuple2D< TYPE > &rTuple)
void append(std::unique_ptr< OverlayObject > pOverlayObject)
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
constexpr ::Color COL_BLACK(0x00, 0x00, 0x00)
#define DBG_ASSERT(sCon, aError)
OUString SvxResId(TranslateId aId)
constexpr TypedWhichId< SvxColorItem > EE_CHAR_COLOR(EE_CHAR_START+0)
EmbeddedObjectRef * pObject
B2DPolyPolygon prepareForPolygonOperation(const B2DPolygon &rCandidate)
B2DHomMatrix createRotateAroundPoint(double fPointX, double fPointY, double fRadiant)
B2DPolyPolygon solvePolygonOperationAnd(const B2DPolyPolygon &rCandidateA, const B2DPolyPolygon &rCandidateB)
B2DHomMatrix createTranslateB2DHomMatrix(double fTranslateX, double fTranslateY)
B2DRange getRange(const B2DPolygon &rCandidate)
B2IRange fround(const B2DRange &rRange)
constexpr double deg2rad(double v)
constexpr TypedWhichId< SfxUInt32Item > SDRATTR_3DOBJ_DEPTH(SDRATTR_3DOBJ_FIRST+2)
E3dObject * DynCastE3dObject(SdrObject *pObj)
SdrTextObj * DynCastSdrTextObj(SdrObject *pObj)
E3dScene * DynCastE3dScene(SdrObject *pObj)
SfxBoolItem makeSvx3DDoubleSidedItem(bool bVal)
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)