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 #pragma once
21 
22 #include <svx/svdorect.hxx>
23 #include <svx/svxdllapi.h>
24 
25 
26 // Forward Declarations
27 class ImpCaptParams;
28 
29 namespace sdr::properties {
30  class CaptionProperties;
31 }
32 
33 // Helper Class SdrCaptObjGeoData
35 {
36 public:
38 };
39 
40 // SdrCaptionObj
42 {
43 private:
44  // to allow sdr::properties::CaptionProperties access to ImpRecalcTail()
46  friend class SdrTextObj; // for ImpRecalcTail() during AutoGrow
47 
48  // tdf#118662 exclusive friend function and setter for SuppressGetBitmap
49  friend void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj* pSdrCaptionObj, bool bValue);
50  void setSuppressGetBitmap(bool bNew)
51  {
52  mbSuppressGetBitmap = bNew;
53  }
54 
55  virtual std::unique_ptr<sdr::properties::BaseProperties> CreateObjectSpecificProperties() override;
56  virtual std::unique_ptr<sdr::contact::ViewContact> CreateObjectSpecificViewContact() override;
57 
58  tools::Polygon aTailPoly; // the whole tail polygon
59  bool mbSpecialTextBoxShadow; // for calc special shadow, default FALSE
60  bool mbFixedTail; // for calc note box fixed tail, default FALSE
61  bool mbSuppressGetBitmap; // tdf#118662
62  Point maFixedTailPos; // for calc note box fixed tail position.
63 
64  SVX_DLLPRIVATE void ImpGetCaptParams(ImpCaptParams& rPara) const;
65  SVX_DLLPRIVATE static void ImpCalcTail1(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
66  SVX_DLLPRIVATE static void ImpCalcTail2(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
67  SVX_DLLPRIVATE static void ImpCalcTail3(const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
68  SVX_DLLPRIVATE static void ImpCalcTail (const ImpCaptParams& rPara, tools::Polygon& rPoly, tools::Rectangle const & rRect);
69  SVX_DLLPRIVATE void ImpRecalcTail();
70 
71  // protected destructor
72  virtual ~SdrCaptionObj() override;
73 
74 public:
75  SdrCaptionObj(SdrModel& rSdrModel);
76  // Copy constructor
77  SdrCaptionObj(SdrModel& rSdrModel, SdrCaptionObj const & rSource);
79  SdrModel& rSdrModel,
80  const tools::Rectangle& rRect,
81  const Point& rTail);
82 
83  // tdf#118662 getter for SuppressGetBitmap
84  bool isSuppressGetBitmap() const { return mbSuppressGetBitmap; }
85 
86  virtual void TakeObjInfo(SdrObjTransformInfoRec& rInfo) const override;
87  virtual SdrObjKind GetObjIdentifier() const override;
88  virtual SdrCaptionObj* CloneSdrObject(SdrModel& rTargetModel) const override;
89 
90  // for calc: special shadow only for text box
91  void SetSpecialTextBoxShadow() { mbSpecialTextBoxShadow = true; }
92  bool GetSpecialTextBoxShadow() const { return mbSpecialTextBoxShadow; }
93 
94  // for calc: fixed note tail position.
95  void SetFixedTail() { mbFixedTail = true; }
96 
97  virtual OUString TakeObjNameSingul() const override;
98  virtual OUString TakeObjNamePlural() const override;
99 
100  virtual basegfx::B2DPolyPolygon TakeXorPoly() const override;
101  virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override;
102 
103  virtual sal_uInt32 GetHdlCount() const override;
104  virtual void AddToHdlList(SdrHdlList& rHdlList) const override;
105 
106  // special drag methods
107  virtual bool hasSpecialDrag() const override;
108  virtual bool beginSpecialDrag(SdrDragStat& rDrag) const override;
109  virtual bool applySpecialDrag(SdrDragStat& rDrag) override;
110  virtual OUString getSpecialDragComment(const SdrDragStat& rDrag) const override;
111 
112  virtual bool BegCreate(SdrDragStat& rStat) override;
113  virtual bool MovCreate(SdrDragStat& rStat) override;
114  virtual bool EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) override;
115  virtual bool BckCreate(SdrDragStat& rStat) override;
116  virtual void BrkCreate(SdrDragStat& rStat) override;
117  virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat& rDrag) const override;
118  virtual PointerStyle GetCreatePointer() const override;
119 
120  virtual void NbcMove(const Size& rSiz) override;
121  virtual void NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact) override;
122 
123  virtual void NbcSetRelativePos(const Point& rPnt) override;
124  virtual Point GetRelativePos() const override;
125 
126  virtual const tools::Rectangle& GetLogicRect() const override;
127  virtual void NbcSetLogicRect(const tools::Rectangle& rRect) override;
128 
129  virtual sal_uInt32 GetSnapPointCount() const override;
130  virtual Point GetSnapPoint(sal_uInt32 i) const override;
131 
132 private:
133  virtual std::unique_ptr<SdrObjGeoData> NewGeoData() const override;
134  virtual void SaveGeoData(SdrObjGeoData& rGeo) const override;
135  virtual void RestoreGeoData(const SdrObjGeoData& rGeo) override;
136 
137 public:
138  virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override;
139 
140  const Point& GetTailPos() const;
141  void SetTailPos(const Point& rPos);
142  void NbcSetTailPos(const Point& rPos);
143 
144  // #i32599#
145  // Add own implementation for TRSetBaseGeometry to handle TailPos over changes
146  virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix& rMatrix, const basegfx::B2DPolyPolygon& rPolyPolygon) override;
147 
148  const Point& GetFixedTailPos() const {return maFixedTailPos;}
149 
150  // geometry access
151  ::basegfx::B2DPolygon getTailPolygon() const;
152 };
153 
154 /* 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:446
virtual bool applySpecialDrag(SdrDragStat &rDrag) override
Definition: svdorect.cxx:362
void SetSpecialTextBoxShadow()
Definition: svdocapt.hxx:91
virtual void RestoreGeoData(const SdrObjGeoData &rGeo) override
Definition: svdorect.cxx:562
virtual std::unique_ptr< sdr::properties::BaseProperties > CreateObjectSpecificProperties() override
Definition: svdorect.cxx:40
virtual sal_uInt32 GetSnapPointCount() const override
snap to special points of an Object (polygon points, center of circle)
Definition: svdotext.cxx:1124
virtual OUString getSpecialDragComment(const SdrDragStat &rDrag) const override
Definition: svdorect.cxx:391
bool mbSpecialTextBoxShadow
Definition: svdocapt.hxx:59
Point maFixedTailPos
Definition: svdocapt.hxx:62
virtual OUString TakeObjNameSingul() const override
Definition: svdorect.cxx:201
bool mbSuppressGetBitmap
Definition: svdocapt.hxx:61
virtual Point GetRelativePos() const
Definition: svdobj.cxx:1629
bool mbFixedTail
Definition: svdocapt.hxx:60
virtual basegfx::B2DPolyPolygon TakeXorPoly() const override
The Xor-Polygon is required by the View to drag the object.
Definition: svdorect.cxx:253
virtual void TRSetBaseGeometry(const basegfx::B2DHomMatrix &rMatrix, const basegfx::B2DPolyPolygon &rPolyPolygon) override
Definition: svdotext.cxx:1599
virtual basegfx::B2DPolyPolygon TakeCreatePoly(const SdrDragStat &rDrag) const override
Polygon dragged by the user when creating the object.
Definition: svdorect.cxx:429
All geometrical data of an arbitrary object for use in undo/redo.
Definition: svdobj.hxx:173
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:38
Provides information about various ZObject properties.
Definition: svdobj.hxx:195
void SetFixedTail()
Definition: svdocapt.hxx:95
virtual bool hasSpecialDrag() const override
The standard transformations (Move,Resize,Rotate,Mirror,Shear) are taken over by the View (TakeXorPol...
Definition: svdorect.cxx:343
virtual bool beginSpecialDrag(SdrDragStat &rDrag) const override
Definition: svdorect.cxx:348
virtual bool BckCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:225
virtual void SaveGeoData(SdrObjGeoData &rGeo) const override
Definition: svdotext.cxx:1408
bool GetSpecialTextBoxShadow() const
Definition: svdocapt.hxx:92
virtual SdrObjectUniquePtr DoConvertToPolyObj(bool bBezier, bool bAddText) const override
Definition: svdorect.cxx:528
tools::Polygon aTailPoly
Definition: svdocapt.hxx:37
virtual sal_uInt32 GetHdlCount() const override
Via GetHdlCount the number of Handles can be retrieved.
Definition: svdorect.cxx:282
void setSuppressGetBitmap(bool bNew)
Definition: svdocapt.hxx:50
virtual void BrkCreate(SdrDragStat &rStat) override
Definition: svdotxdr.cxx:221
void setSuppressGetBitmapFromXclObjComment(SdrCaptionObj *pSdrCaptionObj, bool bValue)
tools::Polygon aTailPoly
Definition: svdocapt.hxx:58
virtual PointerStyle GetCreatePointer() const override
get the cursor/pointer that signals creating this object
Definition: svdorect.cxx:440
virtual void TakeObjInfo(SdrObjTransformInfoRec &rInfo) const override
Definition: svdorect.cxx:146
virtual void NbcSetLogicRect(const tools::Rectangle &rRect) override
Definition: svdorect.cxx:276
virtual SdrRectObj * CloneSdrObject(SdrModel &rTargetModel) const override
Definition: svdorect.cxx:248
virtual SdrObjKind GetObjIdentifier() const override
Definition: svdorect.cxx:172
bool isSuppressGetBitmap() const
Definition: svdocapt.hxx:84
virtual std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact() override
Definition: svdorect.cxx:48
virtual void NbcResize(const Point &rRef, const Fraction &xFact, const Fraction &yFact) override
Definition: svdorect.cxx:452
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
std::unique_ptr< SdrObject, SdrObjectFreeOp > SdrObjectUniquePtr
Definition: svdobj.hxx:97
PointerStyle
virtual void AddToHdlList(SdrHdlList &rHdlList) const override
Definition: svdorect.cxx:287
virtual Point GetSnapPoint(sal_uInt32 i) const override
Definition: svdotext.cxx:1129
virtual bool EndCreate(SdrDragStat &rStat, SdrCreateCmd eCmd) override
Definition: svdotxdr.cxx:207
SdrCreateCmd
Definition: svdtypes.hxx:26
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:1611
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:1403
virtual OUString TakeObjNamePlural() const override
Definition: svdorect.cxx:227
const Point & GetFixedTailPos() const
Definition: svdocapt.hxx:148
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Detects when a stylesheet is changed.
Definition: svdorect.cxx:556
virtual const tools::Rectangle & GetLogicRect() const override
Definition: svdotxtr.cxx:69