33#include <svx/strings.hrc>
57enum EscDir {LKS,RTS,OBN,UNT};
122 bool bLft=(aTl.
X()-aLft.
X()<aRgt.
X()-aTl.
X());
134 bool bTop=(aTl.
Y()-aTop.
Y()<aBtm.
Y()-aTl.
Y());
146 BigInt aHorX(aBestPt.
X()-aTl.
X()); aHorX*=aHorX;
147 BigInt aHorY(aBestPt.
Y()-aTl.
Y()); aHorY*=aHorY;
148 BigInt aVerX(aBest2.
X()-aTl.
X()); aVerX*=aVerX;
149 BigInt aVerY(aBest2.
Y()-aTl.
Y()); aVerY*=aVerY;
151 bTakeIt=aVerX+aVerY<aHorX+aHorY;
153 bTakeIt=aVerX+aVerY>=aHorX+aHorY;
170 return std::make_unique<sdr::properties::CaptionProperties>(*
this);
178 return std::make_unique<sdr::contact::ViewContactOfSdrCaptionObj>(*
this);
185 mbSpecialTextBoxShadow(false),
187 mbSuppressGetBitmap(false)
193 mbSuppressGetBitmap(false)
207 mbSpecialTextBoxShadow(false),
209 mbSuppressGetBitmap(false)
250 if (!
aName.isEmpty())
258 return SvxResId(STR_ObjNamePluralCAPTION);
282 pHdl->SetPointNum(0);
283 rHdlList.
AddHdl(std::move(pHdl));
437 rPara.
CalcEscPos(aTl, rRect, aEscPos, eEscDir);
440 if(eEscDir==LKS || eEscDir==RTS)
442 aPol[0].setX( aEscPos.
X() );
446 aPol[0].setY( aEscPos.
Y() );
481 if (eEscDir==LKS || eEscDir==RTS) {
483 aPol[1].setX((aTl.
X()+aEscPos.
X())/2 );
485 if (eEscDir==LKS) aPol[1].AdjustX( -(rPara.
nLineLen) );
486 else aPol[1].AdjustX(rPara.
nLineLen );
490 aPol[1].setY((aTl.
Y()+aEscPos.
Y())/2 );
492 if (eEscDir==OBN) aPol[1].AdjustY( -(rPara.
nLineLen) );
493 else aPol[1].AdjustY(rPara.
nLineLen );
504 switch (rPara.
eType) {
568 return PointerStyle::DrawCaption;
591 Size aSiz(rPnt.
X()-aRelPos0.
X(),rPnt.
Y()-aRelPos0.
Y());
653 return std::make_unique<SdrCaptObjGeoData>();
676 pRet = std::move(pTail);
677 else if (pRect && !pTail)
678 pRet = std::move(pRect);
679 else if (pTail && pRect)
681 if (pTail->GetSubList())
683 pTail->GetSubList()->NbcInsertObject(pRect.get());
684 pRet = std::move(pTail);
686 else if (pRect->GetSubList())
688 pRect->GetSubList()->NbcInsertObject(pTail.get(),0);
689 pRet = std::move(pRect);
694 pGrp->GetSubList()->NbcInsertObject(pRect.get());
695 pGrp->GetSubList()->NbcInsertObject(pTail.get(),0);
705 assert(rotate !=
nullptr);
713 *
rotate = fmod(*rotate + M_PI, 2 * M_PI);
726 double fRotate, fShearX;
727 rMatrix.
decompose(aScale, aTranslate, fRotate, fShearX);
729 handleNegativeScale(aScale, &fRotate);
void CalcEscPos(const Point &rTail, const tools::Rectangle &rRect, Point &rPt, EscDir &rDir) const
constexpr tools::Long Y() const
constexpr tools::Long X() const
class SdrCaptionGapItem Distance of the line start from the Rect
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual rtl::Reference< SdrObject > CloneSdrObject(SdrModel &rTargetModel) const override
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
static SVX_DLLPRIVATE void ImpCalcTail2(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
virtual Point GetSnapPoint(sal_uInt32 i) const override
virtual ~SdrCaptionObj() override
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
virtual SdrObjKind GetObjIdentifier() const override
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
SdrCaptionObj(SdrModel &rSdrModel)
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
SVX_DLLPRIVATE void ImpRecalcTail()
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
virtual OUString TakeObjNameSingul() const override
const Point & GetTailPos() const
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
virtual bool MovCreate(SdrDragStat &rStat) override
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
void SetTailPos(const Point &rPos)
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
virtual bool BckCreate(SdrDragStat &rStat) override
virtual void NbcSetRelativePos(const Point &rPnt) override
The relative position of a SdrObject is the distance of the upper left corner of the logic bounding r...
static SVX_DLLPRIVATE void ImpCalcTail(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
virtual void BrkCreate(SdrDragStat &rStat) override
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
::basegfx::B2DPolygon getTailPolygon() const
void NbcSetTailPos(const Point &rPos)
static SVX_DLLPRIVATE void ImpCalcTail3(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams &rPara) const
bool mbSpecialTextBoxShadow
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual const tools::Rectangle & GetLogicRect() const override
virtual OUString TakeObjNamePlural() const override
static SVX_DLLPRIVATE void ImpCalcTail1(const ImpCaptParams &rPara, tools::Polygon &rPoly, tools::Rectangle const &rRect)
virtual Point GetRelativePos() const override
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
const Point & GetFixedTailPos() const
SdrObject * GetCreateObj() const
void SetActionRect(const tools::Rectangle &rR)
sal_Int32 GetPointCount() const
const Point & GetStart() const
SdrView * GetView() const
void SetEndDragChangesGeoAndAttributes(bool bOn)
const SdrHdl * GetHdl() const
const Point & GetNow() const
void SetNoSnap(bool bOn=true)
void SetOrtho8Possible(bool bOn=true)
SdrPageView * GetPageView() const
void SetEndDragChangesAttributes(bool bOn)
void AddHdl(std::unique_ptr< SdrHdl > pHdl)
sal_uInt32 GetPolyNum() const
sal_uInt32 GetPointNum() const
All geometrical data of an arbitrary object for use in undo/redo.
const Point & GetAnchorPos() const
void ActionChanged() const
bool LineGeometryUsageIsNecessary() const
void BroadcastObjectChange() const
SdrModel & getSdrModelFromSdrObject() const
SdrObjUserCall * m_pUserCall
virtual const OUString & GetName() const
void SendUserCall(SdrUserCallType eUserCall, const tools::Rectangle &rBoundRect) const
virtual void SetChanged()
virtual const tools::Rectangle & GetLastBoundRect() const
virtual void SetSnapRect(const tools::Rectangle &rRect)
OUString ImpGetDescriptionStr(TranslateId pStrCacheID) const
virtual void SetBoundRectDirty()
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
const SfxItemSet & GetObjectItemSet() const
Rectangle objects (rectangle, circle, ...)
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
virtual rtl::Reference< SdrObject > DoConvertToPolyObj(bool bBezier, bool bAddText) const override
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
tools::Rectangle const & getRectangle() const
void moveRectangle(sal_Int32 nXDelta, sal_Int32 nYDelta)
void moveRectanglePosition(sal_Int32 nX, sal_Int32 nY)
rtl::Reference< SdrPathObj > ImpConvertMakeObj(const basegfx::B2DPolyPolygon &rPolyPolygon, bool bClosed, bool bBezier) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
bool decompose(B2DTuple &rScale, B2DTuple &rTranslate, double &rRotate, double &rShearX) const
void append(const B2DPolygon &rPolygon, sal_uInt32 nCount=1)
OUString SvxResId(TranslateId aId)
tools::Long FRound(double fVal)
def rotate(shapename, deg)
B2DPolygon createPolygonFromRect(const B2DRectangle &rRect, double fRadiusX, double fRadiusY)
SdrObject * SdrObjectPrimitiveHit(const SdrObject &rObject, const Point &rPnt, const basegfx::B2DVector &rHitTolerance, const SdrPageView &rSdrPageView, const SdrLayerIDSet *pVisiLayer, bool bTextOnly, drawinglayer::primitive2d::Primitive2DContainer *pHitContainer)
constexpr TypedWhichId< SdrCaptionEscRelItem > SDRATTR_CAPTIONESCREL(SDRATTR_CAPTION_FIRST+6)
constexpr TypedWhichId< SdrMetricItem > SDRATTR_CAPTIONGAP(SDRATTR_CAPTION_FIRST+3)
constexpr TypedWhichId< SdrCaptionEscIsRelItem > SDRATTR_CAPTIONESCISREL(SDRATTR_CAPTION_FIRST+5)
constexpr TypedWhichId< SdrCaptionTypeItem > SDRATTR_CAPTIONTYPE(SDRATTR_CAPTION_FIRST+0)
constexpr TypedWhichId< SdrCaptionEscAbsItem > SDRATTR_CAPTIONESCABS(SDRATTR_CAPTION_FIRST+7)
constexpr TypedWhichId< SdrCaptionLineLenItem > SDRATTR_CAPTIONLINELEN(SDRATTR_CAPTION_FIRST+8)
constexpr TypedWhichId< SdrCaptionFitLineLenItem > SDRATTR_CAPTIONFITLINELEN(SDRATTR_CAPTION_FIRST+9)
constexpr TypedWhichId< SdrOnOffItem > SDRATTR_CAPTIONFIXEDANGLE(SDRATTR_CAPTION_FIRST+1)
constexpr TypedWhichId< SdrCaptionEscDirItem > SDRATTR_CAPTIONESCDIR(SDRATTR_CAPTION_FIRST+4)
@ Caption
connector object
tools::Long BigMulDiv(tools::Long nVal, tools::Long nMul, tools::Long nDiv)
void ResizePoly(tools::Polygon &rPoly, const Point &rRef, const Fraction &xFact, const Fraction &yFact)
void MovePoly(tools::Polygon &rPoly, const Size &S)