xref: /aoo41x/main/sc/source/ui/inc/drawview.hxx (revision 52f1c2ee)
138d50f7bSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
338d50f7bSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
438d50f7bSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
538d50f7bSAndrew Rist  * distributed with this work for additional information
638d50f7bSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
738d50f7bSAndrew Rist  * to you under the Apache License, Version 2.0 (the
838d50f7bSAndrew Rist  * "License"); you may not use this file except in compliance
938d50f7bSAndrew Rist  * with the License.  You may obtain a copy of the License at
1038d50f7bSAndrew Rist  *
1138d50f7bSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
1238d50f7bSAndrew Rist  *
1338d50f7bSAndrew Rist  * Unless required by applicable law or agreed to in writing,
1438d50f7bSAndrew Rist  * software distributed under the License is distributed on an
1538d50f7bSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1638d50f7bSAndrew Rist  * KIND, either express or implied.  See the License for the
1738d50f7bSAndrew Rist  * specific language governing permissions and limitations
1838d50f7bSAndrew Rist  * under the License.
1938d50f7bSAndrew Rist  *
2038d50f7bSAndrew Rist  *************************************************************/
2138d50f7bSAndrew Rist 
2238d50f7bSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef SC_DRAWVIEW_HXX
25cdf0e10cSrcweir #define SC_DRAWVIEW_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include <svx/fmview.hxx>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #include "global.hxx"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
32cdf0e10cSrcweir 
33cdf0e10cSrcweir class ScDocument;
34cdf0e10cSrcweir class ScViewData;
35cdf0e10cSrcweir class ScDrawObjData;
3614af77b6SArmin Le Grand class SdrUndoManager;
37cdf0e10cSrcweir 
38cdf0e10cSrcweir class ScDrawView: public FmFormView
39cdf0e10cSrcweir {
40cdf0e10cSrcweir 	ScViewData*				pViewData;
41cdf0e10cSrcweir 	OutputDevice*			pDev;					//! noetig ?
42cdf0e10cSrcweir 	ScDocument*				pDoc;
43cdf0e10cSrcweir 	SCTAB					nTab;
44cdf0e10cSrcweir 	Fraction				aScaleX;				// Faktor fuer Drawing-MapMode
45cdf0e10cSrcweir 	Fraction				aScaleY;
46cdf0e10cSrcweir 	SdrDropMarkerOverlay*	pDropMarker;
47cdf0e10cSrcweir 	SdrObject*				pDropMarkObj;
48cdf0e10cSrcweir 	sal_Bool					bInConstruct;
49cdf0e10cSrcweir 	//HMHBOOL					bDisableHdl;
50cdf0e10cSrcweir 
51cdf0e10cSrcweir 	void			Construct();
52cdf0e10cSrcweir 	void			UpdateBrowser();
53cdf0e10cSrcweir 
54cdf0e10cSrcweir protected:
55cdf0e10cSrcweir 	virtual void	ModelHasChanged();
56cdf0e10cSrcweir 
57cdf0e10cSrcweir 	// add custom handles (used by other apps, e.g. AnchorPos)
58cdf0e10cSrcweir     virtual void AddCustomHdl();
59cdf0e10cSrcweir 
60cdf0e10cSrcweir 	void ImplClearCalcDropMarker();
61cdf0e10cSrcweir 
6214af77b6SArmin Le Grand     // support enhanced text edit for draw objects
6314af77b6SArmin Le Grand     virtual SdrUndoManager* getSdrUndoManagerForEnhancedTextEdit() const;
6414af77b6SArmin Le Grand 
65cdf0e10cSrcweir public:
66cdf0e10cSrcweir 					ScDrawView( OutputDevice* pOut, ScViewData* pData );
67cdf0e10cSrcweir 	virtual			~ScDrawView();
68cdf0e10cSrcweir 
69cdf0e10cSrcweir 	virtual void	MarkListHasChanged();
70cdf0e10cSrcweir 	virtual void	Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
71cdf0e10cSrcweir 
72cdf0e10cSrcweir     virtual void    DoConnect(SdrOle2Obj* pOleObj);
73cdf0e10cSrcweir 
74cdf0e10cSrcweir 	virtual void	MakeVisible( const Rectangle& rRect, Window& rWin );
75cdf0e10cSrcweir 
76cdf0e10cSrcweir     virtual void    DeleteMarked();
77cdf0e10cSrcweir 
78edf077abSOliver-Rainer Wittmann     virtual sal_Bool SdrBeginTextEdit(
79edf077abSOliver-Rainer Wittmann         SdrObject* pObj,
80edf077abSOliver-Rainer Wittmann         SdrPageView* pPV = 0L,
81edf077abSOliver-Rainer Wittmann         ::Window* pWin = 0L,
82edf077abSOliver-Rainer Wittmann         sal_Bool bIsNewObj = sal_False,
83edf077abSOliver-Rainer Wittmann         SdrOutliner* pGivenOutliner = 0L,
84edf077abSOliver-Rainer Wittmann         OutlinerView* pGivenOutlinerView = 0L,
85edf077abSOliver-Rainer Wittmann         sal_Bool bDontDeleteOutliner = sal_False,
86edf077abSOliver-Rainer Wittmann         sal_Bool bOnlyOneView = sal_False,
87edf077abSOliver-Rainer Wittmann         sal_Bool bGrabFocus = sal_True);
88edf077abSOliver-Rainer Wittmann 
89edf077abSOliver-Rainer Wittmann     virtual SdrEndTextEditKind SdrEndTextEdit( sal_Bool bDontDeleteReally = sal_False );
90edf077abSOliver-Rainer Wittmann 
91edf077abSOliver-Rainer Wittmann     void			DrawMarks( OutputDevice* pOut ) const;
92cdf0e10cSrcweir 
93cdf0e10cSrcweir 	void			MarkDropObj( SdrObject* pObj );
94cdf0e10cSrcweir 
95cdf0e10cSrcweir 	//HMHBOOL			IsDisableHdl() const 	{ return bDisableHdl; }
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	void			SetMarkedToLayer( sal_uInt8 nLayerNo );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	void			InvalidateAttribs();
100cdf0e10cSrcweir 	void			InvalidateDrawTextAttrs();
101cdf0e10cSrcweir 
102cdf0e10cSrcweir 	sal_Bool			BeginDrag( Window* pWindow, const Point& rStartPos );
103cdf0e10cSrcweir 	void			DoCut();
104cdf0e10cSrcweir 	void			DoCopy();
105cdf0e10cSrcweir 
106cdf0e10cSrcweir 	void			GetScale( Fraction& rFractX, Fraction& rFractY ) const;
107cdf0e10cSrcweir 	void			RecalcScale();
108cdf0e10cSrcweir 	void			UpdateWorkArea();
GetTab() const109cdf0e10cSrcweir 	SCTAB			GetTab() const		{ return nTab; }
110cdf0e10cSrcweir 
111cdf0e10cSrcweir 	void			CalcNormScale( Fraction& rFractX, Fraction& rFractY ) const;
112cdf0e10cSrcweir 
113cdf0e10cSrcweir 	void			SetAnchor( ScAnchorType );
114cdf0e10cSrcweir 	ScAnchorType	GetAnchor() const;
115cdf0e10cSrcweir 
116cdf0e10cSrcweir 	void			VCAddWin( Window* pWin );
117cdf0e10cSrcweir 	void			VCRemoveWin( Window* pWin );
118cdf0e10cSrcweir 
119cdf0e10cSrcweir 	void 			UpdateIMap( SdrObject* pObj );
120cdf0e10cSrcweir 
121cdf0e10cSrcweir 	sal_uInt16			GetPopupMenuId();
122cdf0e10cSrcweir 	void			UpdateUserViewOptions();
123cdf0e10cSrcweir 
124cdf0e10cSrcweir 	void			SetMarkedOriginalSize();
125cdf0e10cSrcweir 
126cdf0e10cSrcweir 	sal_Bool			SelectObject( const String& rName );
127cdf0e10cSrcweir //UNUSED2008-05  String			GetSelectedChartName() const;
128cdf0e10cSrcweir     bool            HasMarkedControl() const;
129cdf0e10cSrcweir     bool            HasMarkedInternal() const;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir 	FASTBOOL		InsertObjectSafe(SdrObject* pObj, SdrPageView& rPV, sal_uLong nOptions=0);
132cdf0e10cSrcweir 
133cdf0e10cSrcweir     /** Returns the selected object, if it is the caption object of a cell note.
134cdf0e10cSrcweir         @param ppCaptData  (out-param) If not null, returns the pointer to the caption object data. */
135cdf0e10cSrcweir     SdrObject*      GetMarkedNoteCaption( ScDrawObjData** ppCaptData = 0 );
136cdf0e10cSrcweir 
137cdf0e10cSrcweir     /** Locks/unlocks the specified layer in the draw page.
138cdf0e10cSrcweir         Unlocked layer is required to be able to edit the contained objects. */
139cdf0e10cSrcweir     void            LockCalcLayer( SdrLayerID nLayer, bool bLock = true );
140cdf0e10cSrcweir     /** Unlocks the specified layer in the draw page. */
UnlockCalcLayer(SdrLayerID nLayer)141cdf0e10cSrcweir     inline void     UnlockCalcLayer( SdrLayerID nLayer ) { LockCalcLayer( nLayer, false ); }
142cdf0e10cSrcweir 
143cdf0e10cSrcweir     /** Locks/unlocks the background layer that contains background objects.
144cdf0e10cSrcweir         Unlocked layer is required to be able to edit the objects. */
LockBackgroundLayer(bool bLock=true)145cdf0e10cSrcweir     inline void     LockBackgroundLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_BACK, bLock ); }
146cdf0e10cSrcweir     /** Unlocks the background layer that contains background objects. */
UnlockBackgroundLayer()147cdf0e10cSrcweir     inline void     UnlockBackgroundLayer() { LockBackgroundLayer( false ); }
148cdf0e10cSrcweir 
149cdf0e10cSrcweir     /** Locks/unlocks the internal layer that contains caption objects of cell notes.
150cdf0e10cSrcweir         Unlocked layer is required to be able to edit the contained objects. */
LockInternalLayer(bool bLock=true)151cdf0e10cSrcweir     inline void     LockInternalLayer( bool bLock = true ) { LockCalcLayer( SC_LAYER_INTERN, bLock ); }
152cdf0e10cSrcweir     /** Unlocks the internal layer that contains caption objects of cell notes. */
UnlockInternalLayer()153cdf0e10cSrcweir     inline void     UnlockInternalLayer() { LockInternalLayer( false ); }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir 	SdrEndTextEditKind	ScEndTextEdit();	// ruft SetDrawTextUndo(0)
156cdf0e10cSrcweir //UNUSED2009-05 void                    CaptionTextDirection(sal_uInt16 nSlot);
157cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
1580deba7fbSSteve Yin 	SdrObject*  GetObjectByName(const String& rName);
1590deba7fbSSteve Yin 	sal_Bool           GetObjectIsMarked(  SdrObject * pObject );
1600deba7fbSSteve Yin 	sal_Bool           SelectCurrentViewObject( const String& rName );
161*52f1c2eeSArmin Le Grand 
162*52f1c2eeSArmin Le Grand     // #123922# helper which checks if a Graphic may be appied to an existing
163*52f1c2eeSArmin Le Grand     // SdrObject; if it's a SdrGrafObj the fill will be replaced. If it's a
164*52f1c2eeSArmin Le Grand     // fillable, non-OLE SdrObject, the FillStyle will be adapted
165*52f1c2eeSArmin Le Grand     SdrObject* ApplyGraphicToObject(
166*52f1c2eeSArmin Le Grand         SdrObject& rHitObject,
167*52f1c2eeSArmin Le Grand         const Graphic& rGraphic,
168*52f1c2eeSArmin Le Grand         const String& rBeginUndoText,
169*52f1c2eeSArmin Le Grand         const String& rFile,
170*52f1c2eeSArmin Le Grand         const String& rFilter);
171cdf0e10cSrcweir };
172cdf0e10cSrcweir 
173cdf0e10cSrcweir 
174cdf0e10cSrcweir 
175cdf0e10cSrcweir 
176cdf0e10cSrcweir #endif
177cdf0e10cSrcweir 
178