xref: /AOO41X/main/svx/inc/svx/svdocapt.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDCAPT_HXX
25 #define _SVDCAPT_HXX
26 
27 #include <svx/svdorect.hxx>
28 #include "svx/svxdllapi.h"
29 
30 //************************************************************
31 //   Vorausdeklarationen
32 //************************************************************
33 
34 class ImpCaptParams;
35 
36 namespace sdr { namespace properties {
37     class CaptionProperties;
38 }}
39 
40 #define SDRSETITEM_CAPTION_ATTR     SDRSETITEM_ATTR_COUNT
41 
42 //************************************************************
43 //   Hilfsklasse SdrCaptObjGeoData
44 //************************************************************
45 
46 // #109872#
47 class SdrCaptObjGeoData : public SdrTextObjGeoData
48 {
49 public:
50     Polygon                     aTailPoly;
51 };
52 
53 //************************************************************
54 //   SdrCaptionObj
55 //************************************************************
56 
57 class SVX_DLLPUBLIC SdrCaptionObj : public SdrRectObj
58 {
59 private:
60     // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
61     friend class sdr::properties::CaptionProperties;
62     friend class                SdrTextObj; // fuer ImpRecalcTail() bei AutoGrow
63 
64 protected:
65     virtual sdr::properties::BaseProperties* CreateObjectSpecificProperties();
66     virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
67 
68 private:
69     Polygon                     aTailPoly;  // das ganze Polygon des Schwanzes
70     sal_Bool                    mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
71     sal_Bool                    mbFixedTail; // for calc note box fixed tail, default FALSE
72     Point                       maFixedTailPos; // for calc note box fixed tail position.
73 
74 private:
75     SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
76     SVX_DLLPRIVATE void ImpCalcTail1(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
77     SVX_DLLPRIVATE void ImpCalcTail2(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
78     SVX_DLLPRIVATE void ImpCalcTail3(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
79     SVX_DLLPRIVATE void ImpCalcTail4(const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
80     SVX_DLLPRIVATE void ImpCalcTail (const ImpCaptParams& rPara, Polygon& rPoly, Rectangle& rRect) const;
81     SVX_DLLPRIVATE void ImpRecalcTail();
82 
83 public:
84     TYPEINFO();
85     SdrCaptionObj();
86     SdrCaptionObj(const Rectangle& rRect);
87     SdrCaptionObj(const Rectangle& rRect, const Point& rTail);
88     virtual ~SdrCaptionObj();
89 
90     virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const;
91     virtual sal_uInt16 GetObjIdentifier() const;
92     virtual void operator=(const SdrObject& rObj);
93 
94     // for calc: special shadow only for text box
SetSpecialTextBoxShadow()95     void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = sal_True; }
GetSpecialTextBoxShadow() const96     sal_Bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
97 
98     // for calc: fixed note tail position.
SetFixedTail()99     void SetFixedTail() { mbFixedTail = sal_True; }
100 
101     virtual void TakeObjNameSingul(String& rName) const;
102     virtual void TakeObjNamePlural(String& rName) const;
103 
104     virtual basegfx::B2DPolyPolygon TakeXorPoly() const;
105     virtual void SetModel(SdrModel* pNewModel);
106     virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
107 
108     virtual sal_uInt32 GetHdlCount() const;
109     virtual SdrHdl* GetHdl(sal_uInt32 nHdlNum) const;
110 
111     // special drag methods
112     virtual bool hasSpecialDrag() const;
113     virtual bool beginSpecialDrag(SdrDragStat& rDrag) const;
114     virtual bool applySpecialDrag(SdrDragStat& rDrag);
115     virtual String getSpecialDragComment(const SdrDragStat& rDrag) const;
116 
117     virtual FASTBOOL BegCreate(SdrDragStat& rStat);
118     virtual FASTBOOL MovCreate(SdrDragStat& rStat);
119     virtual FASTBOOL EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd);
120     virtual FASTBOOL BckCreate(SdrDragStat& rStat);
121     virtual void BrkCreate(SdrDragStat& rStat);
122     virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const;
123     virtual Pointer GetCreatePointer() const;
124 
125     virtual void NbcMove(const Size& rSiz);
126     virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact);
127 
128     virtual void NbcSetRelativePos(const Point& rPnt);
129     virtual Point GetRelativePos() const;
130     virtual void NbcSetAnchorPos(const Point& rPnt);
131     virtual const Point& GetAnchorPos() const;
132 
133     virtual void RecalcSnapRect();
134     virtual const Rectangle& GetSnapRect() const;
135     virtual void NbcSetSnapRect(const Rectangle& rRect);
136     virtual const Rectangle& GetLogicRect() const;
137     virtual void NbcSetLogicRect(const Rectangle& rRect);
138 
139     virtual sal_uInt32 GetSnapPointCount() const;
140     virtual Point GetSnapPoint(sal_uInt32 i) const;
141 
142 protected:
143     virtual SdrObjGeoData* NewGeoData() const;
144     virtual void SaveGeoData(SdrObjGeoData& rGeo) const;
145     virtual void RestGeoData(const SdrObjGeoData& rGeo);
146 
147 public:
148     virtual SdrObject* DoConvertToPolyObj(sal_Bool bBezier, bool bAddText) const;
149 
150     const Point& GetTailPos() const;
151     void SetTailPos(const Point& rPos);
152     void NbcSetTailPos(const Point& rPos);
153 
154     // #i32599#
155     // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
156     virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon);
157 
GetFixedTailPos() const158     inline const Point& GetFixedTailPos() const  {return maFixedTailPos;}
159 
160     // geometry access
161     ::basegfx::B2DPolygon getTailPolygon() const;
162 };
163 
164 ////////////////////////////////////////////////////////////////////////////////////////////////////
165 
166 #endif //_SVDOCAPT_HXX
167 
168