1*3334a7e6SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*3334a7e6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*3334a7e6SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*3334a7e6SAndrew Rist * distributed with this work for additional information 6*3334a7e6SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*3334a7e6SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*3334a7e6SAndrew Rist * "License"); you may not use this file except in compliance 9*3334a7e6SAndrew Rist * with the License. You may obtain a copy of the License at 10*3334a7e6SAndrew Rist * 11*3334a7e6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*3334a7e6SAndrew Rist * 13*3334a7e6SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*3334a7e6SAndrew Rist * software distributed under the License is distributed on an 15*3334a7e6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*3334a7e6SAndrew Rist * KIND, either express or implied. See the License for the 17*3334a7e6SAndrew Rist * specific language governing permissions and limitations 18*3334a7e6SAndrew Rist * under the License. 19*3334a7e6SAndrew Rist * 20*3334a7e6SAndrew Rist *************************************************************/ 21*3334a7e6SAndrew Rist 22*3334a7e6SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SVDCRTV_HXX 25cdf0e10cSrcweir #define _SVDCRTV_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <svx/svddrgv.hxx> 28cdf0e10cSrcweir #include "svx/svxdllapi.h" 29cdf0e10cSrcweir 30cdf0e10cSrcweir //************************************************************ 31cdf0e10cSrcweir // Vorausdeklarationen 32cdf0e10cSrcweir //************************************************************ 33cdf0e10cSrcweir 34cdf0e10cSrcweir class XLineAttrSetItem; 35cdf0e10cSrcweir class XFillAttrSetItem; 36cdf0e10cSrcweir class SdrEdgeObj; 37cdf0e10cSrcweir class SdrObjConnection; 38cdf0e10cSrcweir 39cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 40cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 41cdf0e10cSrcweir // 42cdf0e10cSrcweir // @@@@ @@@@@ @@@@@ @@@@ @@@@@@ @@@@@ @@ @@ @@ @@@@@ @@ @@ 43cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ 44cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @@ @ @@ 45cdf0e10cSrcweir // @@ @@@@@ @@@@ @@@@@@ @@ @@@@ @@@@@ @@ @@@@ @@@@@@@ 46cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@@@@@ 47cdf0e10cSrcweir // @@ @@ @@ @@ @@ @@ @@ @@ @@ @@@ @@ @@ @@@ @@@ 48cdf0e10cSrcweir // @@@@ @@ @@ @@@@@ @@ @@ @@ @@@@@ @ @@ @@@@@ @@ @@ 49cdf0e10cSrcweir // 50cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 51cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////////////////////////// 52cdf0e10cSrcweir class ImplConnectMarkerOverlay; 53cdf0e10cSrcweir class ImpSdrCreateViewExtraData; 54cdf0e10cSrcweir 55cdf0e10cSrcweir class SVX_DLLPUBLIC SdrCreateView: public SdrDragView 56cdf0e10cSrcweir { 57cdf0e10cSrcweir friend class SdrPageView; 58cdf0e10cSrcweir 59cdf0e10cSrcweir protected: 60cdf0e10cSrcweir SdrObject* pAktCreate; // Aktuell in Erzeugung befindliches Objekt 61cdf0e10cSrcweir SdrPageView* pCreatePV; // Hier wurde die Erzeugung gestartet 62cdf0e10cSrcweir ImplConnectMarkerOverlay* mpCoMaOverlay; 63cdf0e10cSrcweir 64cdf0e10cSrcweir // for migrating stuff from XOR, use ImpSdrCreateViewExtraData ATM to not need to 65cdf0e10cSrcweir // compile the apps all the time 66cdf0e10cSrcweir ImpSdrCreateViewExtraData* mpCreateViewExtraData; 67cdf0e10cSrcweir 68cdf0e10cSrcweir Pointer aAktCreatePointer; 69cdf0e10cSrcweir 70cdf0e10cSrcweir sal_Int32 nAutoCloseDistPix; 71cdf0e10cSrcweir sal_Int32 nFreeHandMinDistPix; 72cdf0e10cSrcweir sal_uInt32 nAktInvent; // Aktuell eingestelltes 73cdf0e10cSrcweir sal_uInt16 nAktIdent; // Obj fuer Neuerzeugung 74cdf0e10cSrcweir 75cdf0e10cSrcweir unsigned bAutoTextEdit : 1; // Textedit nach dem erzeugen eines Textrahmens starten 76cdf0e10cSrcweir unsigned b1stPointAsCenter : 1; 77cdf0e10cSrcweir unsigned bUseIncompatiblePathCreateInterface : 1; 78cdf0e10cSrcweir unsigned bAutoClosePolys : 1; 79cdf0e10cSrcweir 80cdf0e10cSrcweir void ImpClearConnectMarker(); 81cdf0e10cSrcweir 82cdf0e10cSrcweir private: 83cdf0e10cSrcweir SVX_DLLPRIVATE void ImpClearVars(); 84cdf0e10cSrcweir SVX_DLLPRIVATE void ImpMakeCreateAttr(); 85cdf0e10cSrcweir SVX_DLLPRIVATE void ImpDelCreateAttr(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir protected: 88cdf0e10cSrcweir sal_Bool ImpBegCreateObj(sal_uInt32 nInvent, sal_uInt16 nIdent, const Point& rPnt, OutputDevice* pOut, 89cdf0e10cSrcweir sal_Int16 nMinMov, SdrPageView* pPV, const Rectangle& rLogRect, SdrObject* pPreparedFactoryObject); 90cdf0e10cSrcweir 91cdf0e10cSrcweir void ShowCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/); 92cdf0e10cSrcweir void HideCreateObj(/*OutputDevice* pOut, sal_Bool bFull*/); 93cdf0e10cSrcweir sal_Bool CheckEdgeMode(); 94cdf0e10cSrcweir 95cdf0e10cSrcweir protected: 96cdf0e10cSrcweir // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView 97cdf0e10cSrcweir SdrCreateView(SdrModel* pModel1, OutputDevice* pOut = 0L); 98cdf0e10cSrcweir virtual ~SdrCreateView(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir public: 101cdf0e10cSrcweir virtual sal_Bool IsAction() const; 102cdf0e10cSrcweir virtual void MovAction(const Point& rPnt); 103cdf0e10cSrcweir virtual void EndAction(); 104cdf0e10cSrcweir virtual void BckAction(); 105cdf0e10cSrcweir virtual void BrkAction(); 106cdf0e10cSrcweir virtual void TakeActionRect(Rectangle& rRect) const; 107cdf0e10cSrcweir 108cdf0e10cSrcweir virtual sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin); 109cdf0e10cSrcweir SetActiveLayer(const String & rName)110cdf0e10cSrcweir void SetActiveLayer(const String& rName) { aAktLayer=rName; } GetActiveLayer() const111cdf0e10cSrcweir const String& GetActiveLayer() const { return aAktLayer; } SetMeasureLayer(const String & rName)112cdf0e10cSrcweir void SetMeasureLayer(const String& rName) { aMeasureLayer=rName; } GetMeasureLayer() const113cdf0e10cSrcweir const String& GetMeasureLayer() const { return aMeasureLayer; } 114cdf0e10cSrcweir 115cdf0e10cSrcweir // Ist der MeasureLayer nicht gesetzt (Leerstring), so 116cdf0e10cSrcweir // wird der ActiveLayer auch fuer Bemassung verwendet. SetEditMode(SdrViewEditMode eMode)117cdf0e10cSrcweir void SetEditMode(SdrViewEditMode eMode) { SdrDragView::SetEditMode(eMode); CheckEdgeMode(); } SetEditMode(sal_Bool bOn=sal_True)118cdf0e10cSrcweir void SetEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetEditMode(bOn); CheckEdgeMode(); } SetCreateMode(sal_Bool bOn=sal_True)119cdf0e10cSrcweir void SetCreateMode(sal_Bool bOn=sal_True) { SdrDragView::SetCreateMode(bOn); CheckEdgeMode(); } SetGluePointEditMode(sal_Bool bOn=sal_True)120cdf0e10cSrcweir void SetGluePointEditMode(sal_Bool bOn=sal_True) { SdrDragView::SetGluePointEditMode(bOn); CheckEdgeMode(); } 121cdf0e10cSrcweir 122cdf0e10cSrcweir // Feststellen, ob Textwerkzeug aktiviert 123cdf0e10cSrcweir sal_Bool IsTextTool() const; 124cdf0e10cSrcweir 125cdf0e10cSrcweir // Feststellen, ob Objektverbinderwerkzeug aktiviert 126cdf0e10cSrcweir sal_Bool IsEdgeTool() const; 127cdf0e10cSrcweir 128cdf0e10cSrcweir // Feststellen, ob Bemassungswerkzeug aktiviert 129cdf0e10cSrcweir sal_Bool IsMeasureTool() const; 130cdf0e10cSrcweir 131cdf0e10cSrcweir void SetCurrentObj(sal_uInt16 nIdent, sal_uInt32 nInvent=SdrInventor); TakeCurrentObj(sal_uInt16 & nIdent,sal_uInt32 & nInvent) const132cdf0e10cSrcweir void TakeCurrentObj(sal_uInt16& nIdent, sal_uInt32& nInvent) const { nInvent=nAktInvent; nIdent=nAktIdent; } GetCurrentObjInventor() const133cdf0e10cSrcweir sal_uInt32 GetCurrentObjInventor() const { return nAktInvent; } GetCurrentObjIdentifier() const134cdf0e10cSrcweir sal_uInt16 GetCurrentObjIdentifier() const { return nAktIdent; } 135cdf0e10cSrcweir 136cdf0e10cSrcweir // Starten des normalen Create 137cdf0e10cSrcweir sal_Bool BegCreateObj(const Point& rPnt, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL); 138cdf0e10cSrcweir sal_Bool BegCreatePreparedObject(const Point& rPnt, sal_Int16 nMinMov, SdrObject* pPreparedFactoryObject); 139cdf0e10cSrcweir void MovCreateObj(const Point& rPnt); 140cdf0e10cSrcweir sal_Bool EndCreateObj(SdrCreateCmd eCmd); 141cdf0e10cSrcweir void BckCreateObj(); // z.B. wieder 1 Polygonpunkt zurueck. 142cdf0e10cSrcweir void BrkCreateObj(); IsCreateObj() const143cdf0e10cSrcweir sal_Bool IsCreateObj() const { return pAktCreate!=NULL; } GetCreateObj() const144cdf0e10cSrcweir SdrObject* GetCreateObj() const { return pAktCreate; } 145cdf0e10cSrcweir 146cdf0e10cSrcweir // BegCreateCaptionObj() erzeugt ein SdrCaptionObj (Legendenobjekt). 147cdf0e10cSrcweir // rObjSiz ist die anfaengliche Groesse des Legenden-Textrahmens. 148cdf0e10cSrcweir // gedraggd wird lediglich die Laenge des Zipfel. 149cdf0e10cSrcweir sal_Bool BegCreateCaptionObj(const Point& rPnt, const Size& rObjSiz, OutputDevice* pOut=NULL, short nMinMov=-3, SdrPageView* pPV=NULL); 150cdf0e10cSrcweir 151cdf0e10cSrcweir // Wenn TextEditAfterCreate auf sal_True steht (das ist der Default), 152cdf0e10cSrcweir // dann wird nach dem erzeugen eines Textrahmenobjekts (OBJ_TEXT, 153cdf0e10cSrcweir // OBJ_TEXTEXT, OBJ_OUTLINERTEXT, OBJ_TITLETEXT, OBJ_CAPTION) 154cdf0e10cSrcweir // automatisch ein TextEdit (SdrObjEditView::SdrBeginTextEdit) gestartet. IsTextEditAfterCreate() const155cdf0e10cSrcweir sal_Bool IsTextEditAfterCreate() const { return bAutoTextEdit; } SetTextEditAfterCreate(sal_Bool bOn)156cdf0e10cSrcweir void SetTextEditAfterCreate(sal_Bool bOn) { bAutoTextEdit = bOn; } 157cdf0e10cSrcweir 158cdf0e10cSrcweir // Erzeugen eines Kreises/Rechtecks/Textrahmens wobei der 1. Punkt 159cdf0e10cSrcweir // nicht die linke obere Ecke, sondern das Zentrum des Objekts vorgibt. 160cdf0e10cSrcweir // Persistentes Flag. Default=FALSE. IsCreate1stPointAsCenter() const161cdf0e10cSrcweir sal_Bool IsCreate1stPointAsCenter() const { return b1stPointAsCenter; } SetCreate1stPointAsCenter(sal_Bool bOn)162cdf0e10cSrcweir void SetCreate1stPointAsCenter(sal_Bool bOn) { b1stPointAsCenter = bOn; } 163cdf0e10cSrcweir 164cdf0e10cSrcweir // Fuer Polylines (OBJ_PLIN) und Freihandlinien (OBJ_FREELINE). Ist dieses 165cdf0e10cSrcweir // Flag sal_True, werden diese beiden Objekttypen implizit geschlossen und in 166cdf0e10cSrcweir // Polygon (OBJ_POLY) bzw. Freihandflaeche (OBJ_FREEFILL) gewandelt falls 167cdf0e10cSrcweir // zum Ende des Create die Distanz zwischen Startpunkt und Endpunkt des 168cdf0e10cSrcweir // Objekts <=n Pixel ist, wobei SetAutoCloseDistPix vorgegeben wird. 169cdf0e10cSrcweir // Default=TRUE. IsAutoClosePolys() const170cdf0e10cSrcweir sal_Bool IsAutoClosePolys() const { return bAutoClosePolys; } SetAutoClosePolys(sal_Bool bOn)171cdf0e10cSrcweir void SetAutoClosePolys(sal_Bool bOn) { bAutoClosePolys=bOn; } 172cdf0e10cSrcweir 173cdf0e10cSrcweir // Default=5 Pixel. GetAutoCloseDistPix() const174cdf0e10cSrcweir sal_uInt16 GetAutoCloseDistPix() const { return sal_uInt16(nAutoCloseDistPix); } SetAutoCloseDistPix(sal_uInt16 nVal)175cdf0e10cSrcweir void SetAutoCloseDistPix(sal_uInt16 nVal) { nAutoCloseDistPix=nVal; } 176cdf0e10cSrcweir 177cdf0e10cSrcweir // Vorgabe des minimalen Pixelabstands zwischen 2 Bezierpunkten bei der 178cdf0e10cSrcweir // Erzeugung einer Freihandlinie. 179cdf0e10cSrcweir // Default=10 Pixel. GetFreeHandMinDistPix() const180cdf0e10cSrcweir sal_uInt16 GetFreeHandMinDistPix() const { return sal_uInt16(nFreeHandMinDistPix); } SetFreeHandMinDistPix(sal_uInt16 nVal)181cdf0e10cSrcweir void SetFreeHandMinDistPix(sal_uInt16 nVal) { nFreeHandMinDistPix=nVal; } 182cdf0e10cSrcweir 183cdf0e10cSrcweir // Wer das (zur restlichen Create-Funktionalitaet von SvDraw) inkompatible 184cdf0e10cSrcweir // Create-Interface am PathObj beibehalten moechte muss das nachfolgende 185cdf0e10cSrcweir // Flag setzen. Dieses wirkt sich aus bei den Objekttypen: 186cdf0e10cSrcweir // OBJ_POLY, OBJ_PLIN, OBJ_PATHLINE, OBJ_PATHFILL 187cdf0e10cSrcweir // Dieses Flag hat nur voruebergehenden Character. Die betroffenen 188cdf0e10cSrcweir // Applikationen sollten alsbald umgestellt werden. 189cdf0e10cSrcweir // Default=sal_False; IsUseIncompatiblePathCreateInterface() const190cdf0e10cSrcweir sal_Bool IsUseIncompatiblePathCreateInterface() const { return bUseIncompatiblePathCreateInterface; } SetUseIncompatiblePathCreateInterface(sal_Bool bOn)191cdf0e10cSrcweir void SetUseIncompatiblePathCreateInterface(sal_Bool bOn) { bUseIncompatiblePathCreateInterface = bOn; } 192cdf0e10cSrcweir void SetConnectMarker(const SdrObjConnection& rCon, const SdrPageView& rPV); 193cdf0e10cSrcweir void HideConnectMarker(); 194cdf0e10cSrcweir 195cdf0e10cSrcweir // Attribute des ggf. gerade in der Erzeugung befindlichen Objekts 196cdf0e10cSrcweir /* new interface src537 */ 197cdf0e10cSrcweir sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const; 198cdf0e10cSrcweir 199cdf0e10cSrcweir sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll); 200cdf0e10cSrcweir SfxStyleSheet* GetStyleSheet() const; // SfxStyleSheet* GetStyleSheet(sal_Bool& rOk) const; 201cdf0e10cSrcweir sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr); 202cdf0e10cSrcweir }; 203cdf0e10cSrcweir 204cdf0e10cSrcweir #endif //_SVDCRTV_HXX 205cdf0e10cSrcweir 206