Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVDCRTV_HXX
21 : #define _SVDCRTV_HXX
22 :
23 : #include <svx/svddrgv.hxx>
24 : #include "svx/svxdllapi.h"
25 :
26 : class XLineAttrSetItem;
27 : class XFillAttrSetItem;
28 : class SdrEdgeObj;
29 : class SdrObjConnection;
30 :
31 : class ImplConnectMarkerOverlay;
32 : class ImpSdrCreateViewExtraData;
33 :
34 : class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
35 : {
36 : friend class SdrPageView;
37 :
38 : protected:
39 : SdrObject* pAktCreate; // Currently in creation of the located object
40 : SdrPageView* pCreatePV; // Here, the creation is started
41 : ImplConnectMarkerOverlay* mpCoMaOverlay;
42 :
43 : // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
44 : // compile the apps all the time
45 : ImpSdrCreateViewExtraData* mpCreateViewExtraData;
46 :
47 : Pointer aAktCreatePointer;
48 :
49 : sal_Int32 nAutoCloseDistPix;
50 : sal_Int32 nFreeHandMinDistPix;
51 : sal_uInt32 nAktInvent; // set the current ones
52 : sal_uInt16 nAktIdent; // Obj for re-creating
53 :
54 : unsigned bAutoTextEdit : 1; // Textedit after we start the creation of a text frame
55 : unsigned b1stPointAsCenter : 1;
56 : unsigned bUseIncompatiblePathCreateInterface : 1;
57 : unsigned bAutoClosePolys : 1;
58 :
59 : void ImpClearConnectMarker();
60 :
61 : private:
62 : SVX_DLLPRIVATE void ImpClearVars();
63 :
64 : protected:
65 : sal_Bool ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
66 : sal_Int16 nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
67 :
68 : void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
69 : void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/);
70 : sal_Bool CheckEdgeMode();
71 :
72 : protected:
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();
76 :
77 : public:
78 : virtual sal_Bool IsAction() const;
79 : virtual void MovAction(const Point& rPnt);
80 : virtual void EndAction();
81 : virtual void BckAction();
82 : virtual void BrkAction();
83 : virtual void TakeActionRect(Rectangle& rRect) const;
84 :
85 : virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
86 :
87 1229 : void SetActiveLayer(const String& rName) { aAktLayer=rName; }
88 4277 : const String& GetActiveLayer() const { return aAktLayer; }
89 198 : void SetMeasureLayer(const String& rName) { aMeasureLayer=rName; }
90 : const String& GetMeasureLayer() const { return aMeasureLayer; }
91 :
92 : // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
93 203 : void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
94 0 : void SetEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
95 0 : void SetCreateMode(sal_Bool bOn=sal_True) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
96 0 : void SetGluePointEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
97 :
98 : // Determine whether a text tool is activated
99 : bool IsTextTool() const;
100 :
101 : // Determine whether an object connector tool activated
102 : bool IsEdgeTool() const;
103 :
104 : // Determine whether a measurement tool activated
105 : bool IsMeasureTool() const;
106 :
107 : void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor);
108 0 : void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; }
109 0 : sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; }
110 0 : sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
111 :
112 : // Beginning the regular Create
113 : sal_Bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
114 : sal_Bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
115 : void MovCreateObj(const Point& rPnt);
116 : sal_Bool EndCreateObj(SdrCreateCmd eCmd);
117 : void BckCreateObj(); // go back one polygon point
118 : void BrkCreateObj();
119 203 : sal_Bool IsCreateObj() const { return pAktCreate!=NULL; }
120 0 : SdrObject* GetCreateObj() const { return pAktCreate; }
121 :
122 : // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
123 : // rObjSiz is the initial size of the legend text frame.
124 : // Only the length of the tip is dragged
125 : sal_Bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL);
126 :
127 : // If TextEditAfterCreate is sal_True (the default),
128 : // then after the creation of a TextFrame object (OBJ_TEXT,
129 : // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION)
130 : // automatically start a TextEdit (SdrObjEditView: SdrBeginTextEdit)
131 0 : sal_Bool IsTextEditAfterCreate() const { return bAutoTextEdit; }
132 : void SetTextEditAfterCreate(sal_Bool bOn) { bAutoTextEdit = bOn; }
133 :
134 : // Create a circle/rectangle/text frame with the first Point being
135 : // the center of the object instead of the upper-left corner.
136 : // Persistent flag. Default = FALSE.
137 0 : sal_Bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
138 0 : void SetCreate1stPointAsCenter(sal_Bool bOn) { b1stPointAsCenter = bOn; }
139 :
140 : // For polylines (OBJ_PLIN) and freehand lines (OBJ_FREELINE). If this
141 : // Flag is sal_True, these two types of objects are implicitly closed, and
142 : // converted to Polygon (OBJ_POLY) or freehand fill (OBJ_FREEFILL) if
143 : // the distance between the start point and end point of the
144 : // Object <= nAutoCloseDistPix pixels.
145 : // Default = TRUE.
146 0 : sal_Bool IsAutoClosePolys() const { return bAutoClosePolys; }
147 : void SetAutoClosePolys(sal_Bool bOn) { bAutoClosePolys=bOn; }
148 :
149 : // Default = 5 Pixel
150 0 : sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
151 : void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; }
152 :
153 : // Setting for the minimum distantce in pixels between 2 bezier points when
154 : // creating a freehand line.
155 : // Default = 10 Pixel
156 0 : sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
157 : void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; }
158 :
159 : // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
160 : // incompatible with the rest of the Create functionality of SvDraw, needs
161 : // to set the following flag. It affects the following object types:
162 : // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
163 : //
164 : // This flag should be regarded as temporary. The affected applications should
165 : // be changed soon.
166 : // Default = sal_False;
167 0 : sal_Bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
168 1006 : void SetUseIncompatiblePathCreateInterface(sal_Bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
169 : void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
170 : void HideConnectMarker();
171 :
172 : // Attributes of the object that is in the process of being created
173 : /* new interface src537 */
174 : sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
175 :
176 : sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
177 : SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const;
178 : sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
179 : };
180 :
181 : #endif //_SVDCRTV_HXX
182 :
183 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|