Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef INCLUDED_SVX_SVDOCAPT_HXX
21 : #define INCLUDED_SVX_SVDOCAPT_HXX
22 :
23 : #include <svx/svdorect.hxx>
24 : #include <svx/svxdllapi.h>
25 :
26 :
27 : // Forward Declarations
28 :
29 :
30 : class ImpCaptParams;
31 :
32 : namespace sdr { namespace properties {
33 : class CaptionProperties;
34 : }}
35 :
36 :
37 : // Helper Class SdrCaptObjGeoData
38 :
39 :
40 : // #109872#
41 0 : class SdrCaptObjGeoData : public SdrTextObjGeoData
42 : {
43 : public:
44 : Polygon aTailPoly;
45 : };
46 :
47 :
48 : // SdrCaptionObj
49 :
50 :
51 0 : class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj
52 : {
53 : private:
54 : // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
55 : friend class sdr::properties::CaptionProperties;
56 : friend class SdrTextObj; // for ImpRecalcTail() during AutoGrow
57 :
58 : protected:
59 : virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties() SAL_OVERRIDE;
60 : virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact() SAL_OVERRIDE;
61 :
62 : private:
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.
67 :
68 : private:
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();
76 :
77 : public:
78 : TYPEINFO_OVERRIDE();
79 : SdrCaptionObj();
80 : SdrCaptionObj(const Rectangle& rRect, const Point& rTail);
81 : virtual ~SdrCaptionObj();
82 :
83 : virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const SAL_OVERRIDE;
84 : virtual sal_uInt16 GetObjIdentifier() const SAL_OVERRIDE;
85 : virtual SdrCaptionObj* Clone() const SAL_OVERRIDE;
86 :
87 : // for calc: special shadow only for text box
88 0 : void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; }
89 0 : bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
90 :
91 : // for calc: fixed note tail position.
92 0 : void SetFixedTail() { mbFixedTail = true; }
93 :
94 : virtual OUString TakeObjNameSingul() const SAL_OVERRIDE;
95 : virtual OUString TakeObjNamePlural() const SAL_OVERRIDE;
96 :
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;
100 :
101 : virtual sal_uInt32 GetHdlCount() const SAL_OVERRIDE;
102 : virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const SAL_OVERRIDE;
103 :
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;
109 :
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;
117 :
118 : virtual void NbcMove(const Size& rSiz) SAL_OVERRIDE;
119 : virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) SAL_OVERRIDE;
120 :
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;
125 :
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;
131 :
132 : virtual sal_uInt32 GetSnapPointCount() const SAL_OVERRIDE;
133 : virtual Point GetSnapPoint(sal_uInt32 i) const SAL_OVERRIDE;
134 :
135 : protected:
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;
139 :
140 : public:
141 : virtual SdrObject* DoConvertToPolyObj(bool bBezier, bool bAddText) const SAL_OVERRIDE;
142 :
143 : const Point& GetTailPos() const;
144 : void SetTailPos(const Point& rPos);
145 : void NbcSetTailPos(const Point& rPos);
146 :
147 : // #i32599#
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;
150 :
151 0 : inline const Point& GetFixedTailPos() const {return maFixedTailPos;}
152 :
153 : // geometry access
154 : ::basegfx::B2DPolygon getTailPolygon() const;
155 : };
156 :
157 :
158 :
159 : #endif //_SVDOCAPT_HXX
160 :
161 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|