1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
22 #include <svx/svdorect.hxx>
23 #include <svx/svxdllapi.h>
26 // Forward Declarations
29 namespace sdr::properties
{
30 class CaptionProperties
;
33 // Helper Class SdrCaptObjGeoData
34 class SdrCaptObjGeoData final
: public SdrTextObjGeoData
37 tools::Polygon aTailPoly
;
41 class SVXCORE_DLLPUBLIC SdrCaptionObj final
: public SdrRectObj
44 // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
45 friend class sdr::properties::CaptionProperties
;
46 friend class SdrTextObj
; // for ImpRecalcTail() during AutoGrow
48 // tdf#118662 exclusive friend function and setter for SuppressGetBitmap
49 friend void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj
* pSdrCaptionObj
, bool bValue
);
50 void setSuppressGetBitmap(bool bNew
)
52 mbSuppressGetBitmap
= bNew
;
55 virtual std::unique_ptr
<sdr::properties::BaseProperties
> CreateObjectSpecificProperties() override
;
56 virtual std::unique_ptr
<sdr::contact::ViewContact
> CreateObjectSpecificViewContact() override
;
58 tools::Polygon aTailPoly
; // the whole tail polygon
59 bool mbSpecialTextBoxShadow
; // for calc special shadow, default FALSE
60 bool mbFixedTail
; // for calc note box fixed tail, default FALSE
61 bool mbSuppressGetBitmap
; // tdf#118662
62 Point maFixedTailPos
; // for calc note box fixed tail position.
64 SVX_DLLPRIVATE
void ImpGetCaptParams(ImpCaptParams
& rPara
) const;
65 SVX_DLLPRIVATE
static void ImpCalcTail1(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
const & rRect
);
66 SVX_DLLPRIVATE
static void ImpCalcTail2(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
const & rRect
);
67 SVX_DLLPRIVATE
static void ImpCalcTail3(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
const & rRect
);
68 SVX_DLLPRIVATE
static void ImpCalcTail (const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
const & rRect
);
69 SVX_DLLPRIVATE
void ImpRecalcTail();
71 // protected destructor
72 virtual ~SdrCaptionObj() override
;
75 SdrCaptionObj(SdrModel
& rSdrModel
);
77 SdrCaptionObj(SdrModel
& rSdrModel
, SdrCaptionObj
const & rSource
);
80 const tools::Rectangle
& rRect
,
83 // tdf#118662 getter for SuppressGetBitmap
84 bool isSuppressGetBitmap() const { return mbSuppressGetBitmap
; }
86 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const override
;
87 virtual SdrObjKind
GetObjIdentifier() const override
;
88 virtual rtl::Reference
<SdrObject
> CloneSdrObject(SdrModel
& rTargetModel
) const override
;
90 // for calc: special shadow only for text box
91 void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow
= true; }
92 bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow
; }
94 // for calc: fixed note tail position.
95 void SetFixedTail() { mbFixedTail
= true; }
97 virtual OUString
TakeObjNameSingul() const override
;
98 virtual OUString
TakeObjNamePlural() const override
;
100 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const override
;
101 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
103 virtual sal_uInt32
GetHdlCount() const override
;
104 virtual void AddToHdlList(SdrHdlList
& rHdlList
) const override
;
106 // special drag methods
107 virtual bool hasSpecialDrag() const override
;
108 virtual bool beginSpecialDrag(SdrDragStat
& rDrag
) const override
;
109 virtual bool applySpecialDrag(SdrDragStat
& rDrag
) override
;
110 virtual OUString
getSpecialDragComment(const SdrDragStat
& rDrag
) const override
;
112 virtual bool BegCreate(SdrDragStat
& rStat
) override
;
113 virtual bool MovCreate(SdrDragStat
& rStat
) override
;
114 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
115 virtual bool BckCreate(SdrDragStat
& rStat
) override
;
116 virtual void BrkCreate(SdrDragStat
& rStat
) override
;
117 virtual basegfx::B2DPolyPolygon
TakeCreatePoly(const SdrDragStat
& rDrag
) const override
;
118 virtual PointerStyle
GetCreatePointer() const override
;
120 virtual void NbcMove(const Size
& rSiz
) override
;
121 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
123 virtual void NbcSetRelativePos(const Point
& rPnt
) override
;
124 virtual Point
GetRelativePos() const override
;
126 virtual const tools::Rectangle
& GetLogicRect() const override
;
127 virtual void NbcSetLogicRect(const tools::Rectangle
& rRect
) override
;
129 virtual sal_uInt32
GetSnapPointCount() const override
;
130 virtual Point
GetSnapPoint(sal_uInt32 i
) const override
;
133 virtual std::unique_ptr
<SdrObjGeoData
> NewGeoData() const override
;
134 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const override
;
135 virtual void RestoreGeoData(const SdrObjGeoData
& rGeo
) override
;
138 virtual rtl::Reference
<SdrObject
> DoConvertToPolyObj(bool bBezier
, bool bAddText
) const override
;
140 const Point
& GetTailPos() const;
141 void SetTailPos(const Point
& rPos
);
142 void NbcSetTailPos(const Point
& rPos
);
145 // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
146 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix
& rMatrix
, const basegfx::B2DPolyPolygon
& rPolyPolygon
) override
;
148 const Point
& GetFixedTailPos() const {return maFixedTailPos
;}
151 ::basegfx::B2DPolygon
getTailPolygon() const;
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */