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 .
23 #include <svx/svddrgv.hxx>
24 #include "svx/svxdllapi.h"
26 //************************************************************
27 // Vorausdeklarationen
28 //************************************************************
30 class XLineAttrSetItem
;
31 class XFillAttrSetItem
;
33 class SdrObjConnection
;
35 ////////////////////////////////////////////////////////////////////////////////////////////////////
36 ////////////////////////////////////////////////////////////////////////////////////////////////////
38 // @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
39 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
40 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
41 // @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@
42 // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
43 // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
44 // @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
46 ////////////////////////////////////////////////////////////////////////////////////////////////////
47 ////////////////////////////////////////////////////////////////////////////////////////////////////
48 class ImplConnectMarkerOverlay
;
49 class ImpSdrCreateViewExtraData
;
51 class SVX_DLLPUBLIC SdrCreateView
: public SdrDragView
53 friend class SdrPageView
;
56 SdrObject
* pAktCreate
; // Currently in creation of the located object
57 SdrPageView
* pCreatePV
; // Here, the creation is started
58 ImplConnectMarkerOverlay
* mpCoMaOverlay
;
60 // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
61 // compile the apps all the time
62 ImpSdrCreateViewExtraData
* mpCreateViewExtraData
;
64 Pointer aAktCreatePointer
;
66 sal_Int32 nAutoCloseDistPix
;
67 sal_Int32 nFreeHandMinDistPix
;
68 sal_uInt32 nAktInvent
; // set the current ones
69 sal_uInt16 nAktIdent
; // Obj for re-creating
71 unsigned bAutoTextEdit
: 1; // Textedit after we start the creation of a text frame
72 unsigned b1stPointAsCenter
: 1;
73 unsigned bUseIncompatiblePathCreateInterface
: 1;
74 unsigned bAutoClosePolys
: 1;
76 void ImpClearConnectMarker();
79 SVX_DLLPRIVATE
void ImpClearVars();
82 sal_Bool
ImpBegCreateObj(sal_uInt32 nInvent
, sal_uInt16 nIdent
, const Point
& rPnt
, OutputDevice
* pOut
,
83 sal_Int16 nMinMov
, SdrPageView
* pPV
, const Rectangle
& rLogRect
, SdrObject
* pPreparedFactoryObject
);
85 void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
86 void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
87 sal_Bool
CheckEdgeMode();
90 // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
91 SdrCreateView(SdrModel
* pModel1
, OutputDevice
* pOut
= 0L);
92 virtual ~SdrCreateView();
95 virtual sal_Bool
IsAction() const;
96 virtual void MovAction(const Point
& rPnt
);
97 virtual void EndAction();
98 virtual void BckAction();
99 virtual void BrkAction();
100 virtual void TakeActionRect(Rectangle
& rRect
) const;
102 virtual sal_Bool
MouseMove(const MouseEvent
& rMEvt
, Window
* pWin
);
104 void SetActiveLayer(const String
& rName
) { aAktLayer
=rName
; }
105 const String
& GetActiveLayer() const { return aAktLayer
; }
106 void SetMeasureLayer(const String
& rName
) { aMeasureLayer
=rName
; }
107 const String
& GetMeasureLayer() const { return aMeasureLayer
; }
109 // If the MeasureLayer is not set (empty string), then
110 // use the active layer for measuring.
111 void SetEditMode(SdrViewEditMode eMode
) { SdrDragView::SetEditMode(eMode
); CheckEdgeMode(); }
112 void SetEditMode(sal_Bool bOn
=sal_True
) { SdrDragView::SetEditMode(bOn
); CheckEdgeMode(); }
113 void SetCreateMode(sal_Bool bOn
=sal_True
) { SdrDragView::SetCreateMode(bOn
); CheckEdgeMode(); }
114 void SetGluePointEditMode(sal_Bool bOn
=sal_True
) { SdrDragView::SetGluePointEditMode(bOn
); CheckEdgeMode(); }
116 // Determine whether a text tool is activated
117 bool IsTextTool() const;
119 // Determine whether an object connector tool activated
120 bool IsEdgeTool() const;
122 // Determine whether a measurement tool activated
123 bool IsMeasureTool() const;
125 void SetCurrentObj(sal_uInt16 nIdent
, sal_uInt32 nInvent
=SdrInventor
);
126 void TakeCurrentObj(sal_uInt16
& nIdent
, sal_uInt32
& nInvent
) const { nInvent
=nAktInvent
; nIdent
=nAktIdent
; }
127 sal_uInt32
GetCurrentObjInventor() const { return nAktInvent
; }
128 sal_uInt16
GetCurrentObjIdentifier() const { return nAktIdent
; }
130 // Starten des normalen Create
131 sal_Bool
BegCreateObj(const Point
& rPnt
, OutputDevice
* pOut
=NULL
, short nMinMov
=-3, SdrPageView
* pPV
=NULL
);
132 sal_Bool
BegCreatePreparedObject(const Point
& rPnt
, sal_Int16 nMinMov
, SdrObject
* pPreparedFactoryObject
);
133 void MovCreateObj(const Point
& rPnt
);
134 sal_Bool
EndCreateObj(SdrCreateCmd eCmd
);
135 void BckCreateObj(); // go back one polygon point
137 sal_Bool
IsCreateObj() const { return pAktCreate
!=NULL
; }
138 SdrObject
* GetCreateObj() const { return pAktCreate
; }
140 // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
141 // rObjSiz is the initial size of the legend text frame.
142 // only the length of the tip is dragged
143 sal_Bool
BegCreateCaptionObj(const Point
& rPnt
, const Size
& rObjSiz
, OutputDevice
* pOut
=NULL
, short nMinMov
=-3, SdrPageView
* pPV
=NULL
);
145 // If TextEditAfterCreate is sal_True (the default),
146 // then after the creation of a TextFrame object (OBJ_TEXT,
147 // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
148 // automatically start a TextEdit (SdrObjEditView: SdrBeginTextEdit)
149 sal_Bool
IsTextEditAfterCreate() const { return bAutoTextEdit
; }
150 void SetTextEditAfterCreate(sal_Bool bOn
) { bAutoTextEdit
= bOn
; }
152 // Create a circle / rectangle / text frame with the first Point being
153 // the center of the object instead of the upper-left corner.
154 // Persistent flag. Default = FALSE.
155 sal_Bool
IsCreate1stPointAsCenter() const { return b1stPointAsCenter
; }
156 void SetCreate1stPointAsCenter(sal_Bool bOn
) { b1stPointAsCenter
= bOn
; }
158 // For polylines (OBJ_PLIN) and freehand lines (OBJ_FREELINE). If this
159 // Flag is sal_True, these two types of objects are implicitly closed, and
160 // converted to Polygon (OBJ_POLY) or freehand fill (OBJ_FREEFILL) if
161 // the distance between the start point and end point of the
162 // Object <= nAutoCloseDistPix pixels.
164 sal_Bool
IsAutoClosePolys() const { return bAutoClosePolys
; }
165 void SetAutoClosePolys(sal_Bool bOn
) { bAutoClosePolys
=bOn
; }
168 sal_uInt16
GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix
); }
169 void SetAutoCloseDistPix(sal_uInt16 nVal
) { nAutoCloseDistPix
=nVal
; }
171 // Vorgabe des minimalen Pixelabstands zwischen 2 Bezierpunkten bei der
172 // Erzeugung einer Freihandlinie.
174 sal_uInt16
GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix
); }
175 void SetFreeHandMinDistPix(sal_uInt16 nVal
) { nFreeHandMinDistPix
=nVal
; }
177 // Wer das (zur restlichen Create-Funktionalitaet von SvDraw) inkompatible
178 // Create-Interface am PathObj beibehalten moechte muss das nachfolgende
179 // Flag setzen. Dieses wirkt sich aus bei den Objekttypen:
180 // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
181 // Dieses Flag hat nur voruebergehenden Character. Die betroffenen
182 // Applikationen sollten alsbald umgestellt werden.
183 // Default=sal_False;
184 sal_Bool
IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface
; }
185 void SetUseIncompatiblePathCreateInterface(sal_Bool bOn
) { bUseIncompatiblePathCreateInterface
= bOn
; }
186 void SetConnectMarker(const SdrObjConnection
& rCon
, const SdrPageView
& rPV
);
187 void HideConnectMarker();
189 // Attribute des ggf. gerade in der Erzeugung befindlichen Objekts
190 /* new interface src537 */
191 sal_Bool
GetAttributes(SfxItemSet
& rTargetSet
, sal_Bool bOnlyHardAttr
=sal_False
) const;
193 sal_Bool
SetAttributes(const SfxItemSet
& rSet
, sal_Bool bReplaceAll
);
194 SfxStyleSheet
* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
195 sal_Bool
SetStyleSheet(SfxStyleSheet
* pStyleSheet
, sal_Bool bDontRemoveHardAttr
);
198 #endif //_SVDCRTV_HXX
200 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */