xref: /AOO41X/main/svx/inc/svx/svdpage.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 _SVDPAGE_HXX
29*cdf0e10cSrcweir #define _SVDPAGE_HXX
30*cdf0e10cSrcweir 
31*cdf0e10cSrcweir #include <vcl/bitmap.hxx>
32*cdf0e10cSrcweir #include <vcl/print.hxx>
33*cdf0e10cSrcweir #include <vcl/gdimtf.hxx>
34*cdf0e10cSrcweir #include <tools/weakbase.hxx>
35*cdf0e10cSrcweir #include <cppuhelper/weakref.hxx>
36*cdf0e10cSrcweir #include <svx/svdtypes.hxx>
37*cdf0e10cSrcweir #include <svx/svdlayer.hxx>
38*cdf0e10cSrcweir #include <svx/sdrcomment.hxx>
39*cdf0e10cSrcweir #include <vector>
40*cdf0e10cSrcweir #include <svx/sdrpageuser.hxx>
41*cdf0e10cSrcweir #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
42*cdf0e10cSrcweir #include <svx/sdrmasterpagedescriptor.hxx>
43*cdf0e10cSrcweir #include "svx/svxdllapi.h"
44*cdf0e10cSrcweir #include <com/sun/star/container/XIndexAccess.hpp>
45*cdf0e10cSrcweir #include <svx/svdobj.hxx>
46*cdf0e10cSrcweir #include <boost/scoped_ptr.hpp>
47*cdf0e10cSrcweir 
48*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
49*cdf0e10cSrcweir // predefines
50*cdf0e10cSrcweir 
51*cdf0e10cSrcweir namespace sdr { namespace contact { class ViewContact; }}
52*cdf0e10cSrcweir class SdrPage;
53*cdf0e10cSrcweir class SdrModel;
54*cdf0e10cSrcweir class SfxItemPool;
55*cdf0e10cSrcweir class SdrPageView;
56*cdf0e10cSrcweir class SdrLayerAdmin;
57*cdf0e10cSrcweir class SetOfByte;
58*cdf0e10cSrcweir class Color;
59*cdf0e10cSrcweir class SfxStyleSheet;
60*cdf0e10cSrcweir class SvxUnoDrawPagesAccess;
61*cdf0e10cSrcweir 
62*cdf0e10cSrcweir enum SdrInsertReasonKind {SDRREASON_UNKNOWN,    // unbekannt
63*cdf0e10cSrcweir 						  SDRREASON_STREAMING,  // einlesen eines Doks
64*cdf0e10cSrcweir 						  SDRREASON_UNDO,       // kommt aus dem Undo
65*cdf0e10cSrcweir 						  SDRREASON_COPY,       // irgendjemand kopiert...
66*cdf0e10cSrcweir 						  SDRREASON_VIEWCREATE, // vom Anwender interaktiv erzeugt
67*cdf0e10cSrcweir 						  SDRREASON_VIEWCALL};  // Durch SdrView::Group(), ...
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir class SdrInsertReason {
70*cdf0e10cSrcweir 	const SdrObject* pRefObj;
71*cdf0e10cSrcweir 	SdrInsertReasonKind eReason;
72*cdf0e10cSrcweir public:
73*cdf0e10cSrcweir 	SdrInsertReason(): pRefObj(NULL),eReason(SDRREASON_UNKNOWN) {}
74*cdf0e10cSrcweir 	SdrInsertReason(SdrInsertReasonKind eR,const SdrObject* pO=NULL): pRefObj(pO),eReason(eR) {}
75*cdf0e10cSrcweir 	void SetReferenceObject(const SdrObject* pO)  { pRefObj=pO; }
76*cdf0e10cSrcweir 	const SdrObject* GetReferenceObject() const   { return pRefObj; }
77*cdf0e10cSrcweir 	void SetReason(SdrInsertReasonKind eR)        { eReason=eR; }
78*cdf0e10cSrcweir 	SdrInsertReasonKind GetReason() const         { return eReason; }
79*cdf0e10cSrcweir };
80*cdf0e10cSrcweir 
81*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
82*cdf0e10cSrcweir // class SdrObjList
83*cdf0e10cSrcweir 
84*cdf0e10cSrcweir class SVX_DLLPUBLIC SdrObjList
85*cdf0e10cSrcweir {
86*cdf0e10cSrcweir private:
87*cdf0e10cSrcweir     typedef ::std::vector<SdrObject*> SdrObjectContainerType;
88*cdf0e10cSrcweir 	SdrObjectContainerType maList;
89*cdf0e10cSrcweir 
90*cdf0e10cSrcweir protected:
91*cdf0e10cSrcweir friend class SdrObjListIter;
92*cdf0e10cSrcweir friend class SdrEditView;
93*cdf0e10cSrcweir 	SdrObjList* pUpList;   // Vaterliste
94*cdf0e10cSrcweir 	SdrModel*   pModel;    // Diese Liste gehoert zu diesem Model (Layer,ItemPool,Storage).
95*cdf0e10cSrcweir 	SdrPage*    pPage;     // Page, in die Liste haengt. Kann auch this sein.
96*cdf0e10cSrcweir 	SdrObject*  pOwnerObj; // OwnerObject, falls Liste eines GruppenObjekts.
97*cdf0e10cSrcweir 	Rectangle   aOutRect;
98*cdf0e10cSrcweir 	Rectangle   aSnapRect;
99*cdf0e10cSrcweir 	SdrObjListKind eListKind;
100*cdf0e10cSrcweir 	FASTBOOL    bObjOrdNumsDirty;
101*cdf0e10cSrcweir 	FASTBOOL    bRectsDirty;
102*cdf0e10cSrcweir protected:
103*cdf0e10cSrcweir 	virtual void RecalcRects();
104*cdf0e10cSrcweir 
105*cdf0e10cSrcweir private:
106*cdf0e10cSrcweir 	/// simple ActionChildInserted forwarder to have it on a central place
107*cdf0e10cSrcweir 	void impChildInserted(SdrObject& rChild) const;
108*cdf0e10cSrcweir public:
109*cdf0e10cSrcweir 	TYPEINFO();
110*cdf0e10cSrcweir 	SdrObjList(SdrModel* pNewModel, SdrPage* pNewPage, SdrObjList* pNewUpList=NULL);
111*cdf0e10cSrcweir 	SdrObjList(const SdrObjList& rSrcList);
112*cdf0e10cSrcweir 	virtual ~SdrObjList();
113*cdf0e10cSrcweir 	// !!! Diese Methode nur fuer Leute, die ganz genau wissen was sie tun !!!
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	// #110094# This should not be needed (!)
116*cdf0e10cSrcweir 	void SetObjOrdNumsDirty()                           { bObjOrdNumsDirty=sal_True; }
117*cdf0e10cSrcweir 	// pModel, pPage, pUpList und pOwnerObj werden Zuweisungeoperator nicht veraendert!
118*cdf0e10cSrcweir 	void operator=(const SdrObjList& rSrcList);
119*cdf0e10cSrcweir 	void CopyObjects(const SdrObjList& rSrcList);
120*cdf0e10cSrcweir 	// alles Aufraeumen (ohne Undo)
121*cdf0e10cSrcweir 	void    Clear();
122*cdf0e10cSrcweir 	SdrObjListKind GetListKind() const                  { return eListKind; }
123*cdf0e10cSrcweir 	void           SetListKind(SdrObjListKind eNewKind) { eListKind=eNewKind; }
124*cdf0e10cSrcweir 	SdrObjList*    GetUpList() const                    { return pUpList; }
125*cdf0e10cSrcweir 	void           SetUpList(SdrObjList* pNewUpList)    { pUpList=pNewUpList; }
126*cdf0e10cSrcweir 	SdrObject*     GetOwnerObj() const                  { return pOwnerObj; }
127*cdf0e10cSrcweir 	void           SetOwnerObj(SdrObject* pNewOwner)    { pOwnerObj=pNewOwner; }
128*cdf0e10cSrcweir 	virtual SdrPage* GetPage() const;
129*cdf0e10cSrcweir 	virtual void     SetPage(SdrPage* pNewPage);
130*cdf0e10cSrcweir 	virtual SdrModel* GetModel() const;
131*cdf0e10cSrcweir 	virtual void      SetModel(SdrModel* pNewModel);
132*cdf0e10cSrcweir 	// Neuberechnung der Objekt-Ordnungsnummern
133*cdf0e10cSrcweir 	void     RecalcObjOrdNums();
134*cdf0e10cSrcweir 	FASTBOOL IsObjOrdNumsDirty() const        { return bObjOrdNumsDirty; }
135*cdf0e10cSrcweir 	virtual void NbcInsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
136*cdf0e10cSrcweir 								 , const SdrInsertReason* pReason=NULL
137*cdf0e10cSrcweir 																	  );
138*cdf0e10cSrcweir 	virtual void InsertObject(SdrObject* pObj, sal_uIntPtr nPos=CONTAINER_APPEND
139*cdf0e10cSrcweir 							  , const SdrInsertReason* pReason=NULL
140*cdf0e10cSrcweir 																	 );
141*cdf0e10cSrcweir 	// aus Liste entfernen ohne delete
142*cdf0e10cSrcweir 	virtual SdrObject* NbcRemoveObject(sal_uIntPtr nObjNum);
143*cdf0e10cSrcweir 	virtual SdrObject* RemoveObject(sal_uIntPtr nObjNum);
144*cdf0e10cSrcweir 	// Vorhandenes Objekt durch ein anderes ersetzen.
145*cdf0e10cSrcweir 	// Wie Remove&Insert jedoch performanter, da die Ordnungsnummern
146*cdf0e10cSrcweir 	// nicht Dirty gesetzt werden muessen.
147*cdf0e10cSrcweir 	virtual SdrObject* NbcReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum);
148*cdf0e10cSrcweir 	virtual SdrObject* ReplaceObject(SdrObject* pNewObj, sal_uIntPtr nObjNum);
149*cdf0e10cSrcweir 	// Die Z-Order eines Objekts veraendern
150*cdf0e10cSrcweir 	virtual SdrObject* NbcSetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum);
151*cdf0e10cSrcweir 	virtual SdrObject* SetObjectOrdNum(sal_uIntPtr nOldObjNum, sal_uIntPtr nNewObjNum);
152*cdf0e10cSrcweir 
153*cdf0e10cSrcweir 	virtual void SetRectsDirty();
154*cdf0e10cSrcweir 
155*cdf0e10cSrcweir 	const Rectangle& GetAllObjSnapRect() const;
156*cdf0e10cSrcweir 	const Rectangle& GetAllObjBoundRect() const;
157*cdf0e10cSrcweir 
158*cdf0e10cSrcweir 	// Alle Textobjekte neu formatieren, z.B. bei Druckerwechsel
159*cdf0e10cSrcweir 	void NbcReformatAllTextObjects();
160*cdf0e10cSrcweir 	void ReformatAllTextObjects();
161*cdf0e10cSrcweir 
162*cdf0e10cSrcweir 	/** #103122# reformats all edge objects that are connected to other objects */
163*cdf0e10cSrcweir 	void ReformatAllEdgeObjects();
164*cdf0e10cSrcweir 
165*cdf0e10cSrcweir 	// Die Vorlagenattribute der Zeichenobjekte in harte Attribute verwandeln.
166*cdf0e10cSrcweir 	void BurnInStyleSheetAttributes();
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	sal_uIntPtr      GetObjCount() const;
169*cdf0e10cSrcweir 	SdrObject* GetObj(sal_uIntPtr nNum) const;
170*cdf0e10cSrcweir 
171*cdf0e10cSrcweir 	// Gelinkte Seite oder gelinktes Gruppenobjekt
172*cdf0e10cSrcweir 	virtual FASTBOOL IsReadOnly() const;
173*cdf0e10cSrcweir 
174*cdf0e10cSrcweir 	// Zaehlt alle Objekte inkl. Objekte in Objektgruppen, ...
175*cdf0e10cSrcweir 	sal_uIntPtr   CountAllObjects() const;
176*cdf0e10cSrcweir 
177*cdf0e10cSrcweir 	// Alle aufgelagerten Teile (z.B. Grafiken) der Liste in den
178*cdf0e10cSrcweir 	// Speicher laden.
179*cdf0e10cSrcweir 	void	ForceSwapInObjects() const;
180*cdf0e10cSrcweir     void    ForceSwapOutObjects() const;
181*cdf0e10cSrcweir 
182*cdf0e10cSrcweir     void	SwapInAll() const { ForceSwapInObjects(); }
183*cdf0e10cSrcweir     void	SwapOutAll() const { ForceSwapOutObjects(); }
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir     /** Makes the object list flat, i.e. the object list content are
186*cdf0e10cSrcweir         then tree leaves
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir     	This method travels recursively over all group objects in this
189*cdf0e10cSrcweir     	list, extracts the content, inserts it flat to the list and
190*cdf0e10cSrcweir     	removes the group object afterwards.
191*cdf0e10cSrcweir      */
192*cdf0e10cSrcweir     virtual void FlattenGroups();
193*cdf0e10cSrcweir     /** Ungroup the object at the given index
194*cdf0e10cSrcweir 
195*cdf0e10cSrcweir     	This method ungroups the content of the group object at the
196*cdf0e10cSrcweir     	given index, i.e. the content is put flat into the object list
197*cdf0e10cSrcweir     	(if the object at the given index is no group, this method is
198*cdf0e10cSrcweir     	a no-op). If the group itself contains group objects, the
199*cdf0e10cSrcweir     	operation is performed recursively, such that the content of
200*cdf0e10cSrcweir     	the given object contains no groups afterwards.
201*cdf0e10cSrcweir      */
202*cdf0e10cSrcweir     virtual void UnGroupObj( sal_uIntPtr nObjNum );
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir     /** Return whether there is an explicit, user defined, object navigation
205*cdf0e10cSrcweir         order.  When there is one this method returns <TRUE/> and the
206*cdf0e10cSrcweir         GetObjectForNavigationPosition() and
207*cdf0e10cSrcweir         SdrObject::GetNavigationPosition() methods will return values
208*cdf0e10cSrcweir         different from those returne by SdrObject::GetOrdNum() and
209*cdf0e10cSrcweir         GetObj().
210*cdf0e10cSrcweir     */
211*cdf0e10cSrcweir     bool HasObjectNavigationOrder (void) const;
212*cdf0e10cSrcweir 
213*cdf0e10cSrcweir     /** Set the navigation position of the given object to the specified
214*cdf0e10cSrcweir         value.  Note that this changes the navigation position for all
215*cdf0e10cSrcweir         objects on or following the old or new position.
216*cdf0e10cSrcweir     */
217*cdf0e10cSrcweir     void SetObjectNavigationPosition (
218*cdf0e10cSrcweir         SdrObject& rObject,
219*cdf0e10cSrcweir         const sal_uInt32 nNewNavigationPosition);
220*cdf0e10cSrcweir 
221*cdf0e10cSrcweir     /** Return the object for the given navigation position.  When there is
222*cdf0e10cSrcweir         a user defined navigation order, i.e. mpNavigationOrder is not NULL,
223*cdf0e10cSrcweir         then that is used to look up the object.  Otherwise the z-order is
224*cdf0e10cSrcweir         used by looking up the object in maList.
225*cdf0e10cSrcweir         @param nNavigationPosition
226*cdf0e10cSrcweir             Valid values include 0 and are smaller than the number of
227*cdf0e10cSrcweir             objects as returned by GetObjCount().
228*cdf0e10cSrcweir         @return
229*cdf0e10cSrcweir             The returned pointer is NULL for invalid positions.
230*cdf0e10cSrcweir     */
231*cdf0e10cSrcweir     SdrObject* GetObjectForNavigationPosition (const sal_uInt32 nNavigationPosition) const;
232*cdf0e10cSrcweir 
233*cdf0e10cSrcweir     /** Restore the navigation order to that defined by the z-order.
234*cdf0e10cSrcweir     */
235*cdf0e10cSrcweir     void ClearObjectNavigationOrder (void);
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir     /** Set the navigation position of all SdrObjects to their position in
238*cdf0e10cSrcweir         the mpNavigationOrder list.  This method returns immediately when no
239*cdf0e10cSrcweir         update is necessary.
240*cdf0e10cSrcweir         @return
241*cdf0e10cSrcweir             This method returns <TRUE/> when the navigation positions stored
242*cdf0e10cSrcweir             in SdrObjects are up to date.
243*cdf0e10cSrcweir             It returns <FALSE/> when teh navigation positions are not valid,
244*cdf0e10cSrcweir             for example because no explicit navigation order has been
245*cdf0e10cSrcweir             defined, i.e. HasObjectNavigationOrder() would return <FALSE/>.
246*cdf0e10cSrcweir     */
247*cdf0e10cSrcweir     bool RecalcNavigationPositions (void);
248*cdf0e10cSrcweir 
249*cdf0e10cSrcweir     /** Set the navigation order to the one defined by the given list of
250*cdf0e10cSrcweir         XShape objects.
251*cdf0e10cSrcweir         @param rxOrder
252*cdf0e10cSrcweir             When this is an empty reference then the navigation order is
253*cdf0e10cSrcweir             reset to the z-order. The preferred way to do this, however, is
254*cdf0e10cSrcweir             to call ClearObjectNavigationOrder().
255*cdf0e10cSrcweir             Otherwise this list is expected to contain all the shapes in the
256*cdf0e10cSrcweir             called SdrObjList.
257*cdf0e10cSrcweir     */
258*cdf0e10cSrcweir     void SetNavigationOrder (const ::com::sun::star::uno::Reference<
259*cdf0e10cSrcweir         ::com::sun::star::container::XIndexAccess>& rxOrder);
260*cdf0e10cSrcweir 
261*cdf0e10cSrcweir private:
262*cdf0e10cSrcweir     class WeakSdrObjectContainerType;
263*cdf0e10cSrcweir     /// This list, if it exists, defines the navigation order.  It it does
264*cdf0e10cSrcweir     /// not exist then maList defines the navigation order.
265*cdf0e10cSrcweir     ::boost::scoped_ptr<WeakSdrObjectContainerType> mpNavigationOrder;
266*cdf0e10cSrcweir 
267*cdf0e10cSrcweir     /// This flag is <TRUE/> when the mpNavigation list has been changed but
268*cdf0e10cSrcweir     /// the indices of the referenced SdrObjects still have their old values.
269*cdf0e10cSrcweir 	bool mbIsNavigationOrderDirty;
270*cdf0e10cSrcweir 
271*cdf0e10cSrcweir     /** Insert an SdrObject into maList.  Do not modify the maList member
272*cdf0e10cSrcweir         directly.
273*cdf0e10cSrcweir         @param rObject
274*cdf0e10cSrcweir             The object to insert into the object list.
275*cdf0e10cSrcweir         @param nInsertPosition
276*cdf0e10cSrcweir             The given object is inserted before the object at this
277*cdf0e10cSrcweir             position.  Valid values include 0 (the object is inserted at the
278*cdf0e10cSrcweir             head of the list) and the number of objects in the list as
279*cdf0e10cSrcweir             returned by GetObjCount() (the object is inserted at the end of
280*cdf0e10cSrcweir             the list.)
281*cdf0e10cSrcweir     */
282*cdf0e10cSrcweir     void InsertObjectIntoContainer (
283*cdf0e10cSrcweir         SdrObject& rObject,
284*cdf0e10cSrcweir         const sal_uInt32 nInsertPosition);
285*cdf0e10cSrcweir 
286*cdf0e10cSrcweir     /** Replace an object in the object list.
287*cdf0e10cSrcweir         @param rObject
288*cdf0e10cSrcweir             The new object that replaces the one in the list at the
289*cdf0e10cSrcweir             specified position.
290*cdf0e10cSrcweir         @param nObjectPosition
291*cdf0e10cSrcweir             The object at this position in the object list is replaced by
292*cdf0e10cSrcweir             the given object.  Valid values include 0 and are smaller than
293*cdf0e10cSrcweir             the number of objects in the list.
294*cdf0e10cSrcweir     */
295*cdf0e10cSrcweir     void ReplaceObjectInContainer (
296*cdf0e10cSrcweir         SdrObject& rObject,
297*cdf0e10cSrcweir         const sal_uInt32 nObjectPosition);
298*cdf0e10cSrcweir 
299*cdf0e10cSrcweir     /** Remove an object from the object list.
300*cdf0e10cSrcweir         The object list has to contain at least one element.
301*cdf0e10cSrcweir         @param nObjectPosition
302*cdf0e10cSrcweir             The object at this position is removed from the object list.
303*cdf0e10cSrcweir             Valid values include 0 and are smaller than the number of
304*cdf0e10cSrcweir             objects in the list.
305*cdf0e10cSrcweir     */
306*cdf0e10cSrcweir     void RemoveObjectFromContainer (
307*cdf0e10cSrcweir         const sal_uInt32 nObjectPosition);
308*cdf0e10cSrcweir };
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir /*
311*cdf0e10cSrcweir Eine Sdraw-Seite enthaelt genau eine Objektliste sowie eine Beschreibung
312*cdf0e10cSrcweir der physikalischen Seitendimensionen (Groesse/Raender). Letzteres wird
313*cdf0e10cSrcweir lediglich zum Fangen von Objekten beim Draggen benoetigt.
314*cdf0e10cSrcweir An der Seite lassen sich (ueber SdrObjList) Objekte einfuegen und loeschen,
315*cdf0e10cSrcweir nach vorn und nach hinten stellen. Ausserdem kann die Ordnungszahl eines
316*cdf0e10cSrcweir Objektes abgefragt sowie direkt gesetzt werden.
317*cdf0e10cSrcweir */
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir // Used for all methods which return a page number
320*cdf0e10cSrcweir #define SDRPAGE_NOTFOUND 0xFFFF
321*cdf0e10cSrcweir 
322*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
323*cdf0e10cSrcweir // class SdrPageGridFrame
324*cdf0e10cSrcweir 
325*cdf0e10cSrcweir // Fuer das Fangraster/Punkgitter im Writer
326*cdf0e10cSrcweir class SdrPageGridFrame
327*cdf0e10cSrcweir {
328*cdf0e10cSrcweir 	Rectangle aPaper;
329*cdf0e10cSrcweir 	Rectangle aUserArea;
330*cdf0e10cSrcweir public:
331*cdf0e10cSrcweir 	SdrPageGridFrame(const Rectangle& rPaper): aPaper(rPaper), aUserArea(rPaper) {}
332*cdf0e10cSrcweir 	SdrPageGridFrame(const Rectangle& rPaper, const Rectangle& rUser): aPaper(rPaper), aUserArea(rUser) {}
333*cdf0e10cSrcweir 	void             SetPaperRect(const Rectangle& rPaper) { aPaper=rPaper; }
334*cdf0e10cSrcweir 	void             SetUserArea(const Rectangle& rUser)   { aUserArea=rUser; }
335*cdf0e10cSrcweir 	const Rectangle& GetPaperRect() const                  { return aPaper; }
336*cdf0e10cSrcweir 	const Rectangle& GetUserArea() const                   { return aUserArea; }
337*cdf0e10cSrcweir };
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir class SVX_DLLPUBLIC SdrPageGridFrameList {
340*cdf0e10cSrcweir 	Container aList;
341*cdf0e10cSrcweir private:
342*cdf0e10cSrcweir 	SVX_DLLPRIVATE SdrPageGridFrameList(const SdrPageGridFrameList& rSrcList);      // never implemented
343*cdf0e10cSrcweir 	SVX_DLLPRIVATE void           operator=(const SdrPageGridFrameList& rSrcList);  // never implemented
344*cdf0e10cSrcweir protected:
345*cdf0e10cSrcweir 	SdrPageGridFrame* GetObject(sal_uInt16 i) const { return (SdrPageGridFrame*)(aList.GetObject(i)); }
346*cdf0e10cSrcweir public:
347*cdf0e10cSrcweir 	SdrPageGridFrameList(): aList(1024,4,4)                            {}
348*cdf0e10cSrcweir 	~SdrPageGridFrameList()                                            { Clear(); }
349*cdf0e10cSrcweir 	void           Clear();
350*cdf0e10cSrcweir 	sal_uInt16         GetCount() const                                    { return sal_uInt16(aList.Count()); }
351*cdf0e10cSrcweir 	void           Insert(const SdrPageGridFrame& rGF, sal_uInt16 nPos=0xFFFF) { aList.Insert(new SdrPageGridFrame(rGF),nPos); }
352*cdf0e10cSrcweir 	void           Delete(sal_uInt16 nPos)                                 { delete (SdrPageGridFrame*)aList.Remove(nPos); }
353*cdf0e10cSrcweir 	void           Move(sal_uInt16 nPos, sal_uInt16 nNewPos)                   { aList.Insert(aList.Remove(nPos),nNewPos); }
354*cdf0e10cSrcweir 	SdrPageGridFrame&       operator[](sal_uInt16 nPos)                    { return *GetObject(nPos); }
355*cdf0e10cSrcweir 	const SdrPageGridFrame& operator[](sal_uInt16 nPos) const              { return *GetObject(nPos); }
356*cdf0e10cSrcweir };
357*cdf0e10cSrcweir 
358*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
359*cdf0e10cSrcweir // class SdrPageProperties
360*cdf0e10cSrcweir 
361*cdf0e10cSrcweir class SVX_DLLPUBLIC SdrPageProperties : public SfxListener
362*cdf0e10cSrcweir {
363*cdf0e10cSrcweir private:
364*cdf0e10cSrcweir     // data
365*cdf0e10cSrcweir     SdrPage*                mpSdrPage;
366*cdf0e10cSrcweir     SfxStyleSheet*          mpStyleSheet;
367*cdf0e10cSrcweir     SfxItemSet*             mpProperties;
368*cdf0e10cSrcweir 
369*cdf0e10cSrcweir     // internal helpers
370*cdf0e10cSrcweir 	void ImpRemoveStyleSheet();
371*cdf0e10cSrcweir 	void ImpAddStyleSheet(SfxStyleSheet& rNewStyleSheet);
372*cdf0e10cSrcweir 
373*cdf0e10cSrcweir     // not implemented
374*cdf0e10cSrcweir 	SdrPageProperties& operator=(const SdrPageProperties& rCandidate);
375*cdf0e10cSrcweir 
376*cdf0e10cSrcweir public:
377*cdf0e10cSrcweir     // construct/destruct
378*cdf0e10cSrcweir 	SdrPageProperties(SdrPage& rSdrPage);
379*cdf0e10cSrcweir     virtual ~SdrPageProperties();
380*cdf0e10cSrcweir 
381*cdf0e10cSrcweir 	// Notify(...) from baseclass SfxListener
382*cdf0e10cSrcweir 	virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint);
383*cdf0e10cSrcweir 
384*cdf0e10cSrcweir     // data read/write
385*cdf0e10cSrcweir     const SfxItemSet& GetItemSet() const;
386*cdf0e10cSrcweir 	void PutItemSet(const SfxItemSet& rSet);
387*cdf0e10cSrcweir 	void PutItem(const SfxPoolItem& rItem);
388*cdf0e10cSrcweir 	void ClearItem(const sal_uInt16 nWhich = 0);
389*cdf0e10cSrcweir 
390*cdf0e10cSrcweir     // StyleSheet access
391*cdf0e10cSrcweir     void SetStyleSheet(SfxStyleSheet* pStyleSheet);
392*cdf0e10cSrcweir     SfxStyleSheet* GetStyleSheet() const;
393*cdf0e10cSrcweir };
394*cdf0e10cSrcweir 
395*cdf0e10cSrcweir ////////////////////////////////////////////////////////////////////////////////////////////////////
396*cdf0e10cSrcweir // class SdrPage
397*cdf0e10cSrcweir 
398*cdf0e10cSrcweir class SVX_DLLPUBLIC SdrPage : public SdrObjList, public tools::WeakBase< SdrPage >
399*cdf0e10cSrcweir {
400*cdf0e10cSrcweir 	///////////////////////////////////////////////////////////////////////////////
401*cdf0e10cSrcweir 	// start PageUser section
402*cdf0e10cSrcweir private:
403*cdf0e10cSrcweir 	// #111111# PageUser section
404*cdf0e10cSrcweir 	sdr::PageUserVector												maPageUsers;
405*cdf0e10cSrcweir 
406*cdf0e10cSrcweir public:
407*cdf0e10cSrcweir 	void AddPageUser(sdr::PageUser& rNewUser);
408*cdf0e10cSrcweir 	void RemovePageUser(sdr::PageUser& rOldUser);
409*cdf0e10cSrcweir 
410*cdf0e10cSrcweir 	///////////////////////////////////////////////////////////////////////////////
411*cdf0e10cSrcweir 	// end PageUser section
412*cdf0e10cSrcweir 
413*cdf0e10cSrcweir 	///////////////////////////////////////////////////////////////////////////////
414*cdf0e10cSrcweir 	// #110094# DrawContact section
415*cdf0e10cSrcweir private:
416*cdf0e10cSrcweir 	sdr::contact::ViewContact*										mpViewContact;
417*cdf0e10cSrcweir protected:
418*cdf0e10cSrcweir 	virtual sdr::contact::ViewContact* CreateObjectSpecificViewContact();
419*cdf0e10cSrcweir public:
420*cdf0e10cSrcweir 	sdr::contact::ViewContact& GetViewContact() const;
421*cdf0e10cSrcweir 
422*cdf0e10cSrcweir 	// #110094# DrawContact support: Methods for handling Page changes
423*cdf0e10cSrcweir 	void ActionChanged() const;
424*cdf0e10cSrcweir 
425*cdf0e10cSrcweir 	// #i9076#
426*cdf0e10cSrcweir 	friend class SdrModel;
427*cdf0e10cSrcweir 	friend class SvxUnoDrawPagesAccess;
428*cdf0e10cSrcweir 
429*cdf0e10cSrcweir // this class uses its own UNO wrapper
430*cdf0e10cSrcweir // and thus has to set mxUnoPage
431*cdf0e10cSrcweir friend class ChXChartDocument;
432*cdf0e10cSrcweir 
433*cdf0e10cSrcweir 	sal_Int32 nWdt;     // Seitengroesse
434*cdf0e10cSrcweir 	sal_Int32 nHgt;     // Seitengroesse
435*cdf0e10cSrcweir 	sal_Int32 nBordLft; // Seitenrand links
436*cdf0e10cSrcweir 	sal_Int32 nBordUpp; // Seitenrand oben
437*cdf0e10cSrcweir 	sal_Int32 nBordRgt; // Seitenrand rechts
438*cdf0e10cSrcweir 	sal_Int32 nBordLwr; // Seitenrand unten
439*cdf0e10cSrcweir 
440*cdf0e10cSrcweir 	// this is a weak reference to a possible living api wrapper for this page
441*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > mxUnoPage;
442*cdf0e10cSrcweir 
443*cdf0e10cSrcweir protected:
444*cdf0e10cSrcweir 	SdrLayerAdmin* 	    pLayerAdmin;
445*cdf0e10cSrcweir private:
446*cdf0e10cSrcweir     SdrPageProperties*  mpSdrPageProperties;
447*cdf0e10cSrcweir 
448*cdf0e10cSrcweir public:
449*cdf0e10cSrcweir     SdrPageProperties& getSdrPageProperties() { return *mpSdrPageProperties; }
450*cdf0e10cSrcweir     const SdrPageProperties& getSdrPageProperties() const { return *mpSdrPageProperties; }
451*cdf0e10cSrcweir     const SdrPageProperties* getCorrectSdrPageProperties() const;
452*cdf0e10cSrcweir 
453*cdf0e10cSrcweir protected:
454*cdf0e10cSrcweir 	// new MasterPageDescriptorVector
455*cdf0e10cSrcweir 	::sdr::MasterPageDescriptor*					mpMasterPageDescriptor;
456*cdf0e10cSrcweir 
457*cdf0e10cSrcweir 	SetOfByte  aPrefVisiLayers;
458*cdf0e10cSrcweir 	sal_uInt16     nPageNum;
459*cdf0e10cSrcweir 
460*cdf0e10cSrcweir     // bitfield
461*cdf0e10cSrcweir     unsigned            mbMaster : 1;               // flag if this is a MasterPage
462*cdf0e10cSrcweir     unsigned            mbInserted : 1;
463*cdf0e10cSrcweir     unsigned            mbObjectsNotPersistent : 1;
464*cdf0e10cSrcweir     unsigned            mbSwappingLocked : 1;
465*cdf0e10cSrcweir 
466*cdf0e10cSrcweir     // #i93597#
467*cdf0e10cSrcweir     unsigned            mbPageBorderOnlyLeftRight : 1;
468*cdf0e10cSrcweir 
469*cdf0e10cSrcweir     virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > createUnoPage();
470*cdf0e10cSrcweir 
471*cdf0e10cSrcweir public:
472*cdf0e10cSrcweir 	TYPEINFO();
473*cdf0e10cSrcweir 	SdrPage(SdrModel& rNewModel, bool bMasterPage=false);
474*cdf0e10cSrcweir 	// Copy-Ctor und Zuweisungeoperator sind nicht getestet!
475*cdf0e10cSrcweir 	SdrPage(const SdrPage& rSrcPage);
476*cdf0e10cSrcweir 	virtual ~SdrPage();
477*cdf0e10cSrcweir 	// pModel, pPage, pUpList, pOwnerObj und mbInserted werden Zuweisungeoperator nicht veraendert!
478*cdf0e10cSrcweir 	virtual void operator=(const SdrPage& rSrcPage);
479*cdf0e10cSrcweir 	virtual SdrPage* Clone() const;
480*cdf0e10cSrcweir 	virtual SdrPage* Clone(SdrModel* pNewModel) const;
481*cdf0e10cSrcweir 	bool IsMasterPage() const       { return mbMaster; }
482*cdf0e10cSrcweir 	void SetInserted(bool bNew = true);
483*cdf0e10cSrcweir 	FASTBOOL IsInserted() const         { return mbInserted; }
484*cdf0e10cSrcweir 	virtual void SetChanged();
485*cdf0e10cSrcweir 
486*cdf0e10cSrcweir 	// #i68775# React on PageNum changes (from Model in most cases)
487*cdf0e10cSrcweir 	void SetPageNum(sal_uInt16 nNew);
488*cdf0e10cSrcweir 	sal_uInt16 GetPageNum() const;
489*cdf0e10cSrcweir 
490*cdf0e10cSrcweir     // #i93597# Allow page border definition to not be the full rectangle but to
491*cdf0e10cSrcweir     // use only the left and right vertical edges (reportdesigner)
492*cdf0e10cSrcweir     void setPageBorderOnlyLeftRight(bool bNew) { mbPageBorderOnlyLeftRight = bNew; }
493*cdf0e10cSrcweir     bool getPageBorderOnlyLeftRight() const { return mbPageBorderOnlyLeftRight; }
494*cdf0e10cSrcweir 
495*cdf0e10cSrcweir 	virtual void SetSize(const Size& aSiz);
496*cdf0e10cSrcweir 	virtual Size GetSize() const;
497*cdf0e10cSrcweir 	virtual void SetOrientation(Orientation eOri);
498*cdf0e10cSrcweir 	virtual Orientation GetOrientation() const;
499*cdf0e10cSrcweir 	virtual sal_Int32 GetWdt() const;
500*cdf0e10cSrcweir 	virtual sal_Int32 GetHgt() const;
501*cdf0e10cSrcweir 	virtual void  SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr);
502*cdf0e10cSrcweir 	virtual void  SetLftBorder(sal_Int32 nBorder);
503*cdf0e10cSrcweir 	virtual void  SetUppBorder(sal_Int32 nBorder);
504*cdf0e10cSrcweir 	virtual void  SetRgtBorder(sal_Int32 nBorder);
505*cdf0e10cSrcweir 	virtual void  SetLwrBorder(sal_Int32 nBorder);
506*cdf0e10cSrcweir 	virtual sal_Int32 GetLftBorder() const;
507*cdf0e10cSrcweir 	virtual sal_Int32 GetUppBorder() const;
508*cdf0e10cSrcweir 	virtual sal_Int32 GetRgtBorder() const;
509*cdf0e10cSrcweir 	virtual sal_Int32 GetLwrBorder() const;
510*cdf0e10cSrcweir 
511*cdf0e10cSrcweir 	virtual void SetModel(SdrModel* pNewModel);
512*cdf0e10cSrcweir 
513*cdf0e10cSrcweir 	// New MasterPage interface
514*cdf0e10cSrcweir 	sal_Bool TRG_HasMasterPage() const { return (0L != mpMasterPageDescriptor); }
515*cdf0e10cSrcweir 	void TRG_SetMasterPage(SdrPage& rNew);
516*cdf0e10cSrcweir 	void TRG_ClearMasterPage();
517*cdf0e10cSrcweir 	SdrPage& TRG_GetMasterPage() const;
518*cdf0e10cSrcweir 	const SetOfByte& TRG_GetMasterPageVisibleLayers() const;
519*cdf0e10cSrcweir 	void TRG_SetMasterPageVisibleLayers(const SetOfByte& rNew);
520*cdf0e10cSrcweir 	sdr::contact::ViewContact& TRG_GetMasterPageDescriptorViewContact() const;
521*cdf0e10cSrcweir 
522*cdf0e10cSrcweir //#if 0 // _SOLAR__PRIVATE
523*cdf0e10cSrcweir protected:
524*cdf0e10cSrcweir 	void TRG_ImpMasterPageRemoved(const SdrPage& rRemovedPage);
525*cdf0e10cSrcweir //#endif // __PRIVATE
526*cdf0e10cSrcweir public:
527*cdf0e10cSrcweir 
528*cdf0e10cSrcweir 	// Aenderungen an den Layern setzen nicht das Modified-Flag !
529*cdf0e10cSrcweir 	const         SdrLayerAdmin& GetLayerAdmin() const                  { return *pLayerAdmin; }
530*cdf0e10cSrcweir 				  SdrLayerAdmin& GetLayerAdmin()                        { return *pLayerAdmin; }
531*cdf0e10cSrcweir 
532*cdf0e10cSrcweir 	// GetBitmap und GetMetafile sind noch nicht implementiert.
533*cdf0e10cSrcweir 	// Bitmap in Bildschirmaufloesung und -farbtiefe aus den Objekten der
534*cdf0e10cSrcweir 	// Page erzeugen.
535*cdf0e10cSrcweir 	Bitmap        GetBitmap(FASTBOOL bTrimBorders=sal_True) const               { return GetBitmap(aPrefVisiLayers,bTrimBorders); }
536*cdf0e10cSrcweir 	Bitmap        GetBitmap(const SetOfByte& rVisibleLayers, FASTBOOL bTrimBorders=sal_True) const;
537*cdf0e10cSrcweir 	// Metafile aus den Objekten der Page erzeugen
538*cdf0e10cSrcweir 	GDIMetaFile   GetMetaFile(FASTBOOL bTrimBorders=sal_True)                   { return GetMetaFile(aPrefVisiLayers,bTrimBorders); }
539*cdf0e10cSrcweir 	GDIMetaFile   GetMetaFile(const SetOfByte& rVisibleLayers, FASTBOOL bTrimBorders=sal_True);
540*cdf0e10cSrcweir 
541*cdf0e10cSrcweir 	virtual String GetLayoutName() const;
542*cdf0e10cSrcweir 
543*cdf0e10cSrcweir 	// fuer's Raster im Writer, auch fuer AlignObjects wenn 1 Objekt markiert ist
544*cdf0e10cSrcweir 	// wenn pRect!=NULL, dann die Seiten, die von diesem Rect intersected werden
545*cdf0e10cSrcweir 	// ansonsten die sichtbaren Seiten.
546*cdf0e10cSrcweir 	virtual const SdrPageGridFrameList* GetGridFrameList(const SdrPageView* pPV, const Rectangle* pRect) const;
547*cdf0e10cSrcweir 	bool IsObjectsNotPersistent() const          { return mbObjectsNotPersistent; }
548*cdf0e10cSrcweir 	void SetObjectsNotPersistent(bool b)     { mbObjectsNotPersistent = b; }
549*cdf0e10cSrcweir 	// Durch Setzen dieses Flags, kann das Auslagern (Swappen) von
550*cdf0e10cSrcweir 	// Teilen der Page (z.B. Grafiken) unterbunden werden.
551*cdf0e10cSrcweir 	// Es werden hierdurch jedoch nicht automatisch alle ausgelagerten
552*cdf0e10cSrcweir 	// Teile nachgeladen, dies geschieht erst bei konkretem Bedarf oder
553*cdf0e10cSrcweir 	// durch Aufruf von SwapInAll().
554*cdf0e10cSrcweir 	// Fuer die MasterPage(s) der Page muss dies ggf. separat gemacht werden.
555*cdf0e10cSrcweir 	bool IsSwappingLocked() const { return mbSwappingLocked; }
556*cdf0e10cSrcweir 	void SetSwappingLocked(bool bLock) { mbSwappingLocked = bLock; }
557*cdf0e10cSrcweir 
558*cdf0e10cSrcweir 	::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > getUnoPage();
559*cdf0e10cSrcweir 
560*cdf0e10cSrcweir 	virtual SfxStyleSheet* GetTextStyleSheetForObject( SdrObject* pObj ) const;
561*cdf0e10cSrcweir 
562*cdf0e10cSrcweir 	FASTBOOL HasTransparentObjects( sal_Bool bCheckForAlphaChannel = sal_False ) const;
563*cdf0e10cSrcweir 
564*cdf0e10cSrcweir 	/** *deprecated* returns an averaged background color of this page */
565*cdf0e10cSrcweir     // #i75566# GetBackgroundColor -> GetPageBackgroundColor
566*cdf0e10cSrcweir 	Color GetPageBackgroundColor() const;
567*cdf0e10cSrcweir 
568*cdf0e10cSrcweir 	/** *deprecated* returns an averaged background color of this page */
569*cdf0e10cSrcweir     // #i75566# GetBackgroundColor -> GetPageBackgroundColor and bScreenDisplay hint value
570*cdf0e10cSrcweir 	Color GetPageBackgroundColor( SdrPageView* pView, bool bScreenDisplay = true) const;
571*cdf0e10cSrcweir 
572*cdf0e10cSrcweir 	/** this method returns true if the object from the ViewObjectContact should
573*cdf0e10cSrcweir 		be visible on this page while rendering.
574*cdf0e10cSrcweir 		bEdit selects if visibility test is for an editing view or a final render,
575*cdf0e10cSrcweir 		like printing.
576*cdf0e10cSrcweir 	*/
577*cdf0e10cSrcweir 	virtual bool checkVisibility(
578*cdf0e10cSrcweir 		const sdr::contact::ViewObjectContact& rOriginal,
579*cdf0e10cSrcweir 		const sdr::contact::DisplayInfo& rDisplayInfo,
580*cdf0e10cSrcweir 		bool bEdit );
581*cdf0e10cSrcweir 
582*cdf0e10cSrcweir     /** Check if page is the HandoutMasterPage (in SVX, no PK_HANDOUT available) */
583*cdf0e10cSrcweir     bool isHandoutMasterPage() const;
584*cdf0e10cSrcweir 
585*cdf0e10cSrcweir     //////////////////////////////////////////////////////////////////////////////
586*cdf0e10cSrcweir     // sdr::Comment interface
587*cdf0e10cSrcweir private:
588*cdf0e10cSrcweir 	sdr::CommentVector									maComments;
589*cdf0e10cSrcweir 
590*cdf0e10cSrcweir public:
591*cdf0e10cSrcweir 	sal_uInt32 GetCommentCount() const { return maComments.size(); }
592*cdf0e10cSrcweir 	const sdr::Comment& GetCommentByIndex(sal_uInt32 nIndex);
593*cdf0e10cSrcweir 	void AddComment(const sdr::Comment& rNew);
594*cdf0e10cSrcweir 	void ReplaceCommentByIndex(sal_uInt32 nIndex, const sdr::Comment& rNew);
595*cdf0e10cSrcweir };
596*cdf0e10cSrcweir 
597*cdf0e10cSrcweir typedef tools::WeakReference< SdrPage > SdrPageWeakRef;
598*cdf0e10cSrcweir 
599*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
600*cdf0e10cSrcweir // use new redirector instead of pPaintProc
601*cdf0e10cSrcweir 
602*cdf0e10cSrcweir class SVX_DLLPUBLIC StandardCheckVisisbilityRedirector : public ::sdr::contact::ViewObjectContactRedirector
603*cdf0e10cSrcweir {
604*cdf0e10cSrcweir public:
605*cdf0e10cSrcweir 	StandardCheckVisisbilityRedirector();
606*cdf0e10cSrcweir 	virtual ~StandardCheckVisisbilityRedirector();
607*cdf0e10cSrcweir 
608*cdf0e10cSrcweir 	// all default implementations just call the same methods at the original. To do something
609*cdf0e10cSrcweir 	// different, overload the method and at least do what the method does.
610*cdf0e10cSrcweir 	virtual drawinglayer::primitive2d::Primitive2DSequence createRedirectedPrimitive2DSequence(
611*cdf0e10cSrcweir 		const sdr::contact::ViewObjectContact& rOriginal,
612*cdf0e10cSrcweir 		const sdr::contact::DisplayInfo& rDisplayInfo);
613*cdf0e10cSrcweir };
614*cdf0e10cSrcweir 
615*cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////////////
616*cdf0e10cSrcweir 
617*cdf0e10cSrcweir #endif //_SVDPAGE_HXX
618*cdf0e10cSrcweir 
619