xref: /trunk/main/svx/inc/svx/svdcrtv.hxx (revision 3334a7e6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVDCRTV_HXX
25 #define _SVDCRTV_HXX
26 
27 #include <svx/svddrgv.hxx>
28 #include "svx/svxdllapi.h"
29 
30 //************************************************************
31 //   Vorausdeklarationen
32 //************************************************************
33 
34 class XLineAttrSetItem;
35 class XFillAttrSetItem;
36 class SdrEdgeObj;
37 class SdrObjConnection;
38 
39 ////////////////////////////////////////////////////////////////////////////////////////////////////
40 ////////////////////////////////////////////////////////////////////////////////////////////////////
41 //
42 //   @@@@  @@@@@  @@@@@  @@@@  @@@@@@ @@@@@  @@ @@ @@ @@@@@ @@   @@
43 //  @@  @@ @@  @@ @@    @@  @@   @@   @@     @@ @@ @@ @@    @@   @@
44 //  @@     @@  @@ @@    @@  @@   @@   @@     @@ @@ @@ @@    @@ @ @@
45 //  @@     @@@@@  @@@@  @@@@@@   @@   @@@@   @@@@@ @@ @@@@  @@@@@@@
46 //  @@     @@  @@ @@    @@  @@   @@   @@      @@@  @@ @@    @@@@@@@
47 //  @@  @@ @@  @@ @@    @@  @@   @@   @@      @@@  @@ @@    @@@ @@@
48 //   @@@@  @@  @@ @@@@@ @@  @@   @@   @@@@@    @   @@ @@@@@ @@   @@
49 //
50 ////////////////////////////////////////////////////////////////////////////////////////////////////
51 ////////////////////////////////////////////////////////////////////////////////////////////////////
52 class ImplConnectMarkerOverlay;
53 class ImpSdrCreateViewExtraData;
54 
55 class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
56 {
57 	friend class				SdrPageView;
58 
59 protected:
60 	SdrObject*					pAktCreate;   // Aktuell in Erzeugung befindliches Objekt
61 	SdrPageView*				pCreatePV;    // Hier wurde die Erzeugung gestartet
62 	ImplConnectMarkerOverlay*	mpCoMaOverlay;
63 
64 	// for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
65 	// compile the apps all the time
66 	ImpSdrCreateViewExtraData*	mpCreateViewExtraData;
67 
68 	Pointer						aAktCreatePointer;
69 
70 	sal_Int32						nAutoCloseDistPix;
71 	sal_Int32						nFreeHandMinDistPix;
72 	sal_uInt32						nAktInvent;     // Aktuell eingestelltes
73 	sal_uInt16						nAktIdent;      // Obj fuer Neuerzeugung
74 
75 	unsigned					bAutoTextEdit : 1; // Textedit nach dem erzeugen eines Textrahmens starten
76 	unsigned					b1stPointAsCenter : 1;
77 	unsigned					bUseIncompatiblePathCreateInterface : 1;
78 	unsigned					bAutoClosePolys : 1;
79 
80 	void ImpClearConnectMarker();
81 
82 private:
83 	SVX_DLLPRIVATE void ImpClearVars();
84 	SVX_DLLPRIVATE void ImpMakeCreateAttr();
85 	SVX_DLLPRIVATE void ImpDelCreateAttr();
86 
87 protected:
88 	sal_Bool ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
89 		sal_Int16 nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
90 
91 	void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
92 	void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
93 	sal_Bool CheckEdgeMode();
94 
95 protected:
96 	// #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
97 	SdrCreateView(SdrModel* pModel1, OutputDevice* pOut = 0L);
98 	virtual ~SdrCreateView();
99 
100 public:
101 	virtual sal_Bool IsAction() const;
102 	virtual void MovAction(const Point& rPnt);
103 	virtual void EndAction();
104 	virtual void BckAction();
105 	virtual void BrkAction();
106 	virtual void TakeActionRect(Rectangle& rRect) const;
107 
108 	virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
109 
SetActiveLayer(const String & rName)110 	void SetActiveLayer(const String& rName) { aAktLayer=rName; }
GetActiveLayer() const111 	const String& GetActiveLayer() const { return aAktLayer; }
SetMeasureLayer(const String & rName)112 	void SetMeasureLayer(const String& rName) { aMeasureLayer=rName; }
GetMeasureLayer() const113 	const String& GetMeasureLayer() const { return aMeasureLayer; }
114 
115 	// Ist der MeasureLayer nicht gesetzt (Leerstring), so
116 	// wird der ActiveLayer auch fuer Bemassung verwendet.
SetEditMode(SdrViewEditMode eMode)117 	void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
SetEditMode(sal_Bool bOn=sal_True)118 	void SetEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
SetCreateMode(sal_Bool bOn=sal_True)119 	void SetCreateMode(sal_Bool bOn=sal_True) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
SetGluePointEditMode(sal_Bool bOn=sal_True)120 	void SetGluePointEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
121 
122 	// Feststellen, ob Textwerkzeug aktiviert
123 	sal_Bool IsTextTool() const;
124 
125 	// Feststellen, ob Objektverbinderwerkzeug aktiviert
126 	sal_Bool IsEdgeTool() const;
127 
128 	// Feststellen, ob Bemassungswerkzeug aktiviert
129 	sal_Bool IsMeasureTool() const;
130 
131 	void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor);
TakeCurrentObj(sal_uInt16 & nIdent,sal_uInt32 & nInvent) const132 	void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const  { nInvent=nAktInvent; nIdent=nAktIdent; }
GetCurrentObjInventor() const133 	sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; }
GetCurrentObjIdentifier() const134 	sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
135 
136 	// Starten des normalen Create
137 	sal_Bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
138 	sal_Bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
139 	void MovCreateObj(const Point& rPnt);
140 	sal_Bool EndCreateObj(SdrCreateCmd eCmd);
141 	void BckCreateObj();  // z.B. wieder 1 Polygonpunkt zurueck.
142 	void BrkCreateObj();
IsCreateObj() const143 	sal_Bool IsCreateObj() const { return pAktCreate!=NULL; }
GetCreateObj() const144 	SdrObject* GetCreateObj() const { return pAktCreate; }
145 
146 	// BegCreateCaptionObj() erzeugt ein SdrCaptionObj (Legendenobjekt).
147 	// rObjSiz ist die anfaengliche Groesse des Legenden-Textrahmens.
148 	// gedraggd wird lediglich die Laenge des Zipfel.
149 	sal_Bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
150 
151 	// Wenn TextEditAfterCreate auf sal_True steht (das ist der Default),
152 	// dann wird nach dem erzeugen eines Textrahmenobjekts (OBJ_TEXT,
153 	// OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
154 	// automatisch ein TextEdit (SdrObjEditView::SdrBeginTextEdit) gestartet.
IsTextEditAfterCreate() const155 	sal_Bool IsTextEditAfterCreate() const { return bAutoTextEdit; }
SetTextEditAfterCreate(sal_Bool bOn)156 	void SetTextEditAfterCreate(sal_Bool bOn) { bAutoTextEdit = bOn; }
157 
158 	// Erzeugen eines Kreises/Rechtecks/Textrahmens wobei der 1. Punkt
159 	// nicht die linke obere Ecke, sondern das Zentrum des Objekts vorgibt.
160 	// Persistentes Flag. Default=FALSE.
IsCreate1stPointAsCenter() const161 	sal_Bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
SetCreate1stPointAsCenter(sal_Bool bOn)162 	void SetCreate1stPointAsCenter(sal_Bool bOn) { b1stPointAsCenter = bOn; }
163 
164 	// Fuer Polylines (OBJ_PLIN) und Freihandlinien (OBJ_FREELINE). Ist dieses
165 	// Flag sal_True, werden diese beiden Objekttypen implizit geschlossen und in
166 	// Polygon (OBJ_POLY) bzw. Freihandflaeche (OBJ_FREEFILL) gewandelt falls
167 	// zum Ende des Create die Distanz zwischen Startpunkt und Endpunkt des
168 	// Objekts <=n Pixel ist, wobei SetAutoCloseDistPix vorgegeben wird.
169 	// Default=TRUE.
IsAutoClosePolys() const170 	sal_Bool IsAutoClosePolys() const { return bAutoClosePolys; }
SetAutoClosePolys(sal_Bool bOn)171 	void SetAutoClosePolys(sal_Bool bOn) { bAutoClosePolys=bOn; }
172 
173 	// Default=5 Pixel.
GetAutoCloseDistPix() const174 	sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
SetAutoCloseDistPix(sal_uInt16 nVal)175 	void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; }
176 
177 	// Vorgabe des minimalen Pixelabstands zwischen 2 Bezierpunkten bei der
178 	// Erzeugung einer Freihandlinie.
179 	// Default=10 Pixel.
GetFreeHandMinDistPix() const180 	sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
SetFreeHandMinDistPix(sal_uInt16 nVal)181 	void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; }
182 
183 	// Wer das (zur restlichen Create-Funktionalitaet von SvDraw) inkompatible
184 	// Create-Interface am PathObj beibehalten moechte muss das nachfolgende
185 	// Flag setzen. Dieses wirkt sich aus bei den Objekttypen:
186 	//     OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
187 	// Dieses Flag hat nur voruebergehenden Character. Die betroffenen
188 	// Applikationen sollten alsbald umgestellt werden.
189 	// Default=sal_False;
IsUseIncompatiblePathCreateInterface() const190 	sal_Bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
SetUseIncompatiblePathCreateInterface(sal_Bool bOn)191 	void SetUseIncompatiblePathCreateInterface(sal_Bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
192 	void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
193 	void HideConnectMarker();
194 
195 	// Attribute des ggf. gerade in der Erzeugung befindlichen Objekts
196 	/* new interface src537 */
197 	sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
198 
199 	sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
200 	SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
201 	sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
202 };
203 
204 #endif //_SVDCRTV_HXX
205 
206