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>
26 class XLineAttrSetItem
;
27 class XFillAttrSetItem
;
29 class SdrObjConnection
;
31 class ImplConnectMarkerOverlay
;
32 class ImpSdrCreateViewExtraData
;
34 class SVX_DLLPUBLIC SdrCreateView
: public SdrDragView
36 friend class SdrPageView
;
39 SdrObject
* pAktCreate
; // Currently in creation of the located object
40 SdrPageView
* pCreatePV
; // Here, the creation is started
41 ImplConnectMarkerOverlay
* mpCoMaOverlay
;
43 // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
44 // compile the apps all the time
45 ImpSdrCreateViewExtraData
* mpCreateViewExtraData
;
47 Pointer aAktCreatePointer
;
49 sal_Int32 nAutoCloseDistPix
;
50 sal_Int32 nFreeHandMinDistPix
;
51 sal_uInt32 nAktInvent
; // set the current ones
52 sal_uInt16 nAktIdent
; // Obj for re-creating
54 bool bAutoTextEdit
: 1; // Textedit after we start the creation of a text frame
55 bool b1stPointAsCenter
: 1;
56 bool bUseIncompatiblePathCreateInterface
: 1;
57 bool bAutoClosePolys
: 1;
59 void ImpClearConnectMarker();
62 SVX_DLLPRIVATE
void ImpClearVars();
65 bool ImpBegCreateObj(sal_uInt32 nInvent
, sal_uInt16 nIdent
, const Point
& rPnt
, OutputDevice
* pOut
,
66 sal_Int16 nMinMov
, SdrPageView
* pPV
, const Rectangle
& rLogRect
, SdrObject
* pPreparedFactoryObject
);
68 void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
69 void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
73 // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
74 SdrCreateView(SdrModel
* pModel1
, OutputDevice
* pOut
= 0L);
75 virtual ~SdrCreateView();
78 virtual bool IsAction() const SAL_OVERRIDE
;
79 virtual void MovAction(const Point
& rPnt
) SAL_OVERRIDE
;
80 virtual void EndAction() SAL_OVERRIDE
;
81 virtual void BckAction() SAL_OVERRIDE
;
82 virtual void BrkAction() SAL_OVERRIDE
;
83 virtual void TakeActionRect(Rectangle
& rRect
) const SAL_OVERRIDE
;
85 virtual bool MouseMove(const MouseEvent
& rMEvt
, vcl::Window
* pWin
) SAL_OVERRIDE
;
87 void SetMeasureLayer(const OUString
& rName
) { aMeasureLayer
=rName
; }
88 const OUString
& GetMeasureLayer() const { return aMeasureLayer
; }
90 // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
91 void SetEditMode(SdrViewEditMode eMode
) { SdrDragView::SetEditMode(eMode
); CheckEdgeMode(); }
92 void SetEditMode(bool bOn
=true) { SdrDragView::SetEditMode(bOn
); CheckEdgeMode(); }
93 void SetCreateMode(bool bOn
=true) { SdrDragView::SetCreateMode(bOn
); CheckEdgeMode(); }
94 void SetGluePointEditMode(bool bOn
=true) { SdrDragView::SetGluePointEditMode(bOn
); CheckEdgeMode(); }
96 // Determine whether a text tool is activated
97 bool IsTextTool() const;
99 // Determine whether an object connector tool activated
100 bool IsEdgeTool() const;
102 // Determine whether a measurement tool activated
103 bool IsMeasureTool() const;
105 void SetCurrentObj(sal_uInt16 nIdent
, sal_uInt32 nInvent
=SdrInventor
);
106 void TakeCurrentObj(sal_uInt16
& nIdent
, sal_uInt32
& nInvent
) const { nInvent
=nAktInvent
; nIdent
=nAktIdent
; }
107 sal_uInt32
GetCurrentObjInventor() const { return nAktInvent
; }
108 sal_uInt16
GetCurrentObjIdentifier() const { return nAktIdent
; }
110 // Beginning the regular Create
111 bool BegCreateObj(const Point
& rPnt
, OutputDevice
* pOut
=NULL
, short nMinMov
=-3, SdrPageView
* pPV
=NULL
);
112 bool BegCreatePreparedObject(const Point
& rPnt
, sal_Int16 nMinMov
, SdrObject
* pPreparedFactoryObject
);
113 void MovCreateObj(const Point
& rPnt
);
114 bool EndCreateObj(SdrCreateCmd eCmd
);
115 void BckCreateObj(); // go back one polygon point
117 bool IsCreateObj() const { return pAktCreate
!=NULL
; }
118 SdrObject
* GetCreateObj() const { return pAktCreate
; }
120 // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
121 // rObjSiz is the initial size of the legend text frame.
122 // Only the length of the tip is dragged
123 bool BegCreateCaptionObj(const Point
& rPnt
, const Size
& rObjSiz
, OutputDevice
* pOut
=NULL
, short nMinMov
=-3, SdrPageView
* pPV
=NULL
);
125 // If TextEditAfterCreate is sal_True (the default),
126 // then after the creation of a TextFrame object (OBJ_TEXT,
127 // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
128 // automatically start a TextEdit (SdrObjEditView: SdrBeginTextEdit)
129 bool IsTextEditAfterCreate() const { return bAutoTextEdit
; }
130 void SetTextEditAfterCreate(bool bOn
) { bAutoTextEdit
= bOn
; }
132 // Create a circle/rectangle/text frame with the first Point being
133 // the center of the object instead of the upper-left corner.
134 // Persistent flag. Default = FALSE.
135 bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter
; }
136 void SetCreate1stPointAsCenter(bool bOn
) { b1stPointAsCenter
= bOn
; }
138 // For polylines (OBJ_PLIN) and freehand lines (OBJ_FREELINE). If this
139 // Flag is sal_True, these two types of objects are implicitly closed, and
140 // converted to Polygon (OBJ_POLY) or freehand fill (OBJ_FREEFILL) if
141 // the distance between the start point and end point of the
142 // Object <= nAutoCloseDistPix pixels.
144 bool IsAutoClosePolys() const { return bAutoClosePolys
; }
145 void SetAutoClosePolys(bool bOn
) { bAutoClosePolys
=bOn
; }
148 sal_uInt16
GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix
); }
149 void SetAutoCloseDistPix(sal_uInt16 nVal
) { nAutoCloseDistPix
=nVal
; }
151 // Setting for the minimum distantce in pixels between 2 bezier points when
152 // creating a freehand line.
153 // Default = 10 Pixel
154 sal_uInt16
GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix
); }
155 void SetFreeHandMinDistPix(sal_uInt16 nVal
) { nFreeHandMinDistPix
=nVal
; }
157 // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
158 // incompatible with the rest of the Create functionality of SvDraw, needs
159 // to set the following flag. It affects the following object types:
160 // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
162 // This flag should be regarded as temporary. The affected applications should
164 // Default = sal_False;
165 bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface
; }
166 void SetUseIncompatiblePathCreateInterface(bool bOn
) { bUseIncompatiblePathCreateInterface
= bOn
; }
167 void SetConnectMarker(const SdrObjConnection
& rCon
, const SdrPageView
& rPV
);
168 void HideConnectMarker();
170 // Attributes of the object that is in the process of being created
171 /* new interface src537 */
172 bool GetAttributes(SfxItemSet
& rTargetSet
, bool bOnlyHardAttr
=false) const;
174 bool SetAttributes(const SfxItemSet
& rSet
, bool bReplaceAll
);
175 SfxStyleSheet
* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
176 bool SetStyleSheet(SfxStyleSheet
* pStyleSheet
, bool bDontRemoveHardAttr
);
179 #endif // INCLUDED_SVX_SVDCRTV_HXX
181 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */