1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDCRTV_HXX
21 #define INCLUDED_SVX_SVDCRTV_HXX
23 #include <svx/svddrgv.hxx>
24 #include <svx/svxdllapi.h>
27 class XLineAttrSetItem
;
28 class XFillAttrSetItem
;
30 class SdrObjConnection
;
32 class ImplConnectMarkerOverlay
;
33 class ImpSdrCreateViewExtraData
;
35 class SVXCORE_DLLPUBLIC SdrCreateView
: public SdrDragView
37 friend class SdrPageView
;
40 SdrObject
* pCurrentCreate
; // The currently being created object
41 SdrPageView
* pCreatePV
; // Here, the creation is started
42 std::unique_ptr
<ImplConnectMarkerOverlay
> mpCoMaOverlay
;
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
;
48 PointerStyle aCurrentCreatePointer
;
50 sal_Int32 nAutoCloseDistPix
;
51 sal_Int32 nFreeHandMinDistPix
;
52 SdrInventor nCurrentInvent
; // set the current ones
53 SdrObjKind nCurrentIdent
; // Obj for re-creating
55 bool b1stPointAsCenter
: 1;
56 bool bUseIncompatiblePathCreateInterface
: 1;
58 void ImpClearConnectMarker();
61 bool ImpBegCreateObj(SdrInventor nInvent
, SdrObjKind nIdent
, const Point
& rPnt
, OutputDevice
* pOut
,
62 sal_Int16 nMinMov
, const tools::Rectangle
& rLogRect
, SdrObject
* pPreparedFactoryObject
);
64 void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
65 void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
69 // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
74 virtual ~SdrCreateView() override
;
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
;
84 virtual bool MouseMove(const MouseEvent
& rMEvt
, OutputDevice
* pWin
) override
;
86 void SetMeasureLayer(const OUString
& rName
) { maMeasureLayer
=rName
; }
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(); }
94 // Determine whether a text tool is activated
95 bool IsTextTool() const;
97 // Determine whether an object connector tool activated
98 bool IsEdgeTool() const;
100 // Determine whether a measurement tool activated
101 bool IsMeasureTool() const;
103 void SetCurrentObj(SdrObjKind nIdent
, SdrInventor nInvent
=SdrInventor::Default
);
104 void TakeCurrentObj(SdrObjKind
& nIdent
, SdrInventor
& nInvent
) const { nInvent
=nCurrentInvent
; nIdent
=nCurrentIdent
; }
105 SdrInventor
GetCurrentObjInventor() const { return nCurrentInvent
; }
106 SdrObjKind
GetCurrentObjIdentifier() const { return nCurrentIdent
; }
108 // Beginning the regular Create
109 bool BegCreateObj(const Point
& rPnt
, OutputDevice
* pOut
=nullptr, short nMinMov
=-3);
110 bool BegCreatePreparedObject(const Point
& rPnt
, sal_Int16 nMinMov
, SdrObject
* pPreparedFactoryObject
);
111 void MovCreateObj(const Point
& rPnt
);
112 bool EndCreateObj(SdrCreateCmd eCmd
);
113 void BckCreateObj(); // go back one polygon point
115 bool IsCreateObj() const { return pCurrentCreate
!=nullptr; }
116 SdrObject
* GetCreateObj() const { return pCurrentCreate
; }
118 /// Setup layer (eg. foreground / background) of the given object.
119 static void SetupObjLayer(const SdrPageView
* pPageView
, const OUString
& aActiveLayer
, SdrObject
* pObj
);
121 // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
122 // rObjSiz is the initial size of the legend text frame.
123 // Only the length of the tip is dragged
124 bool BegCreateCaptionObj(const Point
& rPnt
, const Size
& rObjSiz
, OutputDevice
* pOut
=nullptr, short nMinMov
=-3);
126 // Create a circle/rectangle/text frame with the first Point being
127 // the center of the object instead of the upper-left corner.
128 // Persistent flag. Default = FALSE.
129 bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter
; }
130 void SetCreate1stPointAsCenter(bool bOn
) { b1stPointAsCenter
= bOn
; }
133 sal_uInt16
GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix
); }
135 // Setting for the minimum distance in pixels between 2 bezier points when
136 // creating a freehand line.
137 // Default = 10 Pixel
138 sal_uInt16
GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix
); }
140 // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
141 // incompatible with the rest of the Create functionality of SvDraw, needs
142 // to set the following flag. It affects the following object types:
143 // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
145 // This flag should be regarded as temporary. The affected applications should
147 // Default = sal_False;
148 bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface
; }
149 void SetUseIncompatiblePathCreateInterface(bool bOn
) { bUseIncompatiblePathCreateInterface
= bOn
; }
150 void SetConnectMarker(const SdrObjConnection
& rCon
);
151 void HideConnectMarker();
153 // Attributes of the object that is in the process of being created
154 /* new interface src537 */
155 void GetAttributes(SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
) const;
157 bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
);
158 SfxStyleSheet
* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
159 void SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
);
162 #endif // INCLUDED_SVX_SVDCRTV_HXX
164 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */