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