Commits

Anonymous committed 713f7f2

swrefactordlusage02: intermediate commit for the refactoring

  • Participants
  • Parent commits 1bedb4a

Comments (0)

Files changed (124)

File sw/inc/IDocumentDrawModelAccess.hxx

 
 #include <svx/svdtypes.hxx>
 
+class SwDocShell;
 class SdrModel;
+class SdrObject;
 class SdrPageView;
 
 /** IDocumentDrawModelAccess
      */
     virtual const SdrModel* GetDrawModel() const = 0;
     virtual SdrModel* GetDrawModel() = 0;
-    virtual SdrModel* _MakeDrawModel() = 0;
+    virtual SdrModel* CreateDrawModel() = 0;
     virtual SdrModel* GetOrCreateDrawModel() = 0;
     virtual SdrLayerID GetHeavenId() const = 0;
     virtual SdrLayerID GetHellId() const = 0;
     virtual SdrLayerID GetInvisibleControlsId() const = 0;
 
     /** method to notify drawing page view about the invisible layers
-        OD 26.06.2003 #108784#
+
         @author OD
     */
     virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) = 0;
 
     /** method to determine, if a layer ID belongs to the visible ones.
-        OD 25.06.2003 #108784#
+
         Note: If given layer ID is unknown, method asserts and returns <false>.
+
         @author OD
 
         @param _nLayerId
 
     /** method to determine, if the corresponding visible layer ID for a invisible one.
 
-        OD 25.06.2003 #108784#
         Note: If given layer ID is a visible one, method returns given layer ID.
         Note: If given layer ID is unknown, method returns given layer ID.
 
 
     /** method to determine, if the corresponding invisible layer ID for a visible one.
 
-        OD 25.06.2003 #108784#
         Note: If given layer ID is a invisible one, method returns given layer ID.
         Note: If given layer ID is unknown, method returns given layer ID.
 
     */
     virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) = 0;
 
-protected:
+    virtual void DrawNotifyUndoHdl() = 0;
+    virtual bool IsKeepDrawUndoObj() const = 0;
+    virtual void SetKeepDrawUndoObj( bool bKeepDrawUndoObj ) = 0;
+    virtual void SetObjectShell( SwDocShell* pDocShell ) = 0;
+    virtual SdrObject* CloneSdrObj( const SdrObject&,
+                                    bool bMoveWithinDoc = false,
+                                    bool bInsInPage = true ) = 0;
 
     virtual ~IDocumentDrawModelAccess() {};
 };

File sw/inc/anchoredobject.hxx

 // <--
 class SwFrmFmt;
 class SwFmtAnchor;
+class SwDrawViewLayout;
 
 /** wrapper class for the positioning of Writer fly frames and drawing objects
 
     private:
         // drawing object representing the anchored object in the drawing layer
         SdrObject* mpDrawObj;
+        // drawing layer into which the drawing object is inserted.
+        SwDrawViewLayout* mpDrawViewLayout;
+
         // frame the object is anchored at
         SwFrm* mpAnchorFrm;
         // --> OD 2004-06-30 #i28701# - page frame the object is registered at
         virtual ~SwAnchoredObject();
 
         // accessors to member <mpDrawObj>
-        void SetDrawObj( SdrObject& _rDrawObj );
+        void ResetDrawObj();
         const SdrObject* GetDrawObj() const;
         SdrObject* DrawObj();
 

File sw/inc/dcontact.hxx

 class SwFlyFrm;
 class SwFrm;
 class SwPageFrm;
-class SwVirtFlyDrawObj;
+class SwFlyDrawViewObj;
 class SwFmtAnchor;
 class SwFlyDrawObj;
 class SwRect;
 #include <anchoreddrawobject.hxx>
 
 //Der Umgekehrte Weg: Sucht das Format zum angegebenen Objekt.
-//Wenn das Object ein SwVirtFlyDrawObj ist so wird das Format von
+//Wenn das Object ein SwFlyDrawViewObj ist so wird das Format von
 //selbigem besorgt.
 //Anderfalls ist es eben ein einfaches Zeichenobjekt. Diese hat einen
 //UserCall und der ist Client vom gesuchten Format.
     // OD 2004-04-01 #i26791# - made methods pure virtual
     virtual const SdrObject *GetMaster() const = 0;
     virtual SdrObject *GetMaster() = 0;
-    virtual void SetMaster( SdrObject* _pNewMaster ) = 0;
 
 		  SwFrmFmt	*GetFmt(){ return (SwFrmFmt*)GetRegisteredIn(); }
 	const SwFrmFmt	*GetFmt() const
 
 class SW_DLLPUBLIC SwFlyDrawContact : public SwContact
 {
-private:
-    // OD 2004-04-01 #i26791#
-    SwFlyDrawObj* mpMasterObj;
-
-    /** method to determine new order number for new instance of <SwVirtFlyDrawObj>
-
-        OD 2004-08-16 #i27030#
-        Used in method <CreateNewRef(..)>.
-
-        @author OD
-    */
-    sal_uInt32 _GetOrdNumForNewRef( const SwFlyFrm* pFlyFrm );
-
 public:
 	TYPEINFO();
 
     // OD 2004-04-01 #i26791#
     virtual const SdrObject* GetMaster() const;
     virtual SdrObject* GetMaster();
-    virtual void SetMaster( SdrObject* _pNewMaster );
-
-    SwVirtFlyDrawObj* CreateNewRef( SwFlyFrm* pFly );
 
 	// virtuelle Methoden von SwClient
 	virtual void Modify( SfxPoolItem *pOld, SfxPoolItem *pNew );
         // OD 2004-04-01 #i26791#
         virtual const SdrObject* GetMaster() const;
         virtual SdrObject* GetMaster();
-        virtual void SetMaster( SdrObject* _pNewMaster );
 
         // OD 2004-03-29 #i26791#
         const SwFrm* GetAnchorFrm( const SdrObject* _pDrawObj = 0L ) const;
         // das Notifien von Absaetzen, die ausweichen muessen
         void _Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectangle* pOldBoundRect);
 
-        //Moved alle SW-Verbindungen zu dem neuen Master.
-        void ChangeMasterObject( SdrObject *pNewMaster );
-
         // OD 19.06.2003 #108784#
         SwDrawVirtObj* AddVirtObj();
 

File sw/inc/doc.hxx

 class OutputDevice;
 class Point;
 class SbxArray;
-class SdrModel;
 class SdrObject;
-class SdrUndoAction;
 class VirtualDevice;
 class SfxPrinter;
 class SvNumberFormatter;
 struct SwSortOptions;
 struct SwDefTOXBase_Impl;
 struct SwPrintData;
-class SdrPageView;
 struct SwConversionArgs;
 class SwRewriter;
 class SwMsgPoolItem;
     public IDocumentLineNumberAccess,
     public IDocumentStatistics,
     public IDocumentState,
-    public IDocumentDrawModelAccess,
     public IDocumentLayoutAccess,
     public IDocumentTimerAccess,
     public IDocumentChartDataProviderAccess,
 	SwDefTOXBase_Impl * pDefTOXBases;	// defaults of SwTOXBase's
 
 	SwRootFrm		*pLayout;			// Rootframe des spezifischen Layouts.
-	SdrModel		*pDrawModel;		// StarView Drawing
+    IDocumentDrawModelAccess* mpDocDrawModel; // Draw model for Writer document.
 
 	SwUndos 		*pUndos; 			// Undo/Redo History
 
     sal_Int32   mIdleBlockCount;
 	sal_Int8	nLockExpFld;		// Wenn != 0 hat UpdateExpFlds() keine Wirkung
 
-    /* Draw Model Layer IDs
-     * LayerIds, Heaven == ueber dem Dokument
-     * Hell   == unter dem Dokument
-     * Controls == ganz oben
-     */
-    SdrLayerID  nHeaven;
-    SdrLayerID  nHell;
-    SdrLayerID  nControls;
-    SdrLayerID  nInvisibleHeaven;
-    SdrLayerID  nInvisibleHell;
-    SdrLayerID  nInvisibleControls;
-
     bool mbGlossDoc              : 1;    //TRUE: ist ein Textbaustein Dokument
     bool mbModified              : 1;    //TRUE: Dokument ist veraendert
     bool mbDtor                  : 1;    //TRUE: ist im SwDoc DTOR
     bool mbNewDoc                : 1;    // TRUE: neues Doc
     bool mbNewFldLst             : 1;    // TRUE: Felder-Liste neu aufbauen
     bool mbCopyIsMove            : 1;    // TRUE: Copy ist ein verstecktes Move
-    bool mbNoDrawUndoObj         : 1;    // TRUE: keine DrawUndoObjecte speichern
     bool mbVisibleLinks          : 1;    // TRUE: Links werden sichtbar eingefuegt
     bool mbBrowseMode            : 1;    // TRUE: Dokument im BrowseModus anzeigen
     bool mbInReading             : 1;    // TRUE: Dokument wird gerade gelesen
 
     sal_Bool DelUndoObj( sal_uInt16 nEnde  );   // loescht alle UndoObjecte vom Anfang
 										// bis zum angegebenen Ende
-	DECL_LINK( AddDrawUndo, SdrUndoAction * );
-										// DrawModel
-	void DrawNotifyUndoHdl();	// wegen CLOOKs
 
 		// nur fuer den internen Gebrauch deshalb privat.
 		// Kopieren eines Bereiches im oder in ein anderes Dokument !
 								const String& rFormel,
 								SvStringsDtor& rUsedDBNames );
 
-	void InitDrawModel();
-	void ReleaseDrawModel();
-
 	void _CreateNumberFormatter();
 
 	sal_Bool _UnProtectTblCells( SwTable& rTbl );
 	virtual void SetUpdateExpFldStat(bool b);
 	virtual void SetLoaded(bool b);
 
-    /** IDocumentDrawModelAccess
-    */
-    virtual const SdrModel* GetDrawModel() const;
-    virtual SdrModel* GetDrawModel();
-    virtual SdrLayerID GetHeavenId() const;
-    virtual SdrLayerID GetHellId() const;
-    virtual SdrLayerID GetControlsId() const;
-    virtual SdrLayerID GetInvisibleHeavenId() const;
-    virtual SdrLayerID GetInvisibleHellId() const;
-    virtual SdrLayerID GetInvisibleControlsId() const;
-    virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView );
-    virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const;
-    virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId );
-    virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId );
-    virtual SdrModel* _MakeDrawModel();
-    virtual SdrModel* GetOrCreateDrawModel();
-
     /** IDocumentLayoutAccess
     */
     virtual const SwRootFrm* GetRootFrm() const ;
     /** INextInterface here
     */
 
+    IDocumentDrawModelAccess& GetDocDrawModel();
+    const IDocumentDrawModelAccess& GetDocDrawModel() const;
+
     DECL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem *);
     DECL_LINK(CalcFieldValueHdl, EditFieldInfo*);
 
     bool IsCopyIsMove() const              { return mbCopyIsMove; }
     void SetCopyIsMove( bool bFlag )        { mbCopyIsMove = bFlag; }
 
-	// fuers Draw-Undo: Aktionen auf Flys wollen wir selbst behandeln
-    bool IsNoDrawUndoObj() const           { return mbNoDrawUndoObj; }
-    void SetNoDrawUndoObj( bool bFlag )    { mbNoDrawUndoObj = bFlag; }
 	SwDrawContact* GroupSelection( SdrView& );
 	void UnGroupSelection( SdrView& );
 	sal_Bool DeleteSelection( SwDrawView& );
 	void SpellItAgainSam( sal_Bool bInvalid, sal_Bool bOnlyWrong, sal_Bool bSmartTags );
 	void InvalidateAutoCompleteFlag();
 
-    // <--
 	void SetCalcFieldValueHdl(Outliner* pOutliner);
 
 	// erfrage ob die ::com::sun::star::util::URL besucht war. Uebers Doc, falls nur ein ::com::sun::star::text::Bookmark
 	int Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest );
 	void Unchain( SwFrmFmt &rFmt );
 
-	// fuers Copy/Move aus der FrmShell
-	SdrObject* CloneSdrObj( const SdrObject&, sal_Bool bMoveWithinDoc = sal_False,
-							sal_Bool bInsInPage = sal_True );
-
 	//
 	// -------------------- FeShell - Schnittstellen Ende ------------------
 

File sw/inc/frmfmt.hxx

 class SwContact;
 class SdrObject;
 
+class SwFlyDrawObj;
+
 class SW_DLLPUBLIC SwFrmFmt: public SwFmt
 {
 	friend class SwDoc;
     virtual void SetPositionLayoutDir( const sal_Int16 _nPositionLayoutDir );
     // <--
 
+    virtual SdrObject* GetDrawModelObject() const;
+    virtual void HandleDrawViewObjChange( const SdrObject& rChangedDrawViewObj ) const;
+
     virtual String GetDescription() const;
 
 	DECL_FIXEDMEMPOOL_NEWDEL_DLL(SwFrmFmt)
 {
 	friend class SwDoc;
 
-	//Beide nicht vorhanden.
+    SwFlyDrawObj* mpFlyDrawObj;
+
+    // no copy constructor and no assignment operator
 	SwFlyFrmFmt( const SwFlyFrmFmt &rCpy );
 	SwFlyFrmFmt &operator=( const SwFlyFrmFmt &rCpy );
 
 protected:
-	SwFlyFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
-					SwFrmFmt *pDrvdFrm )
-		: SwFrmFmt( rPool, pFmtNm, pDrvdFrm, RES_FLYFRMFMT )
-	{}
-	SwFlyFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
-					SwFrmFmt *pDrvdFrm )
-		: SwFrmFmt( rPool, rFmtNm, pDrvdFrm, RES_FLYFRMFMT )
-	{}
+    SwFlyFrmFmt( SwAttrPool& rPool,
+                 const String &rFmtNm,
+                 SwFrmFmt *pDrvdFrm );
 
 public:
 	TYPEINFO();
     */
     sal_Bool IsBackgroundBrushInherited() const;
 
+    virtual SdrObject* GetDrawModelObject() const;
+
 	DECL_FIXEDMEMPOOL_NEWDEL(SwFlyFrmFmt)
 };
 
     }
     // <--
 
+    virtual SdrObject* GetDrawModelObject() const;
+    virtual void HandleDrawViewObjChange( const SdrObject& rChangedDrawViewObj ) const;
+
     virtual String GetDescription() const;
 
     DECL_FIXEDMEMPOOL_NEWDEL(SwDrawFrmFmt);

File sw/inc/sw_primitivetypes2d.hxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 
 //////////////////////////////////////////////////////////////////////////////
 
-#define PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D				(PRIMITIVE2D_ID_RANGE_SW| 0)
-#define PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE					(PRIMITIVE2D_ID_RANGE_SW| 1)
-#define PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE					(PRIMITIVE2D_ID_RANGE_SW| 2)
+#define PRIMITIVE2D_ID_SWFLYDRAWVIEWOBJPRIMITIVE2D  (PRIMITIVE2D_ID_RANGE_SW| 0)
+#define PRIMITIVE2D_ID_SWPOSTITANKORPRIMITIVE       (PRIMITIVE2D_ID_RANGE_SW| 1)
+#define PRIMITIVE2D_ID_SWPOSTITSHADOWPRIMITIVE      (PRIMITIVE2D_ID_RANGE_SW| 2)
 
 //////////////////////////////////////////////////////////////////////////////
 

File sw/source/core/access/acccell.hxx

  ************************************************************************/
 #ifndef _ACCCELL_HXX
 #define _ACCCELL_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
 
 class SwCellFrm;
+class SwFrmFmt;
 
 class SwAccessibleCell : public	SwAccessibleContext,
                   ::com::sun::star::accessibility::XAccessibleValue

File sw/source/core/access/acccontext.cxx

 #include <crsrsh.hxx>
 #include "fesh.hxx"
 #include <txtfrm.hxx>
+#include <pagefrm.hxx>
+#include <flyfrm.hxx>
+#include <layfrm.hxx>
+#include <flydrawviewobj.hxx>
 #include <ndtxt.hxx>
 #include <pam.hxx>
 #include <viewimp.hxx>
 #include <accmap.hxx>
 #include <accfrmobjslist.hxx>
-#ifndef _ACCCONTEXT_HXX
 #include <acccontext.hxx>
-#endif
 #include <svx/AccessibleShape.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
 
 	if( GetFrm()->IsFlyFrm() )
 	{
 		const SdrObject *pObj =
-			static_cast < const SwFlyFrm * >( GetFrm() )->GetVirtDrawObj();
+            static_cast < const SwFlyFrm * >( GetFrm() )->GetFlyDrawViewObj();
 		if( pObj )
 			Select( const_cast < SdrObject * >( pObj ), sal_False );
 	}

File sw/source/core/access/accfootnote.hxx

  ************************************************************************/
 #ifndef _ACCFOOTNOTE_HXX
 #define _ACCFOOTNOTE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
+
+#include <sal/types.h>
+
+class SwFtnFrm;
 
 class SwAccessibleFootnote : public SwAccessibleContext
 {

File sw/source/core/access/accframe.hxx

 #define _ACCFRAME_HXX
 
 #include <sal/types.h>
+#include <tools/string.hxx>
 
 #include <list>
 #include <accfrmobj.hxx>
 
+class ViewShell;
+
 // Any method of this class must be called with an acquired solar mutex!
 
 class SwAccessibleMap;

File sw/source/core/access/accframebase.hxx

  ************************************************************************/
 #ifndef _ACCFRAMEBASE_HXX
 #define _ACCFRAMEBASE_HXX
-#ifndef _ACCCONTEXT_HXX
-#include "acccontext.hxx"
-#endif
+
+#include <acccontext.hxx>
+#include <calbck.hxx>
 
 class SwFlyFrm;
 

File sw/source/core/access/accfrmobj.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
+#include <accfrmobj.hxx>
 
+#include <flyfrm.hxx>
+#include <pagefrm.hxx>
+#include <flydrawviewobj.hxx>
+#include <swtable.hxx>
 #include <frmfmt.hxx>
 #include <fmtanchr.hxx>
-#include <accfrmobj.hxx>
 #include <dcontact.hxx>
 #include <cellfrm.hxx>
 
+void SwFrmOrObj::Init( const SdrObject *pO )
+{
+    pObj = pO;
+    // #110094#-1
+    pFrm = pObj && pObj->ISA(SwFlyDrawViewObj)
+                ? static_cast < const SwFlyDrawViewObj * >( pObj )->GetFlyFrm()
+                : 0;
+}
+
+void SwFrmOrObj::Init( const SwFrm *pF )
+{
+    pFrm = pF;
+    pObj = pFrm && pFrm->IsFlyFrm()
+                ? static_cast < const SwFlyFrm * >( pFrm )->GetFlyDrawViewObj()
+                : 0;
+}
+
+SwFrmOrObj::SwFrmOrObj() :
+    pObj( 0 ), pFrm( 0 )
+{}
+
+SwFrmOrObj::SwFrmOrObj( const SdrObject *pO )
+{
+    Init( pO );
+}
+
+SwFrmOrObj::SwFrmOrObj( const SwFrm *pF )
+{
+    Init( pF );
+}
+
+SwFrmOrObj::SwFrmOrObj( const SwFrm *pF, const SdrObject *pO )
+{
+    if( pF )
+        Init( pF );
+    else
+        Init( pO );
+    ASSERT( (!pF || pF == pFrm) && (!pO || pO == pObj),
+            "invalid frame/object combination" );
+
+}
+
+SwFrmOrObj::SwFrmOrObj( const SwFrmOrObj& r ) :
+    pObj( r.pObj ), pFrm( r.pFrm )
+{}
+
+SwFrmOrObj& SwFrmOrObj::operator=( const SwFrmOrObj& r )
+{
+    pObj = r.pObj;
+    pFrm = r.pFrm;
+    return *this;
+}
+
+SwFrmOrObj& SwFrmOrObj::operator=( const SdrObject *pO )
+{
+    Init( pO );
+    return *this;
+}
+
+SwFrmOrObj& SwFrmOrObj::operator=( const SwFrm *pF )
+{
+    Init( pF );
+    return *this;
+}
+
+sal_Bool SwFrmOrObj::operator==( const SwFrmOrObj& r ) const
+{
+    return pObj == r.pObj && pFrm == r.pFrm;
+}
+
+sal_Bool SwFrmOrObj::operator==( const SdrObject *pO ) const
+{
+    return pObj == pO;
+}
+
+sal_Bool SwFrmOrObj::operator==( const SwFrm *pF ) const
+{
+    return pFrm == pF;
+}
+
+sal_Bool SwFrmOrObj::IsValid() const
+{
+    return pObj != 0 || pFrm != 0;
+}
+
+const SdrObject *SwFrmOrObj::GetSdrObject() const
+{
+    return pObj;
+}
+
+const SwFrm *SwFrmOrObj::GetSwFrm() const
+{
+    return pFrm;
+}
+
+sal_Bool SwFrmOrObj::IsVisibleChildrenOnly() const
+{
+    return !pFrm || pFrm->IsRootFrm() ||
+           !( pFrm->IsTabFrm() || pFrm->IsInTab() ||
+              ( IsBoundAsChar() &&
+                static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm()->IsInTab()) );
+}
+
+SwRect SwFrmOrObj::GetBox() const
+{
+    if( pFrm )
+    {
+        if( pFrm->IsPageFrm() &&
+            static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
+        {
+            SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 1, 1 );
+            return aBox;
+        }
+        else if ( pFrm->IsTabFrm() )
+        {
+            SwRect aBox( pFrm->Frm() );
+            aBox.Intersection( pFrm->GetUpper()->Frm() );
+            return aBox;
+        }
+        else
+            return pFrm->Frm();
+    }
+    else if( pObj )
+        return SwRect( pObj->GetCurrentBoundRect() );
+    else
+        return SwRect();
+}
+
+SwRect SwFrmOrObj::GetBounds() const
+{
+    if( pFrm )
+    {
+        if( pFrm->IsPageFrm() &&
+            static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
+        {
+            SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 0, 0 );
+            return aBox;
+        }
+        else
+            return pFrm->PaintArea();
+    }
+    else if( pObj )
+        return SwRect( pObj->GetCurrentBoundRect() );
+    return SwRect();
+}
 sal_Bool SwFrmOrObj::IsAccessible( sal_Bool bPagePreview ) const
 {
     return ( pFrm && pFrm->IsAccessibleFrm() &&

File sw/source/core/access/accfrmobj.hxx

  ************************************************************************/
 #ifndef _ACCFRMOBJ_HXX
 #define _ACCFRMOBJ_HXX
-#include <flyfrm.hxx>
-#include <pagefrm.hxx>
-#include <dflyobj.hxx>
-#include <swtable.hxx>
+
+#include <sal/types.h>
+#include <swrect.hxx>
+
+class SdrObject;
+class SwFrm;
 
 class SwFrmOrObj
 {
 	const SdrObject *pObj;
 	const SwFrm	*pFrm;
 
-	inline void Init( const SdrObject *pO );
-	inline void Init( const SwFrm *pF );
+    void Init( const SdrObject *pO );
+    void Init( const SwFrm *pF );
 
 public:
 
-	inline SwFrmOrObj();
-	inline SwFrmOrObj( const SdrObject *pO );
-	inline SwFrmOrObj( const SwFrm *pF );
-	inline SwFrmOrObj( const SwFrm *pF, const SdrObject *pO );
-	inline SwFrmOrObj( const SwFrmOrObj& r );
+    SwFrmOrObj();
+    SwFrmOrObj( const SdrObject *pO );
+    SwFrmOrObj( const SwFrm *pF );
+    SwFrmOrObj( const SwFrm *pF, const SdrObject *pO );
+    SwFrmOrObj( const SwFrmOrObj& r );
 
-	inline SwFrmOrObj& operator=( const SwFrmOrObj& r );
-	inline SwFrmOrObj& operator=( const SdrObject *pO );
-	inline SwFrmOrObj& operator=( const SwFrm *pF );
+    SwFrmOrObj& operator=( const SwFrmOrObj& r );
+    SwFrmOrObj& operator=( const SdrObject *pO );
+    SwFrmOrObj& operator=( const SwFrm *pF );
 
-	inline sal_Bool operator==( const SwFrmOrObj& r ) const;
-	inline sal_Bool operator==( const SdrObject *pO ) const;
-	inline sal_Bool operator==( const SwFrm *pF ) const;
+    sal_Bool operator==( const SwFrmOrObj& r ) const;
+    sal_Bool operator==( const SdrObject *pO ) const;
+    sal_Bool operator==( const SwFrm *pF ) const;
 
-	inline sal_Bool IsValid() const;
+    sal_Bool IsValid() const;
 
-	inline const SdrObject *GetSdrObject() const;
-	inline const SwFrm *GetSwFrm() const;
+    const SdrObject *GetSdrObject() const;
+    const SwFrm *GetSwFrm() const;
 
     sal_Bool IsAccessible( sal_Bool bPagePreview ) const;
 	sal_Bool IsBoundAsChar() const;
-	inline sal_Bool IsVisibleChildrenOnly() const;
-	inline SwRect GetBox() const;
-	inline SwRect GetBounds() const;
+    sal_Bool IsVisibleChildrenOnly() const;
+    SwRect GetBox() const;
+    SwRect GetBounds() const;
 };
 
-inline void SwFrmOrObj::Init( const SdrObject *pO )
-{
-	pObj = pO;
-	// #110094#-1
-	pFrm = pObj && pObj->ISA(SwVirtFlyDrawObj)
-				? static_cast < const SwVirtFlyDrawObj * >( pObj )->GetFlyFrm()
-				: 0;
-}
-
-inline void SwFrmOrObj::Init( const SwFrm *pF )
-{
-	pFrm = pF;
-	pObj = pFrm && pFrm->IsFlyFrm()
-				? static_cast < const SwFlyFrm * >( pFrm )->GetVirtDrawObj()
-				: 0;
-}
-
-inline SwFrmOrObj::SwFrmOrObj() :
-	pObj( 0 ), pFrm( 0 )
-{}
-
-inline SwFrmOrObj::SwFrmOrObj( const SdrObject *pO )
-{
-	Init( pO );
-}
-
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF )
-{
-	Init( pF );
-}
-
-inline SwFrmOrObj::SwFrmOrObj( const SwFrm *pF, const SdrObject *pO )
-{
-	if( pF )
-		Init( pF );
-	else
-		Init( pO );
-	ASSERT( (!pF || pF == pFrm) && (!pO || pO == pObj),
-			"invalid frame/object combination" );
-
-}
-
-inline SwFrmOrObj::SwFrmOrObj( const SwFrmOrObj& r ) :
-	pObj( r.pObj ), pFrm( r.pFrm )
-{}
-
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrmOrObj& r )
-{
-	pObj = r.pObj;
-	pFrm = r.pFrm;
-    return *this;
-}
-
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SdrObject *pO )
-{
-	Init( pO );
-	return *this;
-}
-
-inline SwFrmOrObj& SwFrmOrObj::operator=( const SwFrm *pF )
-{
-	Init( pF );
-	return *this;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SwFrmOrObj& r ) const
-{
-	return pObj == r.pObj && pFrm == r.pFrm;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SdrObject *pO ) const
-{
-	return pObj == pO;
-}
-
-inline sal_Bool SwFrmOrObj::operator==( const SwFrm *pF ) const
-{
-	return pFrm == pF;
-}
-
-inline sal_Bool SwFrmOrObj::IsValid() const
-{
-	return pObj != 0 || pFrm != 0;
-}
-
-inline const SdrObject *SwFrmOrObj::GetSdrObject() const
-{
-	return pObj;
-}
-
-inline const SwFrm *SwFrmOrObj::GetSwFrm() const
-{
-	return pFrm;
-}
-
-inline sal_Bool SwFrmOrObj::IsVisibleChildrenOnly() const
-{
-    return !pFrm || pFrm->IsRootFrm() ||
-           !( pFrm->IsTabFrm() || pFrm->IsInTab() ||
-              ( IsBoundAsChar() &&
-                static_cast<const SwFlyFrm*>(pFrm)->GetAnchorFrm()->IsInTab()) );
-}
-
-inline SwRect SwFrmOrObj::GetBox() const
-{
-	if( pFrm )
-	{
-		if( pFrm->IsPageFrm() &&
-			static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
-		{
-			SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 1, 1 );
-			return aBox;
-		}
-		else if ( pFrm->IsTabFrm() )
-		{
-			SwRect aBox( pFrm->Frm() );
-			aBox.Intersection( pFrm->GetUpper()->Frm() );
-			return aBox;
-		}
-		else
-			return pFrm->Frm();
-	}
-	else if( pObj )
-		return SwRect( pObj->GetCurrentBoundRect() );
-	else
-		return SwRect();
-}
-
-inline SwRect SwFrmOrObj::GetBounds() const
-{
-	if( pFrm )
-	{
-		if( pFrm->IsPageFrm() &&
-			static_cast< const SwPageFrm * >( pFrm )->IsEmptyPage() )
-		{
-			SwRect aBox( pFrm->Frm().Left(), pFrm->Frm().Top()-1, 0, 0 );
-			return aBox;
-		}
-		else
-			return pFrm->PaintArea();
-	}
-	else if( pObj )
-		return SwRect( pObj->GetCurrentBoundRect() );
-	return SwRect();
-}
-
-
 #endif

File sw/source/core/access/accfrmobjmap.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
+#include <accfrmobjmap.hxx>
 
 #include <doc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <frmfmt.hxx>
 #include <pagefrm.hxx>
 #include <txtfrm.hxx>
+#include <anchoredobject.hxx>
 #include <node.hxx>
 // OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
 
-#ifndef _ACCFFRMOBJMAP_HXX
-#include <accfrmobjmap.hxx>
-#endif
+#include <svx/svdobj.hxx>
 
 ::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert(
 		sal_uInt32 nPos, const SwFrmOrObj& rLower )
 {
 	if( !bLayerIdsValid )
 	{
-		nHellId = pDoc->GetHellId();
-		nControlsId = pDoc->GetControlsId();
+        nHellId = pDoc->GetDocDrawModel().GetHellId();
+        nControlsId = pDoc->GetDocDrawModel().GetControlsId();
 		bLayerIdsValid = sal_True;
 	}
 
 		}
 	}
 }
+
+sal_Bool SwFrmOrObjMap::IsSortingRequired( const SwFrm *pFrm )
+{
+    return ( pFrm->IsPageFrm() &&
+             static_cast< const SwPageFrm * >( pFrm )->GetSortedObjs() ) ||
+            (pFrm->IsTxtFrm() && pFrm->GetDrawObjs() );
+}

File sw/source/core/access/accfrmobjmap.hxx

 #define _ACCFRMOBJMAP_HXX
 #include <accfrmobj.hxx>
 
+#include <svx/svdtypes.hxx>
+
 #include <map>
 
 class SwDoc;
 
 public:
 
-	inline SwFrmOrObjMapKey();
-	inline SwFrmOrObjMapKey( LayerId eId, sal_uInt32 nOrd );
+    inline SwFrmOrObjMapKey()
+        : eLayerId( INVALID ),
+          nOrdNum( 0 )
+    {
+    }
+
+    inline SwFrmOrObjMapKey( LayerId eId, sal_uInt32 nOrd )
+        : eLayerId( eId ),
+          nOrdNum( nOrd )
+    {
+    }
+
 
 	inline sal_Bool operator()( const SwFrmOrObjMapKey& r1,
-							 	const SwFrmOrObjMapKey& r2 ) const;
+                                const SwFrmOrObjMapKey& r2 ) const
+    {
+        return (r1.eLayerId == r2.eLayerId) ? (r1.nOrdNum < r2.nOrdNum) :
+               (r1.eLayerId < r2.eLayerId);
+    }
+
 };
 
 typedef ::std::map < SwFrmOrObjMapKey, SwFrmOrObj, SwFrmOrObjMapKey >
 
 	SwFrmOrObjMap( const SwRect& rVisArea, const SwFrm *pFrm );
 
-	inline static sal_Bool IsSortingRequired( const SwFrm *pFrm );
+    static sal_Bool IsSortingRequired( const SwFrm *pFrm );
 };
-
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey() :
-	eLayerId( INVALID ),
-	nOrdNum( 0 )
-{
-}
-
-inline SwFrmOrObjMapKey::SwFrmOrObjMapKey(
-		LayerId eId, sal_uInt32 nOrd ) :
-	eLayerId( eId ),
-	nOrdNum( nOrd )
-{
-}
-
-inline sal_Bool SwFrmOrObjMapKey::operator()(
-		const SwFrmOrObjMapKey& r1,
-		const SwFrmOrObjMapKey& r2 ) const
-{
-	return (r1.eLayerId == r2.eLayerId) ? (r1.nOrdNum < r2.nOrdNum) :
-		   (r1.eLayerId < r2.eLayerId);
-}
-
-inline sal_Bool SwFrmOrObjMap::IsSortingRequired( const SwFrm *pFrm )
-{
-	return ( pFrm->IsPageFrm() &&
-			 static_cast< const SwPageFrm * >( pFrm )->GetSortedObjs() ) ||
-		    (pFrm->IsTxtFrm() && pFrm->GetDrawObjs() );
-}
-
 #endif
-

File sw/source/core/access/accfrmobjslist.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
+#include <accfrmobjslist.hxx>
 
 #include <pagefrm.hxx>
+#include <anchoredobject.hxx>
 // OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
-#include <accfrmobjslist.hxx>
 
 
 SwFrmOrObjSList_const_iterator::SwFrmOrObjSList_const_iterator(

File sw/source/core/access/accmap.cxx

 #include <map>
 #include <list>
 #include <accmap.hxx>
-#ifndef _ACCCONTEXT_HXX
 #include <acccontext.hxx>
-#endif
 #include <accdoc.hxx>
 #include <accpreview.hxx>
 #include <accpage.hxx>
 #include <cellfrm.hxx>
 #include <tabfrm.hxx>
 #include <pagefrm.hxx>
+#include <flyfrm.hxx>
 #include <ndtyp.hxx>
-#ifndef IDOCUMENTDRAWMODELACCESS_HXX_INCLUDED
 #include <IDocumentDrawModelAccess.hxx>
-#endif
 #include <svx/ShapeTypeHandler.hxx>
 #include <vcl/svapp.hxx>
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <pam.hxx>
 #include <ndtxt.hxx>
 // <--
+#include <dflyobj.hxx>
+#include <flydrawviewobj.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
     if ( !pSdrHint ||
          ( pSdrHint->GetObject() &&
            ( pSdrHint->GetObject()->ISA(SwFlyDrawObj) ||
-             pSdrHint->GetObject()->ISA(SwVirtFlyDrawObj) ||
+             pSdrHint->GetObject()->ISA(SwFlyDrawViewObj) ||
              IS_TYPE(SdrObject,pSdrHint->GetObject()) ) ) )
     {
         return;

File sw/source/core/access/accpara.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 #include <txtfrm.hxx>
+#include <flyfrm.hxx>
+#include <layfrm.hxx>
 #include <ndtxt.hxx>
 #include <pam.hxx>
 #include <unoobj.hxx>

File sw/source/core/access/accselectionhelper.cxx

 #include "fesh.hxx"
 #include <vcl/svapp.hxx>        // for SolarMutex
 #include <tools/debug.hxx>
+#include <flyfrm.hxx>
 
 
 using namespace ::com::sun::star;

File sw/source/core/access/acctable.hxx

 class SwTabFrm;
 class SwAccessibleTableData_Impl;
 class SwTableBox;
+class SwSelBoxes;
 
 class SwAccessibleTable :
 		public SwAccessibleContext,

File sw/source/core/attr/format.cxx

  * Document Interface Access
  */
 const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return GetDoc(); }
-const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
-IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
+const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return &(GetDoc()->GetDocDrawModel()); }
+IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return &(GetDoc()->GetDocDrawModel()); }
 const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
 IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
 IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }

File sw/source/core/crsr/trvlfnfl.cxx

 #include <ftnfrm.hxx>
 #include <viewimp.hxx>
 #include <swcrsr.hxx>
-#include <dflyobj.hxx>
+#include <flydrawviewobj.hxx>
 #include <ndtxt.hxx>
 #include <flyfrm.hxx>
 #include <txtfrm.hxx>

File sw/source/core/doc/dbgoutsw.cxx

             aTmpStr += String("(", RTL_TEXTENCODING_ASCII_US);
             aTmpStr += String::CreateFromInt32
                 //(static_cast<SwTxtFmtColl *>(pColl)->GetOutlineLevel());//#outline level,zhaojianwei
-				(static_cast<SwTxtFmtColl *>(pColl)->GetAssignedOutlineStyleLevel());//<-end,zhaojianwei
+				(static_cast<SwTxtFmtColl *>(pColl)->GetAttrOutlineLevel());//<-end,zhaojianwei
 
             const SwNumRuleItem & rItem =
                 static_cast<const SwNumRuleItem &>

File sw/source/core/doc/doc.cxx

 #include <osl/diagnose.h>
 #include <osl/interlck.h>
 
+#include <docdrawmodel.hxx>
+
 /* @@@MAINTAINABILITY-HORROR@@@
    Probably unwanted dependency on SwDocShell
 */
         xForbiddenCharsTable = new SvxForbiddenCharactersTable( xMSF );
     }
     xForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
-    if( pDrawModel )
+    if ( GetDocDrawModel().GetDrawModel() )
     {
-        pDrawModel->SetForbiddenCharsTable( xForbiddenCharsTable );
+        GetDocDrawModel().GetDrawModel()->SetForbiddenCharsTable( xForbiddenCharsTable );
         if( !mbInReading )
-            pDrawModel->ReformatAllTextObjects();
+            GetDocDrawModel().GetDrawModel()->ReformatAllTextObjects();
     }
 
     if( pLayout && !mbInReading )
     if( eChrCmprType != n )
     {
         eChrCmprType = n;
-        if( pDrawModel )
+        if( GetDocDrawModel().GetDrawModel() )
         {
-            pDrawModel->SetCharCompressType( static_cast<UINT16>(n) );
+            GetDocDrawModel().GetDrawModel()->SetCharCompressType( static_cast<UINT16>(n) );
             if( !mbInReading )
-                pDrawModel->ReformatAllTextObjects();
+                GetDocDrawModel().GetDrawModel()->ReformatAllTextObjects();
         }
 
         if( pLayout && !mbInReading )

File sw/source/core/doc/docdesc.cxx

 
 #include <tgrditem.hxx>
 
+#include <IDocumentDrawModelAccess.hxx>
+
 using namespace com::sun::star;
 
 static void lcl_DefaultPageFmt( sal_uInt16 nPoolFmtId,
 			bEndAction = TRUE;
 
 			bDraw = FALSE;
-			if( pDrawModel )
+            if ( GetDocDrawModel().GetDrawModel() )
             {
-                pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
-                pDrawModel->SetRefDevice( getReferenceDevice( false ) );
+                GetDocDrawModel().GetDrawModel()->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
+                GetDocDrawModel().GetDrawModel()->SetRefDevice( getReferenceDevice( false ) );
             }
 
 			pFntCache->Flush();
 
 		}
 	}
-    if ( bDraw && pDrawModel )
+    if ( bDraw && GetDocDrawModel().GetDrawModel() )
     {
         const sal_Bool bTmpAddExtLeading = get(IDocumentSettingAccess::ADD_EXT_LEADING);
-        if ( bTmpAddExtLeading != pDrawModel->IsAddExtLeading() )
-            pDrawModel->SetAddExtLeading( bTmpAddExtLeading );
+        if ( bTmpAddExtLeading != GetDocDrawModel().GetDrawModel()->IsAddExtLeading() )
+            GetDocDrawModel().GetDrawModel()->SetAddExtLeading( bTmpAddExtLeading );
 
         OutputDevice* pOutDev = getReferenceDevice( false );
-        if ( pOutDev != pDrawModel->GetRefDevice() )
-            pDrawModel->SetRefDevice( pOutDev );
+        if ( pOutDev != GetDocDrawModel().GetDrawModel()->GetRefDevice() )
+            GetDocDrawModel().GetDrawModel()->SetRefDevice( pOutDev );
     }
 
 	PrtOLENotify( TRUE );

File sw/source/core/doc/docdraw.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- * 
+ *
  * Copyright 2008 by Sun Microsystems, Inc.
  *
  * OpenOffice.org - a multi-platform office productivity suite
 
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
-#include <hintids.hxx>
-#include <rtl/logfile.hxx>
-#ifndef _OUTDEV_HXX //autogen
-#include <vcl/outdev.hxx>
-#endif
-#include <sfx2/printer.hxx>
-#include <svx/eeitem.hxx>
+
 #include <svx/flditem.hxx>
-#include <svx/editeng.hxx>
-#include <svx/svdoutl.hxx>
 #include <svx/colritem.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdogrp.hxx>
-#include <svx/langitem.hxx>
-#include <svx/unolingu.hxx>
+#include <svx/svdfield.hxx>
+#include <svx/svdetc.hxx>
 
-#ifndef _SVDOMEAS_HXX
-#include <svx/svdfield.hxx>
-#endif
-#include <svx/svdpool.hxx>
-#include <fmtanchr.hxx>
-#include <charatr.hxx>
-#include <frmfmt.hxx>
 #include <charfmt.hxx>
 #include <viewimp.hxx>
-#ifndef _SWHINTS_HXX
-#include <swhints.hxx>
-#endif
 #include <doc.hxx>
-#ifndef _DOCSH_HXX
-#include <docsh.hxx>
-#endif
-#include <rootfrm.hxx>	//Damit der RootDtor gerufen wird.
 #include <poolfmt.hxx>
-#include <viewsh.hxx>           // fuer MakeDrawView
-#include <drawdoc.hxx>
 #include <undobj.hxx>
-#include <swundo.hxx>			// fuer die UndoIds
-#include <dcontact.hxx>
 #include <dview.hxx>
 #include <mvsave.hxx>
 #include <flyfrm.hxx>
-#include <dflyobj.hxx>
-#include <svx/svdetc.hxx>
-#include <svx/fhgtitem.hxx>
+#include <flydrawviewobj.hxx>
 
-// OD 26.06.2003 #108784#
-#include <svx/svdpagv.hxx>
 // OD 2004-04-01 #i26791#
 #include <dcontact.hxx>
 #include <txtfrm.hxx>
 #include <frmfmt.hxx>
 #include <svx/frmdiritem.hxx>
 #include <fmtornt.hxx>
-// --> OD 2006-03-14 #i62875#
-#include <svx/svditer.hxx>
-// <--
 // --> OD 2006-11-01 #130889#
 #include <vector>
 // <--
 
 using namespace ::com::sun::star;
-using namespace ::com::sun::star::linguistic2;
 
 
 SV_IMPL_VARARR_SORT( _ZSortFlys, _ZSortFly )
                         pFmt->SetPositionLayoutDir(
                             text::PositionLayoutDir::PositionInLayoutDirOfAnchor );
                         // <--
-                        // --> OD 2006-11-01 #130889#
-                        // creation of <SwDrawContact> instances for the group
-                        // members and its connection to the Writer layout is
-                        // done after intrinsic ungrouping.
-//                        SwDrawContact* pContact = new SwDrawContact( pFmt, pSubObj );
-//                        // --> OD 2004-11-22 #i35635#
-//                        pContact->MoveObjToVisibleLayer( pSubObj );
-//                        // <--
-//                        pContact->ConnectToLayout();
-//                        // OD 2004-04-07 #i26791# - Adjust positioning and
-//                        // alignment attributes.
-//                        lcl_AdjustPositioningAttr( pFmt, *pSubObj );
                         pFmtsAndObjs[i].push_back( std::pair< SwDrawFrmFmt*, SdrObject* >( pFmt, pSubObj ) );
-                        // <--
 
 						if( bUndo )
 							pUndo->AddObj( i2, pFmt );
 		if( 1 == rMrkList.GetMarkCount() )
 		{
 			SdrObject *pObj = rMrkList.GetMark( 0 )->GetMarkedSdrObj();
-			if( pObj->ISA(SwVirtFlyDrawObj) )
+            if( pObj->ISA(SwFlyDrawViewObj) )
 			{
 				SwFlyFrmFmt* pFrmFmt = (SwFlyFrmFmt*)
-					((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt();
+                    static_cast<SwFlyDrawViewObj*>(pObj)->GetFlyFrm()->GetFmt();
 				if( pFrmFmt )
 				{
 					DelLayoutFmt( pFrmFmt );
 		for( i = 0; i < rMrkList.GetMarkCount(); ++i )
 		{
 			SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj();
-			if( !pObj->ISA(SwVirtFlyDrawObj) )
+            if( !pObj->ISA(SwFlyDrawViewObj) )
 			{
 				SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj);
 				SwDrawFrmFmt *pFrmFmt = (SwDrawFrmFmt*)pC->GetFmt();
 |*
 |*************************************************************************/
 
-_ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
-					  UINT32 nArrOrdNum )
-	: pFmt( pFrmFmt ), pAnchor( pFlyAn ), nOrdNum( nArrOrdNum )
+_ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt,
+                      const SwFmtAnchor* pFlyAn,
+                      UINT32 nArrOrdNum )
+    : pFmt( pFrmFmt ),
+      pAnchor( pFlyAn ),
+      nOrdNum( nArrOrdNum )
 {
-	// #i11176#
-	// This also needs to work when no layout exists. Thus, for
-	// FlyFrames an alternative method is used now in that case.
-	SwClientIter aIter( (SwFmt&)*pFmt );
-
-	if( RES_FLYFRMFMT == pFmt->Which() )
+    ASSERT( pFmt->Which() == RES_FLYFRMFMT ||
+            pFmt->Which() == RES_DRAWFRMFMT,
+            "<_ZSortFly::_ZSortFly(..)> - unexpected format type" );
+    if ( pFmt->Which() == RES_FLYFRMFMT ||
+         pFmt->Which() == RES_DRAWFRMFMT )
 	{
-        if( pFmt->getIDocumentLayoutAccess()->GetRootFrm() )
-		{
-			// Schauen, ob es ein SdrObject dafuer gibt
-			if( aIter.First( TYPE( SwFlyFrm) ) )
-				nOrdNum = ((SwFlyFrm*)aIter())->GetVirtDrawObj()->GetOrdNum();
-		}
-		else
-		{
-			// Schauen, ob es ein SdrObject dafuer gibt
-			if( aIter.First( TYPE(SwFlyDrawContact) ) )
-				nOrdNum = ((SwFlyDrawContact*)aIter())->GetMaster()->GetOrdNum();
-		}
-	}
-	else if( RES_DRAWFRMFMT == pFmt->Which() )
-	{
-		// Schauen, ob es ein SdrObject dafuer gibt
-		if( aIter.First( TYPE(SwDrawContact) ) )
-			nOrdNum = ((SwDrawContact*)aIter())->GetMaster()->GetOrdNum();
-	}
-	else {
-		ASSERT( !this, "was ist das fuer ein Format?" );
+        ASSERT( pFrmFmt->GetDrawModelObject(),
+                "<_ZSortFly::_ZSortFly(..)> - missing Drawing Model Object --> crash." );
+        nOrdNum = pFrmFmt->GetDrawModelObject()->GetOrdNum();
     }
 }
 
-/*************************************************************************/
-// Wird auch vom Sw3-Reader gerufen, wenn ein Fehler beim Einlesen
-// des Drawing Layers auftrat. In diesem Fall wird der Layer komplett
-// neu aufgebaut.
-
-// #75371#
-#include <svx/sxenditm.hxx>
-
-void SwDoc::InitDrawModel()
-{
-	RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwDoc::InitDrawModel" );
-
-	//!!Achtung im sw3-Reader (sw3imp.cxx) gibt es aehnlichen Code, der
-	//mitgepfelgt werden muss.
-	if ( pDrawModel )
-		ReleaseDrawModel();
-
-	//DrawPool und EditEnginePool anlegen, diese gehoeren uns und werden
-	//dem Drawing nur mitgegeben. Im ReleaseDrawModel werden die Pools wieder
-	//zerstoert.
-	// 17.2.99: for Bug 73110 - for loading the drawing items. This must
-	//							be loaded without RefCounts!
-	SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
-	// #75371# change DefaultItems for the SdrEdgeObj distance items
-	// to TWIPS.
-	if(pSdrPool)
-	{
-		const long nDefEdgeDist = ((500 * 72) / 127); // 1/100th mm in twips
-		pSdrPool->SetPoolDefaultItem(SdrEdgeNode1HorzDistItem(nDefEdgeDist));
-		pSdrPool->SetPoolDefaultItem(SdrEdgeNode1VertDistItem(nDefEdgeDist));
-		pSdrPool->SetPoolDefaultItem(SdrEdgeNode2HorzDistItem(nDefEdgeDist));
-		pSdrPool->SetPoolDefaultItem(SdrEdgeNode2VertDistItem(nDefEdgeDist));
-
-		// #i33700#
-		// Set shadow distance defaults as PoolDefaultItems. Details see bug.
-		pSdrPool->SetPoolDefaultItem(SdrShadowXDistItem((300 * 72) / 127));
-		pSdrPool->SetPoolDefaultItem(SdrShadowYDistItem((300 * 72) / 127));
-	}
-	SfxItemPool *pEEgPool = EditEngine::CreatePool( FALSE );
-	pSdrPool->SetSecondaryPool( pEEgPool );
- 	if ( !GetAttrPool().GetFrozenIdRanges () )
-		GetAttrPool().FreezeIdRanges();
-	else
-		pSdrPool->FreezeIdRanges();
-
-    // SJ: #95129# set FontHeight pool defaults without changing static SdrEngineDefaults
- 	GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
-
-	RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create DrawDocument" );
-	//Das SdrModel gehoert dem Dokument, wir haben immer zwei Layer und eine
-	//Seite.
-	pDrawModel = new SwDrawDocument( this );
-
-	pDrawModel->EnableUndo( DoesUndo() );
-
-	String sLayerNm;
-	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Hell" ));
-	nHell	= pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Heaven" ));
-	nHeaven	= pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-	sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("Controls" ));
-	nControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-    // OD 25.06.2003 #108784# - add invisible layers corresponding to the
-    // visible ones.
-    {
-        sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
-        nInvisibleHell   = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-        sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
-        nInvisibleHeaven = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-        sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
-        nInvisibleControls = pDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-    }
-
-	pDrawModel->InsertPage( pDrawModel->AllocPage( FALSE ) );
-	RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create DrawDocument" );
-
-	RTL_LOGFILE_CONTEXT_TRACE( aLog, "before create Spellchecker/Hyphenator" );
-	SdrOutliner& rOutliner = pDrawModel->GetDrawOutliner();
-	uno::Reference< XSpellChecker1 > xSpell = ::GetSpellChecker();
-	rOutliner.SetSpeller( xSpell );
-    uno::Reference<XHyphenator> xHyphenator( ::GetHyphenator() );
-	rOutliner.SetHyphenator( xHyphenator );
-	RTL_LOGFILE_CONTEXT_TRACE( aLog, "after create Spellchecker/Hyphenator" );
-
-	SetCalcFieldValueHdl(&rOutliner);
-	SetCalcFieldValueHdl(&pDrawModel->GetHitTestOutliner());
-
-	//JP 16.07.98: Bug 50193 - Linkmanager am Model setzen, damit
-	//			dort ggfs. verlinkte Grafiken eingefuegt werden koennen
-	//JP 28.01.99: der WinWord Import benoetigt ihn auch
-	pDrawModel->SetLinkManager( &GetLinkManager() );
-    pDrawModel->SetAddExtLeading( get(IDocumentSettingAccess::ADD_EXT_LEADING) );
-
-    OutputDevice* pRefDev = getReferenceDevice( false );
-    if ( pRefDev )
-        pDrawModel->SetRefDevice( pRefDev );
-
-    pDrawModel->SetNotifyUndoActionHdl( LINK( this, SwDoc, AddDrawUndo ));
-	if ( pLayout )
-	{
-		pLayout->SetDrawPage( pDrawModel->GetPage( 0 ) );
-		pLayout->GetDrawPage()->SetSize( pLayout->Frm().SSize() );
-	}
-}
-
-/** method to notify drawing page view about the invisible layers
-
-    OD 26.06.2003 #108784#
-
-    @author OD
-*/
-void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView )
-{
-    String sLayerNm;
-    sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHell" ));
-    _rSdrPageView.SetLayerVisible( sLayerNm, FALSE );
-
-    sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleHeaven" ));
-    _rSdrPageView.SetLayerVisible( sLayerNm, FALSE );
-
-    sLayerNm.AssignAscii(RTL_CONSTASCII_STRINGPARAM("InvisibleControls" ));
-    _rSdrPageView.SetLayerVisible( sLayerNm, FALSE );
-}
-
-/** method to determine, if a layer ID belongs to the visible ones.
-
-    OD 25.06.2003 #108784#
-    Note: If given layer ID is unknown, method asserts and returns <false>.
-
-    @author OD
-*/
-bool SwDoc::IsVisibleLayerId( const SdrLayerID& _nLayerId ) const
-{
-    bool bRetVal;
-
-    if ( _nLayerId == GetHeavenId() ||
-         _nLayerId == GetHellId() ||
-         _nLayerId == GetControlsId() )
-    {
-        bRetVal = true;
-    }
-    else if ( _nLayerId == GetInvisibleHeavenId() ||
-              _nLayerId == GetInvisibleHellId() ||
-              _nLayerId == GetInvisibleControlsId() )
-    {
-        bRetVal = false;
-    }
-    else
-    {
-        ASSERT( false, "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
-        bRetVal = false;
-    }
-
-    return bRetVal;
-}
-
-/** method to determine, if the corresponding visible layer ID for a invisible one.
-
-    OD 25.06.2003 #108784#
-    Note: If given layer ID is a visible one, method returns given layer ID.
-    Note: If given layer ID is unknown, method returns given layer ID.
-
-    @author OD
-*/
-SdrLayerID SwDoc::GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId )
-{
-    SdrLayerID nVisibleLayerId;
-
-    if ( _nInvisibleLayerId == GetInvisibleHeavenId() )
-    {
-        nVisibleLayerId = GetHeavenId();
-    }
-    else if ( _nInvisibleLayerId == GetInvisibleHellId() )
-    {
-        nVisibleLayerId = GetHellId();
-    }
-    else if ( _nInvisibleLayerId == GetInvisibleControlsId() )
-    {
-        nVisibleLayerId = GetControlsId();
-    }
-    else if ( _nInvisibleLayerId == GetHeavenId() ||
-              _nInvisibleLayerId == GetHellId() ||
-              _nInvisibleLayerId == GetControlsId() )
-    {
-        ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
-        nVisibleLayerId = _nInvisibleLayerId;
-    }
-    else
-    {
-        ASSERT( false, "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
-        nVisibleLayerId = _nInvisibleLayerId;
-    }
-
-    return nVisibleLayerId;
-}
-
-/** method to determine, if the corresponding invisible layer ID for a visible one.
-
-    OD 25.06.2003 #108784#
-    Note: If given layer ID is a invisible one, method returns given layer ID.
-    Note: If given layer ID is unknown, method returns given layer ID.
-
-    @author OD
-*/
-SdrLayerID SwDoc::GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId )
-{
-    SdrLayerID nInvisibleLayerId;
-
-    if ( _nVisibleLayerId == GetHeavenId() )
-    {
-        nInvisibleLayerId = GetInvisibleHeavenId();
-    }
-    else if ( _nVisibleLayerId == GetHellId() )
-    {
-        nInvisibleLayerId = GetInvisibleHellId();
-    }
-    else if ( _nVisibleLayerId == GetControlsId() )
-    {
-        nInvisibleLayerId = GetInvisibleControlsId();
-    }
-    else if ( _nVisibleLayerId == GetInvisibleHeavenId() ||
-              _nVisibleLayerId == GetInvisibleHellId() ||
-              _nVisibleLayerId == GetInvisibleControlsId() )
-    {
-        ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
-        nInvisibleLayerId = _nVisibleLayerId;
-    }
-    else
-    {
-        ASSERT( false, "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
-        nInvisibleLayerId = _nVisibleLayerId;
-    }
-
-    return nInvisibleLayerId;
-}
-
-/*************************************************************************/
-
-
-void SwDoc::ReleaseDrawModel()
-{
-	if ( pDrawModel )
-	{
-		//!!Den code im sw3io fuer Einfuegen Dokument mitpflegen!!
-
-		delete pDrawModel; pDrawModel = 0;
-		SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
-
-		ASSERT( pSdrPool, "missing Pool" );
-		SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
-		ASSERT( !pEEgPool->GetSecondaryPool(), "i don't accept additional pools");
-		pSdrPool->Delete();					//Erst die Items vernichten lassen,
-											//dann erst die Verkettung loesen
-		GetAttrPool().SetSecondaryPool( 0 );	//Der ist ein muss!
-		pSdrPool->SetSecondaryPool( 0 );	//Der ist sicherer
-		SfxItemPool::Free(pSdrPool);
-		SfxItemPool::Free(pEEgPool);
-	}
-}
-
-/*************************************************************************/
-
-
-SdrModel* SwDoc::_MakeDrawModel()
-{
-	ASSERT( !pDrawModel, "_MakeDrawModel: Why?" );
-	InitDrawModel();
-	if ( pLayout && pLayout->GetCurrShell() )
-	{
-		ViewShell* pTmp = pLayout->GetCurrShell();
-		do
-		{
-			pTmp->MakeDrawView();
-			pTmp = (ViewShell*) pTmp->GetNext();
-		} while ( pTmp != pLayout->GetCurrShell() );
-
-		//Broadcast, damit die FormShell mit der DrawView verbunden werden kann
-		if( GetDocShell() )
-		{
-			SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
-			GetDocShell()->Broadcast( aHnt );
-		}
-	}
-	return pDrawModel;
-}
-
-/*************************************************************************/
-
-void SwDoc::DrawNotifyUndoHdl()
-{
-	pDrawModel->SetNotifyUndoActionHdl( Link() );
-}
-
 /*************************************************************************
 *
 * Am Outliner Link auf Methode fuer Felddarstellung in Editobjekten setzen
 
 	return(0);
 }
-
-/* TFFDI: The functions formerly declared 'inline'
- */
-const SdrModel* SwDoc::GetDrawModel() const { return pDrawModel; }
-SdrModel* SwDoc::GetDrawModel() { return pDrawModel; }
-SdrLayerID SwDoc::GetHeavenId() const { return nHeaven; }
-SdrLayerID SwDoc::GetHellId() const { return nHell; }
-SdrLayerID SwDoc::GetControlsId() const { return nControls;   }
-SdrLayerID SwDoc::GetInvisibleHeavenId() const { return nInvisibleHeaven; }
-SdrLayerID SwDoc::GetInvisibleHellId() const { return nInvisibleHell; }
-SdrLayerID SwDoc::GetInvisibleControlsId() const { return nInvisibleControls; }
-SdrModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); }
-
-// --> OD 2006-03-14 #i62875#
-namespace docfunc
-{
-    bool ExistsDrawObjs( SwDoc& p_rDoc )
-    {
-        bool bExistsDrawObjs( false );
-
-        if ( p_rDoc.GetDrawModel() &&
-             p_rDoc.GetDrawModel()->GetPage( 0 ) )
-        {
-            const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
-
-            SdrObjListIter aIter( rSdrPage, IM_FLAT );
-            while( aIter.IsMore() )
-            {
-                SdrObject* pObj( aIter.Next() );
-                if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
-                     !dynamic_cast<SwFlyDrawObj*>(pObj) )
-                {
-                    bExistsDrawObjs = true;
-                    break;
-                }
-            }
-        }
-
-        return bExistsDrawObjs;
-    }
-
-    bool AllDrawObjsOnPage( SwDoc& p_rDoc )
-    {
-        bool bAllDrawObjsOnPage( true );
-
-        if ( p_rDoc.GetDrawModel() &&
-             p_rDoc.GetDrawModel()->GetPage( 0 ) )
-        {
-            const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
-
-            SdrObjListIter aIter( rSdrPage, IM_FLAT );
-            while( aIter.IsMore() )
-            {
-                SdrObject* pObj( aIter.Next() );
-                if ( !dynamic_cast<SwVirtFlyDrawObj*>(pObj) &&
-                     !dynamic_cast<SwFlyDrawObj*>(pObj) )
-                {
-                    SwDrawContact* pDrawContact =
-                            dynamic_cast<SwDrawContact*>(::GetUserCall( pObj ));
-                    if ( pDrawContact )
-                    {
-                        SwAnchoredDrawObject* pAnchoredDrawObj =
-                            dynamic_cast<SwAnchoredDrawObject*>(pDrawContact->GetAnchoredObj( pObj ));
-
-                        // error handling
-                        {
-                            if ( !pAnchoredDrawObj )
-                            {
-                                ASSERT( false,
-                                        "<docfunc::AllDrawObjsOnPage() - missing anchored draw object" );
-                                bAllDrawObjsOnPage = false;
-                                break;
-                            }
-                        }
-
-                        if ( pAnchoredDrawObj->NotYetPositioned() )
-                        {
-                            // The drawing object isn't yet layouted.
-                            // Thus, it isn't known, if all drawing objects are on page.
-                            bAllDrawObjsOnPage = false;
-                            break;
-                        }
-                        else if ( pAnchoredDrawObj->IsOutsidePage() )
-                        {
-                            bAllDrawObjsOnPage = false;
-                            break;
-                        }
-                    }
-                    else
-                    {
-                        // contact object of drawing object doesn't exists.
-                        // Thus, the drawing object isn't yet positioned.
-                        // Thus, it isn't known, if all drawing objects are on page.
-                        bAllDrawObjsOnPage = false;
-                        break;
-                    }
-                }
-            }
-        }
-
-        return bAllDrawObjsOnPage;
-    }
-}
-// <--
-

File sw/source/core/doc/docdrawmodel.cxx

+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: docdrawmodel.cxx,v $
+ * $Revision:  $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <docdrawmodel.hxx>
+
+#include <drawmodelfactory.hxx>
+#include <drawdoc.hxx>
+#include <drawmodellistener.hxx>
+
+#include <dflyobj.hxx>
+#include <flydrawviewobj.hxx>
+
+#include <swhints.hxx>
+#include <doc.hxx>
+#include <rootfrm.hxx>
+#include <viewsh.hxx>
+#include <docsh.hxx>
+#include <undobj.hxx>
+
+#include <svtools/smplhint.hxx>