LibreOffice Module svx (master)  1
svdocapt.hxx
Go to the documentation of this file.
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 class ImpCaptParams;
29 
30 namespace sdr::properties {
31  class CaptionProperties;
32 }
33 
34 // Helper Class SdrCaptObjGeoData
36 {
37 public:
39 };
40 
41 // SdrCaptionObj
43 {
44 private:
45  // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
47  friend class SdrTextObj; // for ImpRecalcTail() during AutoGrow
48 
49  // tdf#118662 exclusive friend function and setter for SuppressGetBitmap
50  friend void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj* pSdrCaptionObj, bool bValue);
51  void setSuppressGetBitmap(bool bNew)
52  {
53  mbSuppressGetBitmap = bNew;
54  }
55 
56  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
57  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
58 
59  tools::Polygon aTailPoly; // the whole tail polygon
60  bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
61  bool mbFixedTail; // for calc note box fixed tail, default FALSE
62  bool mbSuppressGetBitmap; // tdf#118662
63  Point maFixedTailPos; // for calc note box fixed tail position.
64 
65  SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
66  SVX_DLLPRIVATE static void ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
67  SVX_DLLPRIVATE static void ImpCalcTail2(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
68  SVX_DLLPRIVATE static void ImpCalcTail3(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
69  SVX_DLLPRIVATE static void ImpCalcTail (const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
70  SVX_DLLPRIVATE void ImpRecalcTail();
71 
72  // protected destructor
73  virtual ~SdrCaptionObj() override;
74 
75 public:
76  SdrCaptionObj(SdrModel& rSdrModel);
77  // Copy constructor
78  SdrCaptionObj(SdrModel& rSdrModel, SdrCaptionObj const & rSource);
80  SdrModel& rSdrModel,
81  const tools::Rectangle& rRect,
82  const Point& rTail);
83 
84  // tdf#118662 getter for SuppressGetBitmap
85  bool isSuppressGetBitmap() const { return mbSuppressGetBitmap; }
86 
87  virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
88  virtual SdrObjKind GetObjIdentifier() const override;
89  virtual SdrCaptionObj* CloneSdrObject(SdrModel& rTargetModel) const override;
90 
91  // for calc: special shadow only for text box
92  void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; }
93  bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
94 
95  // for calc: fixed note tail position.
96  void SetFixedTail() { mbFixedTail = true; }
97 
98  virtual OUString TakeObjNameSingul() const override;
99  virtual OUString TakeObjNamePlural() const override;
100 
101  virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
102  virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
103 
104  virtual sal_uInt32 GetHdlCount() const override;
105  virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
106 
107  // special drag methods
108  virtual bool hasSpecialDrag() const override;
109  virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
110  virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
111  virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
112 
113  virtual bool BegCreate(SdrDragStat& rStat) override;
114  virtual bool MovCreate(SdrDragStat& rStat) override;
115  virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
116  virtual bool BckCreate(SdrDragStat& rStat) override;
117  virtual void BrkCreate(SdrDragStat& rStat) override;
118  virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
119  virtual PointerStyle GetCreatePointer() const override;
120 
121  virtual void NbcMove(const Size& rSiz) override;
122  virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
123 
124  virtual void NbcSetRelativePos(const Point& rPnt) override;
125  virtual Point GetRelativePos() const override;
126 
127  virtual const tools::Rectangle& GetLogicRect() const override;
128  virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
129 
130  virtual sal_uInt32 GetSnapPointCount() const override;
131  virtual Point GetSnapPoint(sal_uInt32 i) const override;
132 
133 private:
134  virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
135  virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
136  virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
137 
138 public:
139  virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
140 
141  const Point& GetTailPos() const;
142  void SetTailPos(const Point& rPos);
143  void NbcSetTailPos(const Point& rPos);
144 
145  // #i32599#
146  // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
147  virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
148 
149  const Point& GetFixedTailPos() const {return maFixedTailPos;}
150 
151  // geometry access
152  ::basegfx::B2DPolygon getTailPolygon() const;
153 };
154 
155 
156 #endif //_SVDOCAPT_HXX
157 
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void NbcMove(const Size &rSiz) override
The methods Move, Resize, Rotate, Mirror, Shear, SetSnapRect and SetLogicRect call the corresponding ...
Definition: svdorect.cxx:456
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdorect.cxx:370
void SetSpecialTextBoxShadow()
Definition: svdocapt.hxx:92
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:572
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:39
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1107
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdorect.cxx:399
bool mbSpecialTextBoxShadow
Definition: svdocapt.hxx:60
Point maFixedTailPos
Definition: svdocapt.hxx:63
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:202
bool mbSuppressGetBitmap
Definition: svdocapt.hxx:62
virtual Point GetRelativePos() const
Definition: svdobj.cxx:1608
bool mbFixedTail
Definition: svdocapt.hxx:61
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdorect.cxx:261
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1623
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdorect.cxx:439
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:174
SdrObjKind
Definition: svdobjkind.hxx:24
virtual bool BegCreate(SdrDragStat &rStat) override
Every object must be able to create itself interactively.
Definition: svdotxdr.cxx:182
Rectangle objects (rectangle, circle, ...)
Definition: svdorect.hxx:39
Provides information about various ZObject properties.
Definition: svdobj.hxx:196
void SetFixedTail()
Definition: svdocapt.hxx:96
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdorect.cxx:351
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdorect.cxx:356
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:225
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1443
bool GetSpecialTextBoxShadow() const
Definition: svdocapt.hxx:93
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:538
tools::Polygon aTailPoly
Definition: svdocapt.hxx:38
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:290
void setSuppressGetBitmap(bool bNew)
Definition: svdocapt.hxx:51
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:221
void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj *pSdrCaptionObj, bool bValue)
tools::Polygon aTailPoly
Definition: svdocapt.hxx:59
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdorect.cxx:450
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:148
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:284
virtual SdrRectObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:256
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdorect.cxx:174
bool isSuppressGetBitmap() const
Definition: svdocapt.hxx:85
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:47
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:462
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:98
PointerStyle
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:295
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1112
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotxdr.cxx:207
SdrCreateCmd
Definition: svdtypes.hxx:27
virtual bool MovCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:192
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
virtual void NbcSetRelativePos(const Point &rPnt)
The relative position of a SdrObject is the distance of the upper left corner of the logic bounding r...
Definition: svdobj.cxx:1590
virtual std::unique_ptr< SdrObjGeoData > NewGeoData() const override
A derived class must override these 3 methods if it has own geometric data that must be saved for Und...
Definition: svdotext.cxx:1438
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:235
const Point & GetFixedTailPos() const
Definition: svdocapt.hxx:149
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:566
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:69