/src/libreoffice/include/svx/svdcrtv.hxx
Line | Count | Source |
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 | | #include <memory> |
26 | | |
27 | | class SdrObjConnection; |
28 | | |
29 | | class ImplConnectMarkerOverlay; |
30 | | class ImpSdrCreateViewExtraData; |
31 | | |
32 | | class SVXCORE_DLLPUBLIC SdrCreateView : public SdrDragView |
33 | | { |
34 | | friend class SdrPageView; |
35 | | |
36 | | protected: |
37 | | rtl::Reference<SdrObject> mpCurrentCreate; // The currently being created object |
38 | | SdrPageView* mpCreatePV; // Here, the creation is started |
39 | | std::unique_ptr<ImplConnectMarkerOverlay> mpCoMaOverlay; |
40 | | |
41 | | // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to |
42 | | // compile the apps all the time |
43 | | std::unique_ptr<ImpSdrCreateViewExtraData> mpCreateViewExtraData; |
44 | | |
45 | | PointerStyle maCurrentCreatePointer; |
46 | | |
47 | | sal_Int32 mnAutoCloseDistPix; |
48 | | sal_Int32 mnFreeHandMinDistPix; |
49 | | SdrInventor mnCurrentInvent; // set the current ones |
50 | | SdrObjKind mnCurrentIdent; // Obj for re-creating |
51 | | |
52 | | bool mb1stPointAsCenter : 1; |
53 | | bool mbUseIncompatiblePathCreateInterface : 1; |
54 | | |
55 | | SAL_DLLPRIVATE void ImpClearConnectMarker(); |
56 | | |
57 | | protected: |
58 | | SAL_DLLPRIVATE bool ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, const Point& rPnt, OutputDevice* pOut, |
59 | | sal_Int16 nMinMov, const tools::Rectangle& rLogRect, SdrObject* pPreparedFactoryObject); |
60 | | |
61 | | SAL_DLLPRIVATE void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/); |
62 | | SAL_DLLPRIVATE void HideCreateObj(/*OutputDevice* pOut, bool bFull*/); |
63 | | bool CheckEdgeMode(); |
64 | | |
65 | | protected: |
66 | | // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView |
67 | | SAL_DLLPRIVATE SdrCreateView( |
68 | | SdrModel& rSdrModel, |
69 | | OutputDevice* pOut); |
70 | | |
71 | | SAL_DLLPRIVATE virtual ~SdrCreateView() override; |
72 | | |
73 | | public: |
74 | | virtual bool IsAction() const override; |
75 | | virtual void MovAction(const Point& rPnt) override; |
76 | | virtual void EndAction() override; |
77 | | virtual void BckAction() override; |
78 | | virtual void BrkAction() override; |
79 | | virtual void TakeActionRect(tools::Rectangle& rRect) const override; |
80 | | |
81 | | SAL_DLLPRIVATE virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override; |
82 | | |
83 | 0 | void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; } |
84 | | |
85 | | // If the MeasureLayer is not set (empty string), then use the active layer for measuring. |
86 | 0 | void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); } |
87 | 0 | void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); } |
88 | 0 | void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); } |
89 | 0 | void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); } |
90 | | |
91 | | // Determine whether a text tool is activated |
92 | | SAL_DLLPRIVATE bool IsTextTool() const; |
93 | | |
94 | | // Determine whether an object connector tool activated |
95 | | SAL_DLLPRIVATE bool IsEdgeTool() const; |
96 | | |
97 | | // Determine whether a measurement tool activated |
98 | | SAL_DLLPRIVATE bool IsMeasureTool() const; |
99 | | |
100 | | void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default); |
101 | | void TakeCurrentObj(SdrObjKind& nIdent, SdrInventor& nInvent) const |
102 | 0 | { |
103 | 0 | nInvent = mnCurrentInvent; |
104 | 0 | nIdent = mnCurrentIdent; |
105 | 0 | } |
106 | 0 | SdrInventor GetCurrentObjInventor() const { return mnCurrentInvent; } |
107 | 0 | SdrObjKind GetCurrentObjIdentifier() const { return mnCurrentIdent; } |
108 | | |
109 | | // Beginning the regular Create |
110 | | bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=nullptr, short nMinMov=-3); |
111 | | bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject); |
112 | | void MovCreateObj(const Point& rPnt); |
113 | | bool EndCreateObj(SdrCreateCmd eCmd); |
114 | | SAL_DLLPRIVATE void BckCreateObj(); // go back one polygon point |
115 | | void BrkCreateObj(); |
116 | 0 | bool IsCreateObj() const { return mpCurrentCreate != nullptr; } |
117 | 0 | SdrObject* GetCreateObj() const { return mpCurrentCreate.get(); } |
118 | | |
119 | | /// Setup layer (eg. foreground / background) of the given object. |
120 | | static void SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj); |
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 | | bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=nullptr, short nMinMov=-3); |
126 | | |
127 | | // Create a circle/rectangle/text frame with the first Point being |
128 | | // the center of the object instead of the upper-left corner. |
129 | | // Persistent flag. Default = FALSE. |
130 | 0 | bool IsCreate1stPointAsCenter() const { return mb1stPointAsCenter; } |
131 | 0 | void SetCreate1stPointAsCenter(bool bOn) { mb1stPointAsCenter = bOn; } |
132 | | |
133 | | // Default = 5 Pixel |
134 | 0 | sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(mnAutoCloseDistPix); } |
135 | | |
136 | | // Setting for the minimum distance in pixels between 2 bezier points when |
137 | | // creating a freehand line. |
138 | | // The value is defined by config item /org.openoffice.Office.Common/Misc/FreehandThresholdPixels |
139 | 0 | sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(mnFreeHandMinDistPix); } |
140 | | |
141 | | // FIXME: Whoever wants to keep the Create Interface for the PathObj which is |
142 | | // incompatible with the rest of the Create functionality of SvDraw, needs |
143 | | // to set the following flag. It affects the following object types: |
144 | | // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL |
145 | | |
146 | | // This flag should be regarded as temporary. The affected applications should |
147 | | // be changed soon. |
148 | | // Default = sal_False; |
149 | 0 | bool IsUseIncompatiblePathCreateInterface() const { return mbUseIncompatiblePathCreateInterface; } |
150 | 58.7k | void SetUseIncompatiblePathCreateInterface(bool bOn) { mbUseIncompatiblePathCreateInterface = bOn; } |
151 | | SAL_DLLPRIVATE void SetConnectMarker(const SdrObjConnection& rCon); |
152 | | SAL_DLLPRIVATE void HideConnectMarker(); |
153 | | |
154 | | // Attributes of the object that is in the process of being created |
155 | | /* new interface src537 */ |
156 | | SAL_DLLPRIVATE void GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const; |
157 | | |
158 | | bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll); |
159 | | SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const; |
160 | | void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr); |
161 | | }; |
162 | | |
163 | | #endif // INCLUDED_SVX_SVDCRTV_HXX |
164 | | |
165 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |