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