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 INCLUDED_SVX_SVDCRTV_HXX
21 : #define INCLUDED_SVX_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 : 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;
58 :
59 : void ImpClearConnectMarker();
60 :
61 : private:
62 : SVX_DLLPRIVATE void ImpClearVars();
63 :
64 : protected:
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);
67 :
68 : void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
69 : void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
70 : 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 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;
84 :
85 : virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
86 :
87 323 : void SetMeasureLayer(const OUString& rName) { aMeasureLayer=rName; }
88 : const OUString& GetMeasureLayer() const { return aMeasureLayer; }
89 :
90 : // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
91 353 : void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
92 0 : void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
93 0 : void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
94 0 : void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
95 :
96 : // Determine whether a text tool is activated
97 : bool IsTextTool() const;
98 :
99 : // Determine whether an object connector tool activated
100 : bool IsEdgeTool() const;
101 :
102 : // Determine whether a measurement tool activated
103 : bool IsMeasureTool() const;
104 :
105 : void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor);
106 0 : void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; }
107 0 : sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; }
108 0 : sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
109 :
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
116 : void BrkCreateObj();
117 353 : bool IsCreateObj() const { return pAktCreate!=NULL; }
118 0 : SdrObject* GetCreateObj() const { return pAktCreate; }
119 :
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);
124 :
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 0 : bool IsTextEditAfterCreate() const { return bAutoTextEdit; }
130 : void SetTextEditAfterCreate(bool bOn) { bAutoTextEdit = bOn; }
131 :
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 4 : bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
136 1 : void SetCreate1stPointAsCenter(bool bOn) { b1stPointAsCenter = bOn; }
137 :
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.
143 : // Default = TRUE.
144 0 : bool IsAutoClosePolys() const { return bAutoClosePolys; }
145 : void SetAutoClosePolys(bool bOn) { bAutoClosePolys=bOn; }
146 :
147 : // Default = 5 Pixel
148 0 : sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
149 : void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; }
150 :
151 : // Setting for the minimum distantce in pixels between 2 bezier points when
152 : // creating a freehand line.
153 : // Default = 10 Pixel
154 0 : sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
155 : void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; }
156 :
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
161 :
162 : // This flag should be regarded as temporary. The affected applications should
163 : // be changed soon.
164 : // Default = sal_False;
165 0 : bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
166 3432 : void SetUseIncompatiblePathCreateInterface(bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
167 : void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
168 : void HideConnectMarker();
169 :
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;
173 :
174 : bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
175 : SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
176 : bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
177 : };
178 :
179 : #endif // INCLUDED_SVX_SVDCRTV_HXX
180 :
181 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|