tdf#154285 Check upper bound of arguments in SbRtl_Minute function
[LibreOffice.git] / include / svx / svdcrtv.hxx
blob68d3a2b49032aeeafc728965a7ed751e2f6852f7
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>
25 #include <memory>
27 class SdrObjConnection;
29 class ImplConnectMarkerOverlay;
30 class ImpSdrCreateViewExtraData;
32 class SVXCORE_DLLPUBLIC SdrCreateView : public SdrDragView
34 friend class SdrPageView;
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;
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;
45 PointerStyle maCurrentCreatePointer;
47 sal_Int32 mnAutoCloseDistPix;
48 sal_Int32 mnFreeHandMinDistPix;
49 SdrInventor mnCurrentInvent; // set the current ones
50 SdrObjKind mnCurrentIdent; // Obj for re-creating
52 bool mb1stPointAsCenter : 1;
53 bool mbUseIncompatiblePathCreateInterface : 1;
55 SAL_DLLPRIVATE void ImpClearConnectMarker();
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);
61 SAL_DLLPRIVATE void ShowCreateObj(/*OutputDevice* pOut, bool bFull*/);
62 SAL_DLLPRIVATE void HideCreateObj(/*OutputDevice* pOut, bool bFull*/);
63 bool CheckEdgeMode();
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);
71 SAL_DLLPRIVATE virtual ~SdrCreateView() override;
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;
81 SAL_DLLPRIVATE virtual bool MouseMove(const MouseEvent& rMEvt, OutputDevice* pWin) override;
83 void SetMeasureLayer(const OUString& rName) { maMeasureLayer=rName; }
85 // If the MeasureLayer is not set (empty string), then use the active layer for measuring.
86 void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); }
87 void SetEditMode(bool bOn=true) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); }
88 void SetCreateMode(bool bOn=true) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); }
89 void SetGluePointEditMode(bool bOn=true) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); }
91 // Determine whether a text tool is activated
92 SAL_DLLPRIVATE bool IsTextTool() const;
94 // Determine whether an object connector tool activated
95 SAL_DLLPRIVATE bool IsEdgeTool() const;
97 // Determine whether a measurement tool activated
98 SAL_DLLPRIVATE bool IsMeasureTool() const;
100 void SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent=SdrInventor::Default);
101 void TakeCurrentObj(SdrObjKind& nIdent, SdrInventor& nInvent) const
103 nInvent = mnCurrentInvent;
104 nIdent = mnCurrentIdent;
106 SdrInventor GetCurrentObjInventor() const { return mnCurrentInvent; }
107 SdrObjKind GetCurrentObjIdentifier() const { return mnCurrentIdent; }
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 bool IsCreateObj() const { return mpCurrentCreate != nullptr; }
117 SdrObject* GetCreateObj() const { return mpCurrentCreate.get(); }
119 /// Setup layer (eg. foreground / background) of the given object.
120 static void SetupObjLayer(const SdrPageView* pPageView, const OUString& aActiveLayer, SdrObject* pObj);
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);
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 bool IsCreate1stPointAsCenter() const { return mb1stPointAsCenter; }
131 void SetCreate1stPointAsCenter(bool bOn) { mb1stPointAsCenter = bOn; }
133 // Default = 5 Pixel
134 sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(mnAutoCloseDistPix); }
136 // Setting for the minimum distance in pixels between 2 bezier points when
137 // creating a freehand line.
138 // Default = 10 Pixel
139 sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(mnFreeHandMinDistPix); }
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
146 // This flag should be regarded as temporary. The affected applications should
147 // be changed soon.
148 // Default = sal_False;
149 bool IsUseIncompatiblePathCreateInterface() const { return mbUseIncompatiblePathCreateInterface; }
150 void SetUseIncompatiblePathCreateInterface(bool bOn) { mbUseIncompatiblePathCreateInterface = bOn; }
151 SAL_DLLPRIVATE void SetConnectMarker(const SdrObjConnection& rCon);
152 SAL_DLLPRIVATE void HideConnectMarker();
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;
158 bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll);
159 SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(bool& rOk) const;
160 void SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr);
163 #endif // INCLUDED_SVX_SVDCRTV_HXX
165 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */