LibreOffice Module svx (master)  1
svdcrtv.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_SVDCRTV_HXX
21 #define INCLUDED_SVX_SVDCRTV_HXX
22 
23 #include <svx/svddrgv.hxx>
24 #include <svx/svxdllapi.h>
25 #include <memory>
26 
27 class XLineAttrSetItem;
28 class XFillAttrSetItem;
29 class SdrEdgeObj;
30 class SdrObjConnection;
31 
34 
36 {
37  friend class SdrPageView;
38 
39 protected:
40  SdrObject* pCurrentCreate; // The currently being created object
41  SdrPageView* pCreatePV; // Here, the creation is started
42  std::unique_ptr<ImplConnectMarkerOverlay> mpCoMaOverlay;
43 
44  // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
45  // compile the apps all the time
46  std::unique_ptr<ImpSdrCreateViewExtraData> mpCreateViewExtraData;
47 
49 
50  sal_Int32 nAutoCloseDistPix;
52  SdrInventor nCurrentInvent; // set the current ones
53  sal_uInt16 nCurrentIdent; // Obj for re-creating
54 
55  bool b1stPointAsCenter : 1;
56  bool bUseIncompatiblePathCreateInterface : 1;
57 
58  void ImpClearConnectMarker();
59 
60 private:
62 
63 protected:
64  bool ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
65  sal_Int16 nMinMov, const tools::Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
66 
67  void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
68  void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
69  bool CheckEdgeMode();
70 
71 protected:
72  // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
74  SdrModel& rSdrModel,
75  OutputDevice* pOut);
76 
77  virtual ~SdrCreateView() override;
78 
79 public:
80  virtual bool IsAction() const override;
81  virtual void MovAction(const Point& rPnt) override;
82  virtual void EndAction() override;
83  virtual void BckAction() override;
84  virtual void BrkAction() override;
85  virtual void TakeActionRect(tools::Rectangle& rRect) const override;
86 
87  virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
88 
89  void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; }
90 
91  // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
92  void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
93  void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
94  void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
95  void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
96 
97  // Determine whether a text tool is activated
98  bool IsTextTool() const;
99 
100  // Determine whether an object connector tool activated
101  bool IsEdgeTool() const;
102 
103  // Determine whether a measurement tool activated
104  bool IsMeasureTool() const;
105 
106  void SetCurrentObj(sal_uInt16 nIdent, SdrInventor nInvent=SdrInventor::Default);
107  void TakeCurrentObj(sal_uInt16& nIdent, SdrInventor& nInvent) const { nInvent=nCurrentInvent; nIdent=nCurrentIdent; }
108  SdrInventor GetCurrentObjInventor() const { return nCurrentInvent; }
109  sal_uInt16 GetCurrentObjIdentifier() const { return nCurrentIdent; }
110 
111  // Beginning the regular Create
112  bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=nullptr, short nMinMov=-3);
113  bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
114  void MovCreateObj(const Point& rPnt);
115  bool EndCreateObj(SdrCreateCmd eCmd);
116  void BckCreateObj(); // go back one polygon point
117  void BrkCreateObj();
118  bool IsCreateObj() const { return pCurrentCreate!=nullptr; }
119  SdrObject* GetCreateObj() const { return pCurrentCreate; }
120 
122  static void SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj);
123 
124  // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
125  // rObjSiz is the initial size of the legend text frame.
126  // Only the length of the tip is dragged
127  bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=nullptr, short nMinMov=-3);
128 
129  // Create a circle/rectangle/text frame with the first Point being
130  // the center of the object instead of the upper-left corner.
131  // Persistent flag. Default = FALSE.
132  bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
133  void SetCreate1stPointAsCenter(bool bOn) { b1stPointAsCenter = bOn; }
134 
135  // Default = 5 Pixel
136  sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
137 
138  // Setting for the minimum distance in pixels between 2 bezier points when
139  // creating a freehand line.
140  // Default = 10 Pixel
141  sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
142 
143  // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
144  // incompatible with the rest of the Create functionality of SvDraw, needs
145  // to set the following flag. It affects the following object types:
146  // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
147 
148  // This flag should be regarded as temporary. The affected applications should
149  // be changed soon.
150  // Default = sal_False;
151  bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
152  void SetUseIncompatiblePathCreateInterface(bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
153  void SetConnectMarker(const SdrObjConnection& rCon);
154  void HideConnectMarker();
155 
156  // Attributes of the object that is in the process of being created
157  /* new interface src537 */
158  void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
159 
160  bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
161  SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
162  void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
163 };
164 
165 #endif // INCLUDED_SVX_SVDCRTV_HXX
166 
167 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 nCurrentIdent
Definition: svdcrtv.hxx:53
void SetEditMode(SdrViewEditMode eMode)
Definition: svdmrkv.cxx:1621
std::unique_ptr< ImplConnectMarkerOverlay > mpCoMaOverlay
Definition: svdcrtv.hxx:42
Utility class SdrObjConnection.
Definition: svdoedge.hxx:38
virtual bool IsAction() const override
Definition: svddrgv.cxx:87
virtual void TakeActionRect(tools::Rectangle &rRect) const override
Definition: svddrgv.cxx:122
SfxStyleSheet * GetStyleSheet() const
Definition: svdedxv.cxx:2263
SdrViewEditMode
Definition: svdmrkv.hxx:72
sal_Int32 nFreeHandMinDistPix
Definition: svdcrtv.hxx:51
bool IsUseIncompatiblePathCreateInterface() const
Definition: svdcrtv.hxx:151
SdrInventor
Definition: svdobj.hxx:152
void TakeCurrentObj(sal_uInt16 &nIdent, SdrInventor &nInvent) const
Definition: svdcrtv.hxx:107
virtual bool MouseMove(const MouseEvent &rMEvt, OutputDevice *pWin) override
handle mouse over effects for handles
Definition: svdedxv.cxx:1904
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
sal_Int32 nAutoCloseDistPix
Definition: svdcrtv.hxx:50
void SetGluePointEditMode(bool bOn)
Definition: svdmrkv.hxx:223
void SetCreateMode(bool bOn)
Definition: svdmrkv.hxx:221
virtual void BckAction() override
Definition: svddrgv.cxx:110
SdrPageView * pCreatePV
Definition: svdcrtv.hxx:41
virtual void MovAction(const Point &rPnt) override
Definition: svddrgv.cxx:92
sal_uInt16 GetCurrentObjIdentifier() const
Definition: svdcrtv.hxx:109
void SetEditMode(SdrViewEditMode eMode)
Definition: svdcrtv.hxx:92
sal_uInt16 GetFreeHandMinDistPix() const
Definition: svdcrtv.hxx:141
virtual void EndAction() override
Definition: svddrgv.cxx:101
sal_uInt16 GetAutoCloseDistPix() const
Definition: svdcrtv.hxx:136
SdrObject * GetCreateObj() const
Definition: svdcrtv.hxx:119
SdrObject * pCurrentCreate
Definition: svdcrtv.hxx:40
PointerStyle aCurrentCreatePointer
Definition: svdcrtv.hxx:48
bool IsCreate1stPointAsCenter() const
Definition: svdcrtv.hxx:132
Abstract DrawObject.
Definition: svdobj.hxx:312
bool IsCreateObj() const
Definition: svdcrtv.hxx:118
SdrInventor nCurrentInvent
Definition: svdcrtv.hxx:52
void SetUseIncompatiblePathCreateInterface(bool bOn)
Definition: svdcrtv.hxx:152
void SetCreateMode(bool bOn=true)
Definition: svdcrtv.hxx:94
PointerStyle
void SetEditMode(bool bOn=true)
Definition: svdcrtv.hxx:93
virtual void BrkAction() override
Definition: svddrgv.cxx:116
bool SetAttributes(const SfxItemSet &rSet, bool bReplaceAll)
Definition: svdedxv.cxx:2115
std::unique_ptr< ImpSdrCreateViewExtraData > mpCreateViewExtraData
Definition: svdcrtv.hxx:46
void SetMeasureLayer(const OUString &rName)
Definition: svdcrtv.hxx:89
void SetStyleSheet(SfxStyleSheet *pStyleSheet, bool bDontRemoveHardAttr)
Definition: svdedxv.cxx:2284
SdrCreateCmd
Definition: svdtypes.hxx:27
void SetCreate1stPointAsCenter(bool bOn)
Definition: svdcrtv.hxx:133
void GetAttributes(SfxItemSet &rTargetSet, bool bOnlyHardAttr) const
Definition: svdedxv.cxx:2078
#define SVX_DLLPRIVATE
Definition: svxdllapi.h:30
void SetGluePointEditMode(bool bOn=true)
Definition: svdcrtv.hxx:95
SdrInventor GetCurrentObjInventor() const
Definition: svdcrtv.hxx:108
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:128
SVX_DLLPRIVATE void ImpClearVars()
Definition: svddrgv.cxx:51