xref: /aoo42x/main/sc/source/ui/inc/drawview.hxx (revision 14af77b6)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef SC_DRAWVIEW_HXX
25 #define SC_DRAWVIEW_HXX
26 
27 #include <svx/fmview.hxx>
28 
29 #include "global.hxx"
30 
31 namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
32 
33 class ScDocument;
34 class ScViewData;
35 class ScDrawObjData;
36 class SdrUndoManager;
37 
38 class ScDrawView: public FmFormView
39 {
40 	ScViewData*				pViewData;
41 	OutputDevice*			pDev;					//! noetig ?
42 	ScDocument*				pDoc;
43 	SCTAB					nTab;
44 	Fraction				aScaleX;				// Faktor fuer Drawing-MapMode
45 	Fraction				aScaleY;
46 	SdrDropMarkerOverlay*	pDropMarker;
47 	SdrObject*				pDropMarkObj;
48 	sal_Bool					bInConstruct;
49 	//HMHBOOL					bDisableHdl;
50 
51 	void			Construct();
52 	void			UpdateBrowser();
53 
54 protected:
55 	virtual void	ModelHasChanged();
56 
57 	// add custom handles (used by other apps, e.g. AnchorPos)
58     virtual void AddCustomHdl();
59 
60 	void ImplClearCalcDropMarker();
61 
62     // support enhanced text edit for draw objects
63     virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const;
64 
65 public:
66 					ScDrawView( OutputDevice* pOut, ScViewData* pData );
67 	virtual			~ScDrawView();
68 
69 	virtual void	MarkListHasChanged();
70 	virtual void	Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
71 
72     virtual void    DoConnect(SdrOle2Obj* pOleObj);
73 
74 	virtual void	MakeVisible( const Rectangle& rRect, Window& rWin );
75 
76     virtual void    DeleteMarked();
77 
78 	void			DrawMarks( OutputDevice* pOut ) const;
79 
80 	void			MarkDropObj( SdrObject* pObj );
81 
82 	//HMHBOOL			IsDisableHdl() const 	{ return bDisableHdl; }
83 
84 	void			SetMarkedToLayer( sal_uInt8 nLayerNo );
85 
86 	void			InvalidateAttribs();
87 	void			InvalidateDrawTextAttrs();
88 
89 	sal_Bool			BeginDrag( Window* pWindow, const Point& rStartPos );
90 	void			DoCut();
91 	void			DoCopy();
92 
93 	void			GetScale( Fraction& rFractX, Fraction& rFractY ) const;
94 	void			RecalcScale();
95 	void			UpdateWorkArea();
96 	SCTAB			GetTab() const		{ return nTab; }
97 
98 	void			CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
99 
100 	void			SetAnchor( ScAnchorType );
101 	ScAnchorType	GetAnchor() const;
102 
103 	void			VCAddWin( Window* pWin );
104 	void			VCRemoveWin( Window* pWin );
105 
106 	void 			UpdateIMap( SdrObject* pObj );
107 
108 	sal_uInt16			GetPopupMenuId();
109 	void			UpdateUserViewOptions();
110 
111 	void			SetMarkedOriginalSize();
112 
113 	sal_Bool			SelectObject( const String& rName );
114 //UNUSED2008-05  String			GetSelectedChartName() const;
115     bool            HasMarkedControl() const;
116     bool            HasMarkedInternal() const;
117 
118 	FASTBOOL		InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions=0);
119 
120     /** Returns the selected object, if it is the caption object of a cell note.
121         @param ppCaptData  (out-param) If not null, returns the pointer to the caption object data. */
122     SdrObject*      GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
123 
124     /** Locks/unlocks the specified layer in the draw page.
125         Unlocked layer is required to be able to edit the contained objects. */
126     void            LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
127     /** Unlocks the specified layer in the draw page. */
128     inline void     UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
129 
130     /** Locks/unlocks the background layer that contains background objects.
131         Unlocked layer is required to be able to edit the objects. */
132     inline void     LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
133     /** Unlocks the background layer that contains background objects. */
134     inline void     UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
135 
136     /** Locks/unlocks the internal layer that contains caption objects of cell notes.
137         Unlocked layer is required to be able to edit the contained objects. */
138     inline void     LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
139     /** Unlocks the internal layer that contains caption objects of cell notes. */
140     inline void     UnlockInternalLayer() { LockInternalLayer( false ); }
141 
142 	SdrEndTextEditKind	ScEndTextEdit();	// ruft SetDrawTextUndo(0)
143 //UNUSED2009-05 void                    CaptionTextDirection(sal_uInt16 nSlot);
144     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
145 };
146 
147 
148 
149 
150 #endif
151 
152