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 .
20 #ifndef INCLUDED_SVX_SVDOCAPT_HXX
21 #define INCLUDED_SVX_SVDOCAPT_HXX
23 #include <svx/svdorect.hxx>
24 #include <svx/svxdllapi.h>
27 // Forward Declarations
32 namespace sdr
{ namespace properties
{
33 class CaptionProperties
;
37 // Helper Class SdrCaptObjGeoData
40 class SdrCaptObjGeoData
: public SdrTextObjGeoData
43 tools::Polygon aTailPoly
;
50 class SVX_DLLPUBLIC SdrCaptionObj
: public SdrRectObj
53 // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
54 friend class sdr::properties::CaptionProperties
;
55 friend class SdrTextObj
; // for ImpRecalcTail() during AutoGrow
58 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties() override
;
59 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact() override
;
62 tools::Polygon aTailPoly
; // the whole tail polygon
63 bool mbSpecialTextBoxShadow
; // for calc special shadow, default FALSE
64 bool mbFixedTail
; // for calc note box fixed tail, default FALSE
65 Point maFixedTailPos
; // for calc note box fixed tail position.
68 SVX_DLLPRIVATE
void ImpGetCaptParams(ImpCaptParams
& rPara
) const;
69 SVX_DLLPRIVATE
static void ImpCalcTail1(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
& rRect
);
70 SVX_DLLPRIVATE
static void ImpCalcTail2(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
& rRect
);
71 SVX_DLLPRIVATE
static void ImpCalcTail3(const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
& rRect
);
72 SVX_DLLPRIVATE
static void ImpCalcTail (const ImpCaptParams
& rPara
, tools::Polygon
& rPoly
, tools::Rectangle
& rRect
);
73 SVX_DLLPRIVATE
void ImpRecalcTail();
77 SdrCaptionObj(const tools::Rectangle
& rRect
, const Point
& rTail
);
78 virtual ~SdrCaptionObj() override
;
80 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const override
;
81 virtual sal_uInt16
GetObjIdentifier() const override
;
82 virtual SdrCaptionObj
* Clone() const override
;
84 // for calc: special shadow only for text box
85 void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow
= true; }
86 bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow
; }
88 // for calc: fixed note tail position.
89 void SetFixedTail() { mbFixedTail
= true; }
91 virtual OUString
TakeObjNameSingul() const override
;
92 virtual OUString
TakeObjNamePlural() const override
;
94 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const override
;
95 virtual void SetModel(SdrModel
* pNewModel
) override
;
96 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) override
;
98 virtual sal_uInt32
GetHdlCount() const override
;
99 virtual SdrHdl
* GetHdl(sal_uInt32 nHdlNum
) const override
;
101 // special drag methods
102 virtual bool hasSpecialDrag() const override
;
103 virtual bool beginSpecialDrag(SdrDragStat
& rDrag
) const override
;
104 virtual bool applySpecialDrag(SdrDragStat
& rDrag
) override
;
105 virtual OUString
getSpecialDragComment(const SdrDragStat
& rDrag
) const override
;
107 virtual bool BegCreate(SdrDragStat
& rStat
) override
;
108 virtual bool MovCreate(SdrDragStat
& rStat
) override
;
109 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) override
;
110 virtual bool BckCreate(SdrDragStat
& rStat
) override
;
111 virtual void BrkCreate(SdrDragStat
& rStat
) override
;
112 virtual basegfx::B2DPolyPolygon
TakeCreatePoly(const SdrDragStat
& rDrag
) const override
;
113 virtual Pointer
GetCreatePointer() const override
;
115 virtual void NbcMove(const Size
& rSiz
) override
;
116 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) override
;
118 virtual void NbcSetRelativePos(const Point
& rPnt
) override
;
119 virtual Point
GetRelativePos() const override
;
121 virtual const tools::Rectangle
& GetLogicRect() const override
;
122 virtual void NbcSetLogicRect(const tools::Rectangle
& rRect
) override
;
124 virtual sal_uInt32
GetSnapPointCount() const override
;
125 virtual Point
GetSnapPoint(sal_uInt32 i
) const override
;
128 virtual SdrObjGeoData
* NewGeoData() const override
;
129 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const override
;
130 virtual void RestGeoData(const SdrObjGeoData
& rGeo
) override
;
133 virtual SdrObject
* DoConvertToPolyObj(bool bBezier
, bool bAddText
) const override
;
135 const Point
& GetTailPos() const;
136 void SetTailPos(const Point
& rPos
);
137 void NbcSetTailPos(const Point
& rPos
);
140 // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
141 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix
& rMatrix
, const basegfx::B2DPolyPolygon
& rPolyPolygon
) override
;
143 const Point
& GetFixedTailPos() const {return maFixedTailPos
;}
146 ::basegfx::B2DPolygon
getTailPolygon() const;
150 #endif //_SVDOCAPT_HXX
152 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */