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
41 class SdrCaptObjGeoData
: public SdrTextObjGeoData
51 class SVX_DLLPUBLIC SdrCaptionObj
: public SdrRectObj
54 // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
55 friend class sdr::properties::CaptionProperties
;
56 friend class SdrTextObj
; // for ImpRecalcTail() during AutoGrow
59 virtual sdr::properties::BaseProperties
* CreateObjectSpecificProperties() SAL_OVERRIDE
;
60 virtual sdr::contact::ViewContact
* CreateObjectSpecificViewContact() SAL_OVERRIDE
;
63 Polygon aTailPoly
; // the whole tail polygon
64 bool mbSpecialTextBoxShadow
; // for calc special shadow, default FALSE
65 bool mbFixedTail
; // for calc note box fixed tail, default FALSE
66 Point maFixedTailPos
; // for calc note box fixed tail position.
69 SVX_DLLPRIVATE
void ImpGetCaptParams(ImpCaptParams
& rPara
) const;
70 SVX_DLLPRIVATE
void ImpCalcTail1(const ImpCaptParams
& rPara
, Polygon
& rPoly
, Rectangle
& rRect
) const;
71 SVX_DLLPRIVATE
void ImpCalcTail2(const ImpCaptParams
& rPara
, Polygon
& rPoly
, Rectangle
& rRect
) const;
72 SVX_DLLPRIVATE
void ImpCalcTail3(const ImpCaptParams
& rPara
, Polygon
& rPoly
, Rectangle
& rRect
) const;
73 SVX_DLLPRIVATE
void ImpCalcTail4(const ImpCaptParams
& rPara
, Polygon
& rPoly
, Rectangle
& rRect
) const;
74 SVX_DLLPRIVATE
void ImpCalcTail (const ImpCaptParams
& rPara
, Polygon
& rPoly
, Rectangle
& rRect
) const;
75 SVX_DLLPRIVATE
void ImpRecalcTail();
80 SdrCaptionObj(const Rectangle
& rRect
, const Point
& rTail
);
81 virtual ~SdrCaptionObj();
83 virtual void TakeObjInfo(SdrObjTransformInfoRec
& rInfo
) const SAL_OVERRIDE
;
84 virtual sal_uInt16
GetObjIdentifier() const SAL_OVERRIDE
;
85 virtual SdrCaptionObj
* Clone() const SAL_OVERRIDE
;
87 // for calc: special shadow only for text box
88 void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow
= true; }
89 bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow
; }
91 // for calc: fixed note tail position.
92 void SetFixedTail() { mbFixedTail
= true; }
94 virtual OUString
TakeObjNameSingul() const SAL_OVERRIDE
;
95 virtual OUString
TakeObjNamePlural() const SAL_OVERRIDE
;
97 virtual basegfx::B2DPolyPolygon
TakeXorPoly() const SAL_OVERRIDE
;
98 virtual void SetModel(SdrModel
* pNewModel
) SAL_OVERRIDE
;
99 virtual void Notify(SfxBroadcaster
& rBC
, const SfxHint
& rHint
) SAL_OVERRIDE
;
101 virtual sal_uInt32
GetHdlCount() const SAL_OVERRIDE
;
102 virtual SdrHdl
* GetHdl(sal_uInt32 nHdlNum
) const SAL_OVERRIDE
;
104 // special drag methods
105 virtual bool hasSpecialDrag() const SAL_OVERRIDE
;
106 virtual bool beginSpecialDrag(SdrDragStat
& rDrag
) const SAL_OVERRIDE
;
107 virtual bool applySpecialDrag(SdrDragStat
& rDrag
) SAL_OVERRIDE
;
108 virtual OUString
getSpecialDragComment(const SdrDragStat
& rDrag
) const SAL_OVERRIDE
;
110 virtual bool BegCreate(SdrDragStat
& rStat
) SAL_OVERRIDE
;
111 virtual bool MovCreate(SdrDragStat
& rStat
) SAL_OVERRIDE
;
112 virtual bool EndCreate(SdrDragStat
& rStat
, SdrCreateCmd eCmd
) SAL_OVERRIDE
;
113 virtual bool BckCreate(SdrDragStat
& rStat
) SAL_OVERRIDE
;
114 virtual void BrkCreate(SdrDragStat
& rStat
) SAL_OVERRIDE
;
115 virtual basegfx::B2DPolyPolygon
TakeCreatePoly(const SdrDragStat
& rDrag
) const SAL_OVERRIDE
;
116 virtual Pointer
GetCreatePointer() const SAL_OVERRIDE
;
118 virtual void NbcMove(const Size
& rSiz
) SAL_OVERRIDE
;
119 virtual void NbcResize(const Point
& rRef
, const Fraction
& xFact
, const Fraction
& yFact
) SAL_OVERRIDE
;
121 virtual void NbcSetRelativePos(const Point
& rPnt
) SAL_OVERRIDE
;
122 virtual Point
GetRelativePos() const SAL_OVERRIDE
;
123 virtual void NbcSetAnchorPos(const Point
& rPnt
) SAL_OVERRIDE
;
124 virtual const Point
& GetAnchorPos() const SAL_OVERRIDE
;
126 virtual void RecalcSnapRect() SAL_OVERRIDE
;
127 virtual const Rectangle
& GetSnapRect() const SAL_OVERRIDE
;
128 virtual void NbcSetSnapRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
129 virtual const Rectangle
& GetLogicRect() const SAL_OVERRIDE
;
130 virtual void NbcSetLogicRect(const Rectangle
& rRect
) SAL_OVERRIDE
;
132 virtual sal_uInt32
GetSnapPointCount() const SAL_OVERRIDE
;
133 virtual Point
GetSnapPoint(sal_uInt32 i
) const SAL_OVERRIDE
;
136 virtual SdrObjGeoData
* NewGeoData() const SAL_OVERRIDE
;
137 virtual void SaveGeoData(SdrObjGeoData
& rGeo
) const SAL_OVERRIDE
;
138 virtual void RestGeoData(const SdrObjGeoData
& rGeo
) SAL_OVERRIDE
;
141 virtual SdrObject
* DoConvertToPolyObj(bool bBezier
, bool bAddText
) const SAL_OVERRIDE
;
143 const Point
& GetTailPos() const;
144 void SetTailPos(const Point
& rPos
);
145 void NbcSetTailPos(const Point
& rPos
);
148 // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
149 virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix
& rMatrix
, const basegfx::B2DPolyPolygon
& rPolyPolygon
) SAL_OVERRIDE
;
151 inline const Point
& GetFixedTailPos() const {return maFixedTailPos
;}
154 ::basegfx::B2DPolygon
getTailPolygon() const;
159 #endif //_SVDOCAPT_HXX
161 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */