build fix
[LibreOffice.git] / include / svx / svdcrtv.hxx
blobc66b05488d3e475caca6b0ea01c7d1c8c6191300
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDCRTV_HXX
21 #define INCLUDED_SVX_SVDCRTV_HXX
23 #include <svx/svddrgv.hxx>
24 #include <svx/svxdllapi.h>
26 class XLineAttrSetItem;
27 class XFillAttrSetItem;
28 class SdrEdgeObj;
29 class SdrObjConnection;
31 class ImplConnectMarkerOverlay;
32 class ImpSdrCreateViewExtraData;
34 class SVX_DLLPUBLIC SdrCreateView: public SdrDragView
36 friend class SdrPageView;
38 protected:
39 SdrObject* pAktCreate; // Currently in creation of the located object
40 SdrPageView* pCreatePV; // Here, the creation is started
41 ImplConnectMarkerOverlay* mpCoMaOverlay;
43 // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to
44 // compile the apps all the time
45 ImpSdrCreateViewExtraData* mpCreateViewExtraData;
47 Pointer aAktCreatePointer;
49 sal_Int32 nAutoCloseDistPix;
50 sal_Int32 nFreeHandMinDistPix;
51 SdrInventor nAktInvent; // set the current ones
52 sal_uInt16 nAktIdent; // Obj for re-creating
54 bool b1stPointAsCenter : 1;
55 bool bUseIncompatiblePathCreateInterface : 1;
57 void ImpClearConnectMarker();
59 private:
60 SVX_DLLPRIVATE void ImpClearVars();
62 protected:
63 bool ImpBegCreateObj(SdrInventor nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut,
64 sal_Int16 nMinMov, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject);
66 void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
67 void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
68 bool CheckEdgeMode();
70 protected:
71 // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
72 SdrCreateView(SdrModel* pModel1, OutputDevice* pOut);
73 virtual ~SdrCreateView() override;
75 public:
76 virtual bool IsAction() const override;
77 virtual void MovAction(const Point& rPnt) override;
78 virtual void EndAction() override;
79 virtual void BckAction() override;
80 virtual void BrkAction() override;
81 virtual void TakeActionRect(Rectangle& rRect) const override;
83 virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) override;
85 void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; }
87 // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
88 void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
89 void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
90 void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
91 void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
93 // Determine whether a text tool is activated
94 bool IsTextTool() const;
96 // Determine whether an object connector tool activated
97 bool IsEdgeTool() const;
99 // Determine whether a measurement tool activated
100 bool IsMeasureTool() const;
102 void SetCurrentObj(sal_uInt16 nIdent, SdrInventor nInvent=SdrInventor::Default);
103 void TakeCurrentObj(sal_uInt16& nIdent, SdrInventor& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; }
104 SdrInventor GetCurrentObjInventor() const { return nAktInvent; }
105 sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; }
107 // Beginning the regular Create
108 bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=nullptr, short nMinMov=-3);
109 bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject);
110 void MovCreateObj(const Point& rPnt);
111 bool EndCreateObj(SdrCreateCmd eCmd);
112 void BckCreateObj(); // go back one polygon point
113 void BrkCreateObj();
114 bool IsCreateObj() const { return pAktCreate!=nullptr; }
115 SdrObject* GetCreateObj() const { return pAktCreate; }
117 // BegCreateCaptionObj() creates a SdrCaptionObj (legend item).
118 // rObjSiz is the initial size of the legend text frame.
119 // Only the length of the tip is dragged
120 bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=nullptr, short nMinMov=-3);
122 // Create a circle/rectangle/text frame with the first Point being
123 // the center of the object instead of the upper-left corner.
124 // Persistent flag. Default = FALSE.
125 bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; }
126 void SetCreate1stPointAsCenter(bool bOn) { b1stPointAsCenter = bOn; }
128 // Default = 5 Pixel
129 sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); }
131 // Setting for the minimum distance in pixels between 2 bezier points when
132 // creating a freehand line.
133 // Default = 10 Pixel
134 sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); }
136 // FIXME: Whoever wants to keep the Create Interface for the PathObj which is
137 // incompatible with the rest of the Create functionality of SvDraw, needs
138 // to set the following flag. It affects the following object types:
139 // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL
141 // This flag should be regarded as temporary. The affected applications should
142 // be changed soon.
143 // Default = sal_False;
144 bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; }
145 void SetUseIncompatiblePathCreateInterface(bool bOn) { bUseIncompatiblePathCreateInterface = bOn; }
146 void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV);
147 void HideConnectMarker();
149 // Attributes of the object that is in the process of being created
150 /* new interface src537 */
151 bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr) const;
153 bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
154 SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
155 bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
158 #endif // INCLUDED_SVX_SVDCRTV_HXX
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */