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