Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / ui / inc / drawview.hxx
blob3da404cf394a02b67ed4b2740bdbf746b45d0bf1
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 SC_DRAWVIEW_HXX
21 #define SC_DRAWVIEW_HXX
23 #include <svx/fmview.hxx>
25 #include "global.hxx"
27 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
29 class ScDocument;
30 class ScViewData;
31 class ScDrawObjData;
32 class SdrUndoManager;
34 class ScDrawView: public FmFormView
36 ScViewData* pViewData;
37 OutputDevice* pDev; //! needed ?
38 ScDocument* pDoc;
39 SCTAB nTab;
40 Fraction aScaleX; // Factor for Drawing-MapMode
41 Fraction aScaleY;
42 SdrDropMarkerOverlay* pDropMarker;
43 SdrObject* pDropMarkObj;
44 sal_Bool bInConstruct;
46 void Construct();
47 void UpdateBrowser();
49 protected:
50 virtual void ModelHasChanged();
52 // add custom handles (used by other apps, e.g. AnchorPos)
53 virtual void AddCustomHdl();
55 void ImplClearCalcDropMarker();
57 // support enhanced text edit for draw objects
58 virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const;
60 public:
61 ScDrawView( OutputDevice* pOut, ScViewData* pData );
62 virtual ~ScDrawView();
64 virtual void MarkListHasChanged();
65 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
67 virtual void DoConnect(SdrOle2Obj* pOleObj);
69 virtual void MakeVisible( const Rectangle& rRect, Window& rWin );
71 virtual void DeleteMarked();
73 virtual sal_Bool SdrBeginTextEdit(
74 SdrObject* pObj,
75 SdrPageView* pPV = 0L,
76 ::Window* pWin = 0L,
77 sal_Bool bIsNewObj = sal_False,
78 SdrOutliner* pGivenOutliner = 0L,
79 OutlinerView* pGivenOutlinerView = 0L,
80 sal_Bool bDontDeleteOutliner = sal_False,
81 sal_Bool bOnlyOneView = sal_False,
82 sal_Bool bGrabFocus = sal_True);
84 virtual SdrEndTextEditKind SdrEndTextEdit( sal_Bool bDontDeleteReally = sal_False );
86 void MarkDropObj( SdrObject* pObj );
88 void SetMarkedToLayer( sal_uInt8 nLayerNo );
90 void InvalidateAttribs();
91 void InvalidateDrawTextAttrs();
93 sal_Bool BeginDrag( Window* pWindow, const Point& rStartPos );
94 void DoCut();
95 void DoCopy();
97 void GetScale( Fraction& rFractX, Fraction& rFractY ) const;
98 void RecalcScale();
99 void UpdateWorkArea();
100 SCTAB GetTab() const { return nTab; }
102 void CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
104 void SetPageAnchored();
105 void SetCellAnchored();
106 ScAnchorType GetAnchorType() const;
108 void VCAddWin( Window* pWin );
109 void VCRemoveWin( Window* pWin );
111 void UpdateIMap( SdrObject* pObj );
113 sal_uInt16 GetPopupMenuId();
114 void UpdateUserViewOptions();
116 void SetMarkedOriginalSize();
118 sal_Bool SelectObject( const OUString& rName );
119 bool HasMarkedControl() const;
120 bool HasMarkedInternal() const;
122 bool InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions=0);
124 /** Returns the selected object, if it is the caption object of a cell note.
125 @param ppCaptData (out-param) If not null, returns the pointer to the caption object data. */
126 SdrObject* GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
128 /** Locks/unlocks the specified layer in the draw page.
129 Unlocked layer is required to be able to edit the contained objects. */
130 void LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
131 /** Unlocks the specified layer in the draw page. */
132 inline void UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
134 /** Locks/unlocks the background layer that contains background objects.
135 Unlocked layer is required to be able to edit the objects. */
136 inline void LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
137 /** Unlocks the background layer that contains background objects. */
138 inline void UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
140 /** Locks/unlocks the internal layer that contains caption objects of cell notes.
141 Unlocked layer is required to be able to edit the contained objects. */
142 inline void LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
143 /** Unlocks the internal layer that contains caption objects of cell notes. */
144 inline void UnlockInternalLayer() { LockInternalLayer( false ); }
146 SdrEndTextEditKind ScEndTextEdit(); // calls SetDrawTextUndo(0)
147 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
149 static void CheckOle( const SdrMarkList& rMarkList, sal_Bool& rAnyOle, sal_Bool& rOneOle );
150 virtual void SyncForGrid( SdrObject* pObj );
156 #endif
158 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */