Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _SVDCRTV_HXX
30 : : #define _SVDCRTV_HXX
31 : :
32 : : #include <svx/svddrgv.hxx>
33 : : #include "svx/svxdllapi.h"
34 : :
35 : : //************************************************************
36 : : // Vorausdeklarationen
37 : : //************************************************************
38 : :
39 : : class XLineAttrSetItem;
40 : : class XFillAttrSetItem;
41 : : class SdrEdgeObj;
42 : : class SdrObjConnection;
43 : :
44 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
45 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
46 : : //
47 : : // @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@
48 : : // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@
49 : : // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@
50 : : // @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@
51 : : // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@
52 : : // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@
53 : : // @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@
54 : : //
55 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
56 : : ////////////////////////////////////////////////////////////////////////////////////////////////////
57 : : class ImplConnectMarkerOverlay;
58 : : class ImpSdrCreateViewExtraData;
59 : :
60 : : class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
61 : : {
62 : : friend class SdrPageView;
63 : :
64 : : protected:
65 : : SdrObject* pAktCreate; // Currently in creation of the located object
66 : : SdrPageView* pCreatePV; // Here, the creation is started
67 : : ImplConnectMarkerOverlay* mpCoMaOverlay;
68 : :
69 : : // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
70 : : // compile the apps all the time
71 : : ImpSdrCreateViewExtraData* mpCreateViewExtraData;
72 : :
73 : : Pointer aAktCreatePointer;
74 : :
75 : : sal_Int32 nAutoCloseDistPix;
76 : : sal_Int32 nFreeHandMinDistPix;
77 : : sal_uInt32 nAktInvent; // set the current ones
78 : : sal_uInt16 nAktIdent; // Obj for re-creating
79 : :
80 : : unsigned bAutoTextEdit : 1; // Textedit after we start the creation of a text frame
81 : : unsigned b1stPointAsCenter : 1;
82 : : unsigned bUseIncompatiblePathCreateInterface : 1;
83 : : unsigned bAutoClosePolys : 1;
84 : :
85 : : void ImpClearConnectMarker();
86 : :
87 : : private:
88 : : SVX_DLLPRIVATE void ImpClearVars();
89 : :
90 : : protected:
91 : : sal_Bool ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
92 : : sal_Int16 nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
93 : :
94 : : void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
95 : : void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
96 : : sal_Bool CheckEdgeMode();
97 : :
98 : : protected:
99 : : // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
100 : : SdrCreateView(SdrModel* pModel1, OutputDevice* pOut = 0L);
101 : : virtual ~SdrCreateView();
102 : :
103 : : public:
104 : : virtual sal_Bool IsAction() const;
105 : : virtual void MovAction(const Point& rPnt);
106 : : virtual void EndAction();
107 : : virtual void BckAction();
108 : : virtual void BrkAction();
109 : : virtual void TakeActionRect(Rectangle& rRect) const;
110 : :
111 : : virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
112 : :
113 : 1997 : void SetActiveLayer(const String& rName) { aAktLayer=rName; }
114 : 9711 : const String& GetActiveLayer() const { return aAktLayer; }
115 : 390 : void SetMeasureLayer(const String& rName) { aMeasureLayer=rName; }
116 : : const String& GetMeasureLayer() const { return aMeasureLayer; }
117 : :
118 : : // If the MeasureLayer is not set (empty string), then
119 : : // use the active layer for measuring.
120 : 405 : void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
121 : 0 : void SetEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
122 : 0 : void SetCreateMode(sal_Bool bOn=sal_True) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
123 : 0 : void SetGluePointEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
124 : :
125 : : // Determine whether a text tool is activated
126 : : sal_Bool IsTextTool() const;
127 : :
128 : : // Determine whether an object connector tool activated
129 : : sal_Bool IsEdgeTool() const;
130 : :
131 : : // Determine whether a measurement tool activated
132 : : sal_Bool IsMeasureTool() const;
133 : :
134 : : void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor);
135 : 0 : void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; }
136 : 0 : sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; }
137 : 2249 : sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
138 : :
139 : : // Starten des normalen Create
140 : : sal_Bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
141 : : sal_Bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
142 : : void MovCreateObj(const Point& rPnt);
143 : : sal_Bool EndCreateObj(SdrCreateCmd eCmd);
144 : : void BckCreateObj(); // go back one polygon point
145 : : void BrkCreateObj();
146 : 0 : sal_Bool IsCreateObj() const { return pAktCreate!=NULL; }
147 : 0 : SdrObject* GetCreateObj() const { return pAktCreate; }
148 : :
149 : : // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
150 : : // rObjSiz is the initial size of the legend text frame.
151 : : // only the length of the tip is dragged
152 : : sal_Bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
153 : :
154 : : // If TextEditAfterCreate is sal_True (the default),
155 : : // then after the creation of a TextFrame object (OBJ_TEXT,
156 : : // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
157 : : // automatically start a TextEdit (SdrObjEditView: SdrBeginTextEdit)
158 : : sal_Bool IsTextEditAfterCreate() const { return bAutoTextEdit; }
159 : : void SetTextEditAfterCreate(sal_Bool bOn) { bAutoTextEdit = bOn; }
160 : :
161 : : // Create a circle / rectangle / text frame with the first Point being
162 : : // the center of the object instead of the upper-left corner.
163 : : // Persistent flag. Default = FALSE.
164 : 0 : sal_Bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
165 : 0 : void SetCreate1stPointAsCenter(sal_Bool bOn) { b1stPointAsCenter = bOn; }
166 : :
167 : : // For polylines (OBJ_PLIN) and freehand lines (OBJ_FREELINE). If this
168 : : // Flag is sal_True, these two types of objects are implicitly closed, and
169 : : // converted to Polygon (OBJ_POLY) or freehand fill (OBJ_FREEFILL) if
170 : : // the distance between the start point and end point of the
171 : : // Object <= nAutoCloseDistPix pixels.
172 : : // Default is TRUE.
173 : : sal_Bool IsAutoClosePolys() const { return bAutoClosePolys; }
174 : : void SetAutoClosePolys(sal_Bool bOn) { bAutoClosePolys=bOn; }
175 : :
176 : : // Default=5 Pixel.
177 : : sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
178 : : void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; }
179 : :
180 : : // Vorgabe des minimalen Pixelabstands zwischen 2 Bezierpunkten bei der
181 : : // Erzeugung einer Freihandlinie.
182 : : // Default=10 Pixel.
183 : : sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
184 : : void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; }
185 : :
186 : : // Wer das (zur restlichen Create-Funktionalitaet von SvDraw) inkompatible
187 : : // Create-Interface am PathObj beibehalten moechte muss das nachfolgende
188 : : // Flag setzen. Dieses wirkt sich aus bei den Objekttypen:
189 : : // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
190 : : // Dieses Flag hat nur voruebergehenden Character. Die betroffenen
191 : : // Applikationen sollten alsbald umgestellt werden.
192 : : // Default=sal_False;
193 : : sal_Bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
194 : 1727 : void SetUseIncompatiblePathCreateInterface(sal_Bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
195 : : void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
196 : : void HideConnectMarker();
197 : :
198 : : // Attribute des ggf. gerade in der Erzeugung befindlichen Objekts
199 : : /* new interface src537 */
200 : : sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
201 : :
202 : : sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
203 : : SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
204 : : sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
205 : : };
206 : :
207 : : #endif //_SVDCRTV_HXX
208 : :
209 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|