xref: /AOO41X/main/sc/inc/drwlayer.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir #ifndef SC_DRWLAYER_HXX
29*cdf0e10cSrcweir #define SC_DRWLAYER_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcl/graph.hxx>
32*cdf0e10cSrcweir #include <svx/fmmodel.hxx>
33*cdf0e10cSrcweir #include <svx/svdundo.hxx>
34*cdf0e10cSrcweir #include "global.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir class ScDocument;
37*cdf0e10cSrcweir class SfxViewShell;
38*cdf0e10cSrcweir class SfxObjectShell;
39*cdf0e10cSrcweir class ScDrawObjData;
40*cdf0e10cSrcweir class ScIMapInfo;
41*cdf0e10cSrcweir class ScMacroInfo;
42*cdf0e10cSrcweir class IMapObject;
43*cdf0e10cSrcweir class ScMarkData;
44*cdf0e10cSrcweir class SdrOle2Obj;
45*cdf0e10cSrcweir class ScRange;
46*cdf0e10cSrcweir class ScAddress;
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir // -----------------------------------------------------------------------
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir class ScTabDeletedHint : public SfxHint
51*cdf0e10cSrcweir {
52*cdf0e10cSrcweir private:
53*cdf0e10cSrcweir 	SCTAB	nTab;
54*cdf0e10cSrcweir public:
55*cdf0e10cSrcweir 			TYPEINFO();
56*cdf0e10cSrcweir 			ScTabDeletedHint( SCTAB nTabNo = SCTAB_MAX );
57*cdf0e10cSrcweir 	virtual	~ScTabDeletedHint();
58*cdf0e10cSrcweir 
59*cdf0e10cSrcweir 	SCTAB	GetTab()	{ return nTab; }
60*cdf0e10cSrcweir };
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir class ScTabSizeChangedHint : public SfxHint
63*cdf0e10cSrcweir {
64*cdf0e10cSrcweir private:
65*cdf0e10cSrcweir 	SCTAB	nTab;
66*cdf0e10cSrcweir public:
67*cdf0e10cSrcweir 			TYPEINFO();
68*cdf0e10cSrcweir 			ScTabSizeChangedHint( SCTAB nTabNo = SCTAB_MAX );
69*cdf0e10cSrcweir 	virtual	~ScTabSizeChangedHint();
70*cdf0e10cSrcweir 
71*cdf0e10cSrcweir 	SCTAB	GetTab()	{ return nTab; }
72*cdf0e10cSrcweir };
73*cdf0e10cSrcweir 
74*cdf0e10cSrcweir // -----------------------------------------------------------------------
75*cdf0e10cSrcweir //
76*cdf0e10cSrcweir //  Das Anpassen der Detektiv-UserData muss zusammen mit den Draw-Undo's
77*cdf0e10cSrcweir //  in der SdrUndoGroup liegen, darum von SdrUndoAction abgeleitet:
78*cdf0e10cSrcweir 
79*cdf0e10cSrcweir class ScUndoObjData : public SdrUndoObj
80*cdf0e10cSrcweir {
81*cdf0e10cSrcweir private:
82*cdf0e10cSrcweir     ScAddress   aOldStt;
83*cdf0e10cSrcweir     ScAddress   aOldEnd;
84*cdf0e10cSrcweir     ScAddress   aNewStt;
85*cdf0e10cSrcweir     ScAddress   aNewEnd;
86*cdf0e10cSrcweir     sal_Bool        bHasNew;
87*cdf0e10cSrcweir public:
88*cdf0e10cSrcweir                 ScUndoObjData( SdrObject* pObj, const ScAddress& rOS, const ScAddress& rOE,
89*cdf0e10cSrcweir                                                 const ScAddress& rNS, const ScAddress& rNE );
90*cdf0e10cSrcweir                 ~ScUndoObjData();
91*cdf0e10cSrcweir 
92*cdf0e10cSrcweir     virtual void     Undo();
93*cdf0e10cSrcweir     virtual void     Redo();
94*cdf0e10cSrcweir };
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir // -----------------------------------------------------------------------
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir class SC_DLLPUBLIC ScDrawLayer : public FmFormModel
99*cdf0e10cSrcweir {
100*cdf0e10cSrcweir private:
101*cdf0e10cSrcweir //REMOVE		SotStorageRef	xPictureStorage;
102*cdf0e10cSrcweir 	String			aName;
103*cdf0e10cSrcweir 	ScDocument*		pDoc;
104*cdf0e10cSrcweir 	SdrUndoGroup*	pUndoGroup;
105*cdf0e10cSrcweir 	sal_Bool			bRecording;
106*cdf0e10cSrcweir 	sal_Bool			bAdjustEnabled;
107*cdf0e10cSrcweir 	sal_Bool			bHyphenatorSet;
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir private:
110*cdf0e10cSrcweir 	void			MoveAreaTwips( SCTAB nTab, const Rectangle& rArea, const Point& rMove,
111*cdf0e10cSrcweir 								const Point& rTopLeft );
112*cdf0e10cSrcweir 	void			MoveCells( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
113*cdf0e10cSrcweir 								SCsCOL nDx,SCsROW nDy, bool bUpdateNoteCaptionPos );
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir     void            RecalcPos( SdrObject* pObj, const ScDrawObjData& rData, bool bNegativePage, bool bUpdateNoteCaptionPos );
116*cdf0e10cSrcweir 
117*cdf0e10cSrcweir public:
118*cdf0e10cSrcweir 					ScDrawLayer( ScDocument* pDocument, const String& rName );
119*cdf0e10cSrcweir 	virtual			~ScDrawLayer();
120*cdf0e10cSrcweir 
121*cdf0e10cSrcweir 	virtual SdrPage*  AllocPage(FASTBOOL bMasterPage);
122*cdf0e10cSrcweir 	virtual SdrModel* AllocModel() const;
123*cdf0e10cSrcweir 	virtual void	SetChanged( sal_Bool bFlg = sal_True );
124*cdf0e10cSrcweir 
125*cdf0e10cSrcweir 	virtual Window* GetCurDocViewWin();
126*cdf0e10cSrcweir 	virtual SvStream* GetDocumentStream(SdrDocumentStreamInfo& rStreamInfo) const;
127*cdf0e10cSrcweir 
128*cdf0e10cSrcweir 	virtual SdrLayerID GetControlExportLayerId( const SdrObject & ) const;
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir //REMOVE		void			ReleasePictureStorage();
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	sal_Bool			HasObjects() const;
133*cdf0e10cSrcweir 
134*cdf0e10cSrcweir     sal_Bool            ScAddPage( SCTAB nTab );
135*cdf0e10cSrcweir 	void			ScRemovePage( SCTAB nTab );
136*cdf0e10cSrcweir 	void			ScRenamePage( SCTAB nTab, const String& rNewName );
137*cdf0e10cSrcweir 	void			ScMovePage( sal_uInt16 nOldPos, sal_uInt16 nNewPos );
138*cdf0e10cSrcweir 					// inkl. Inhalt, bAlloc=sal_False -> nur Inhalt
139*cdf0e10cSrcweir 	void			ScCopyPage( sal_uInt16 nOldPos, sal_uInt16 nNewPos, sal_Bool bAlloc );
140*cdf0e10cSrcweir 
141*cdf0e10cSrcweir 	ScDocument*		GetDocument() const { return pDoc; }
142*cdf0e10cSrcweir 
143*cdf0e10cSrcweir 	void			UpdateBasic();				// DocShell-Basic in DrawPages setzen
144*cdf0e10cSrcweir 	void			UseHyphenator();
145*cdf0e10cSrcweir 
146*cdf0e10cSrcweir 	sal_Bool			GetPrintArea( ScRange& rRange, sal_Bool bSetHor, sal_Bool bSetVer ) const;
147*cdf0e10cSrcweir 
148*cdf0e10cSrcweir 					//		automatische Anpassungen
149*cdf0e10cSrcweir 
150*cdf0e10cSrcweir 	void			EnableAdjust( sal_Bool bSet = sal_True )	{ bAdjustEnabled = bSet; }
151*cdf0e10cSrcweir 
152*cdf0e10cSrcweir 	void			BeginCalcUndo();
153*cdf0e10cSrcweir 	SdrUndoGroup*	GetCalcUndo();
154*cdf0e10cSrcweir 	sal_Bool			IsRecording() const			{ return bRecording; }
155*cdf0e10cSrcweir 	void			AddCalcUndo( SdrUndoAction* pUndo );
156*cdf0e10cSrcweir 
157*cdf0e10cSrcweir 	void			MoveArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1, SCCOL nCol2,SCROW nRow2,
158*cdf0e10cSrcweir 								SCsCOL nDx,SCsROW nDy, sal_Bool bInsDel, bool bUpdateNoteCaptionPos = true );
159*cdf0e10cSrcweir 	void			WidthChanged( SCTAB nTab, SCCOL nCol, long nDifTwips );
160*cdf0e10cSrcweir 	void			HeightChanged( SCTAB nTab, SCROW nRow, long nDifTwips );
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir         sal_Bool            HasObjectsInRows( SCTAB nTab, SCROW nStartRow, SCROW nEndRow, bool bIncludeNotes = true );
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	void			DeleteObjectsInArea( SCTAB nTab, SCCOL nCol1,SCROW nRow1,
165*cdf0e10cSrcweir 											SCCOL nCol2,SCROW nRow2 );
166*cdf0e10cSrcweir 	void			DeleteObjectsInSelection( const ScMarkData& rMark );
167*cdf0e10cSrcweir #if 0
168*cdf0e10cSrcweir 	void			DeleteObjects( SCTAB nTab );
169*cdf0e10cSrcweir #endif
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	void			CopyToClip( ScDocument* pClipDoc, SCTAB nTab, const Rectangle& rRange );
172*cdf0e10cSrcweir 	void			CopyFromClip( ScDrawLayer* pClipModel,
173*cdf0e10cSrcweir 									SCTAB nSourceTab, const Rectangle& rSourceRange,
174*cdf0e10cSrcweir 									const ScAddress& rDestPos, const Rectangle& rDestRange );
175*cdf0e10cSrcweir 
176*cdf0e10cSrcweir 	void			SetPageSize( sal_uInt16 nPageNo, const Size& rSize, bool bUpdateNoteCaptionPos = true );
177*cdf0e10cSrcweir 
178*cdf0e10cSrcweir 					//	mirror or move between positive and negative positions for RTL
179*cdf0e10cSrcweir 	void			MirrorRTL( SdrObject* pObj );
180*cdf0e10cSrcweir 	static void		MirrorRectRTL( Rectangle& rRect );		// for bounding rectangles etc.
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     /** Returns the rectangle for the passed cell address in 1/100 mm.
183*cdf0e10cSrcweir         @param bMergedCell  True = regards merged cells. False = use single column/row size. */
184*cdf0e10cSrcweir     static Rectangle GetCellRect( ScDocument& rDoc, const ScAddress& rPos, bool bMergedCell );
185*cdf0e10cSrcweir 
186*cdf0e10cSrcweir 					//	GetVisibleName: name for navigator etc: GetPersistName or GetName
187*cdf0e10cSrcweir 					//	(ChartListenerCollection etc. must use GetPersistName directly)
188*cdf0e10cSrcweir 	static String	GetVisibleName( SdrObject* pObj );
189*cdf0e10cSrcweir 
190*cdf0e10cSrcweir 	SdrObject*		GetNamedObject( const String& rName, sal_uInt16 nId, SCTAB& rFoundTab ) const;
191*cdf0e10cSrcweir                     // if pnCounter != NULL, the search for a name starts with this index + 1,
192*cdf0e10cSrcweir                     // and the index really used is returned.
193*cdf0e10cSrcweir     String          GetNewGraphicName( long* pnCounter = NULL ) const;
194*cdf0e10cSrcweir 	void			EnsureGraphicNames();
195*cdf0e10cSrcweir 
196*cdf0e10cSrcweir 	// Verankerung setzen und ermitteln
197*cdf0e10cSrcweir 	static void		SetAnchor( SdrObject*, ScAnchorType );
198*cdf0e10cSrcweir 	static ScAnchorType	GetAnchor( const SdrObject* );
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	// Positionen fuer Detektivlinien
201*cdf0e10cSrcweir 	static ScDrawObjData* GetObjData( SdrObject* pObj, sal_Bool bCreate=sal_False );
202*cdf0e10cSrcweir 
203*cdf0e10cSrcweir     // The sheet information in ScDrawObjData isn't updated when sheets are inserted/deleted.
204*cdf0e10cSrcweir     // Use this method to get an object with positions on the specified sheet (should be the
205*cdf0e10cSrcweir     // sheet on which the object is inserted).
206*cdf0e10cSrcweir     static ScDrawObjData* GetObjDataTab( SdrObject* pObj, SCTAB nTab );
207*cdf0e10cSrcweir 
208*cdf0e10cSrcweir     /** Returns true, if the passed object is the caption of a cell note. */
209*cdf0e10cSrcweir     static bool     IsNoteCaption( SdrObject* pObj );
210*cdf0e10cSrcweir 
211*cdf0e10cSrcweir     /** Returns the object data, if the passed object is a cell note caption. */
212*cdf0e10cSrcweir     static ScDrawObjData* GetNoteCaptionData( SdrObject* pObj, SCTAB nTab );
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	// Image-Map
215*cdf0e10cSrcweir 	static ScIMapInfo* GetIMapInfo( SdrObject* pObj );
216*cdf0e10cSrcweir 
217*cdf0e10cSrcweir 	static IMapObject* GetHitIMapObject( SdrObject* pObject,
218*cdf0e10cSrcweir 							const Point& rWinPoint, const Window& rCmpWnd );
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir     static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = sal_False );
221*cdf0e10cSrcweir 
222*cdf0e10cSrcweir private:
223*cdf0e10cSrcweir 	static SfxObjectShell* pGlobalDrawPersist;			// fuer AllocModel
224*cdf0e10cSrcweir public:
225*cdf0e10cSrcweir 	static void		SetGlobalDrawPersist(SfxObjectShell* pPersist);
226*cdf0e10cSrcweir protected:
227*cdf0e10cSrcweir 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoModel();
228*cdf0e10cSrcweir };
229*cdf0e10cSrcweir 
230*cdf0e10cSrcweir 
231*cdf0e10cSrcweir #endif
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir 
234