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