[Libreoffice-commits] core.git: Branch 'aoo/trunk' - sw/inc sw/source

Armin Le Grand alg at apache.org
Thu Jun 5 03:07:33 PDT 2014


 sw/inc/IDocumentDrawModelAccess.hxx              |   10 +-
 sw/inc/doc.hxx                                   |   12 +--
 sw/inc/docsh.hxx                                 |    6 +
 sw/inc/dpage.hxx                                 |    4 -
 sw/inc/drawdoc.hxx                               |    6 -
 sw/source/core/access/accmap.cxx                 |   11 --
 sw/source/core/doc/doc.cxx                       |   15 ----
 sw/source/core/doc/docdesc.cxx                   |    3 
 sw/source/core/doc/docdraw.cxx                   |   10 +-
 sw/source/core/doc/docfly.cxx                    |    9 --
 sw/source/core/doc/doclay.cxx                    |   10 --
 sw/source/core/doc/docnew.cxx                    |   18 ++--
 sw/source/core/draw/dcontact.cxx                 |    4 -
 sw/source/core/draw/dpage.cxx                    |    4 -
 sw/source/core/draw/drawdoc.cxx                  |   44 ++---------
 sw/source/core/frmedt/feshview.cxx               |    5 -
 sw/source/core/layout/fly.cxx                    |    8 --
 sw/source/core/layout/frmtool.cxx                |    7 -
 sw/source/core/layout/newfrm.cxx                 |    6 -
 sw/source/core/layout/paintfrm.cxx               |   13 ---
 sw/source/core/undo/docundo.cxx                  |   13 ---
 sw/source/core/undo/unattr.cxx                   |    8 --
 sw/source/core/unocore/unodraw.cxx               |    6 -
 sw/source/core/unocore/unoframe.cxx              |    7 -
 sw/source/core/view/vdraw.cxx                    |   11 --
 sw/source/core/view/viewimp.cxx                  |    7 -
 sw/source/core/view/viewsh.cxx                   |    5 -
 sw/source/filter/html/htmldraw.cxx               |   10 --
 sw/source/filter/rtf/rtffly.cxx                  |    9 --
 sw/source/filter/rtf/swparrtf.cxx                |   17 +---
 sw/source/filter/ww8/docxattributeoutput.cxx     |    2 
 sw/source/filter/ww8/rtfattributeoutput.cxx      |   16 +---
 sw/source/filter/ww8/wrtw8esh.cxx                |   23 +-----
 sw/source/filter/ww8/wrtww8.cxx                  |   16 ----
 sw/source/filter/ww8/ww8graf.cxx                 |    7 -
 sw/source/filter/xml/swxml.cxx                   |   20 -----
 sw/source/filter/xml/xmlexp.cxx                  |    8 --
 sw/source/filter/xml/xmlimp.cxx                  |   10 --
 sw/source/ui/app/docsh.cxx                       |    2 
 sw/source/ui/app/docshdrw.cxx                    |   86 +++++++++++++----------
 sw/source/ui/app/docshini.cxx                    |    4 -
 sw/source/ui/app/docst.cxx                       |   13 ---
 sw/source/ui/app/docstyle.cxx                    |    8 --
 sw/source/ui/dialog/SwSpellDialogChildWindow.cxx |    4 -
 sw/source/ui/lingu/sdrhhcwrap.cxx                |    8 --
 sw/source/ui/shells/drwbassh.cxx                 |    8 --
 sw/source/ui/shells/frmsh.cxx                    |    4 -
 sw/source/ui/shells/grfsh.cxx                    |   14 ---
 sw/source/ui/shells/textsh1.cxx                  |   21 -----
 sw/source/ui/uiview/view.cxx                     |    7 +
 sw/source/ui/uno/unodefaults.cxx                 |    4 -
 sw/source/ui/uno/unotxdoc.cxx                    |   52 +++++++++----
 sw/source/ui/utlui/content.cxx                   |   24 ++----
 53 files changed, 223 insertions(+), 436 deletions(-)

New commits:
commit a7ccadbf3b1ac378ca15d3630d48f48734700e5c
Author: Armin Le Grand <alg at apache.org>
Date:   Thu Jun 5 08:44:38 2014 +0000

    i124638 Corrected relationship between DrawModel and DocShell in Writer, made SwDrawModel and handling more known

diff --git a/sw/inc/IDocumentDrawModelAccess.hxx b/sw/inc/IDocumentDrawModelAccess.hxx
index dd673fc..bad329c 100644
--- a/sw/inc/IDocumentDrawModelAccess.hxx
+++ b/sw/inc/IDocumentDrawModelAccess.hxx
@@ -26,7 +26,7 @@
 
 #include <svx/svdtypes.hxx>
 
-class SdrModel;
+class SwDrawModel;
 class SdrPageView;
 
 /** IDocumentDrawModelAccess
@@ -37,10 +37,10 @@ public:
 
     /** Draw Model and id accessors
      */
-    virtual const SdrModel* GetDrawModel() const = 0;
-    virtual SdrModel* GetDrawModel() = 0;
-    virtual SdrModel* _MakeDrawModel() = 0;
-    virtual SdrModel* GetOrCreateDrawModel() = 0;
+    virtual const SwDrawModel* GetDrawModel() const = 0;
+    virtual SwDrawModel* GetDrawModel() = 0;
+    virtual SwDrawModel* _MakeDrawModel() = 0;
+    virtual SwDrawModel* GetOrCreateDrawModel() = 0;
     virtual SdrLayerID GetHeavenId() const = 0;
     virtual SdrLayerID GetHellId() const = 0;
     virtual SdrLayerID GetControlsId() const = 0;
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 9aa4c4d..01375e3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -102,7 +102,7 @@ class Outliner;
 class OutputDevice;
 class Point;
 class SbxArray;
-class SdrModel;
+class SwDrawModel;
 class SdrObject;
 class SdrUndoAction;
 class VirtualDevice;
@@ -327,7 +327,7 @@ class SW_DLLPUBLIC SwDoc :
 
     ViewShell       *pCurrentView;  // SwDoc should get a new member pCurrentView//swmod 071225
     boost::shared_ptr<SwRootFrm> pLayoutPtr;
-    SdrModel        *pDrawModel;        // StarView Drawing
+    SwDrawModel*     pDrawModel;        // StarView Drawing
 
     SwDocUpdtFld    *pUpdtFlds;         // Struktur zum Field-Update
     SwFldTypes      *pFldTypes;         // Feldtypen
@@ -957,8 +957,8 @@ public:
 
     /** IDocumentDrawModelAccess
     */
-    virtual const SdrModel* GetDrawModel() const;
-    virtual SdrModel* GetDrawModel();
+    virtual const SwDrawModel* GetDrawModel() const;
+    virtual SwDrawModel* GetDrawModel();
     virtual SdrLayerID GetHeavenId() const;
     virtual SdrLayerID GetHellId() const;
     virtual SdrLayerID GetControlsId() const;
@@ -969,8 +969,8 @@ public:
     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();
+    virtual SwDrawModel* _MakeDrawModel();
+    virtual SwDrawModel* GetOrCreateDrawModel();
 
     /** IDocumentLayoutAccess
     */
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index e3de862..28872642c 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -55,7 +55,12 @@ class IDocumentDeviceAccess;
 class IDocumentSettingAccess;
 class IDocumentTimerAccess;
 class IDocumentChartDataProviderAccess;
+class SwDocShell;
+class SwDrawModel;
 
+// initialize DrawModel (in form of a SwDrawModel) and DocShell (in form of a SwDocShell)
+// as needed, one or both parameters may be zero
+void SW_DLLPRIVATE InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawModel);
 
 class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
 {
@@ -132,7 +137,6 @@ class SW_DLLPUBLIC SwDocShell: public SfxObjectShell, public SfxListener
     SW_DLLPRIVATE sal_uInt16                    MakeByExample(const String &rName,
                                             sal_uInt16 nFamily, sal_uInt16 nMask, SwWrtShell* pShell = 0);
 
-    SW_DLLPRIVATE void                  InitDraw();
     SW_DLLPRIVATE void                  SubInitNew();   // fuer InitNew und HtmlSourceModus
 
     SW_DLLPRIVATE void                  RemoveOLEObjects();
diff --git a/sw/inc/dpage.hxx b/sw/inc/dpage.hxx
index 35b02b5..4ee686a 100644
--- a/sw/inc/dpage.hxx
+++ b/sw/inc/dpage.hxx
@@ -29,7 +29,7 @@
 #include <svx/svdobj.hxx>
 
 class SdrPageGridFrameList;
-class SwDrawDocument;
+class SwDrawModel;
 class SwDoc;
 
 class SwDPage : public FmFormPage, public SdrObjUserCall
@@ -38,7 +38,7 @@ class SwDPage : public FmFormPage, public SdrObjUserCall
     SwDoc&                  rDoc;
 
 public:
-    SwDPage(SwDrawDocument& rNewModel, sal_Bool bMasterPage=sal_False);
+    SwDPage(SwDrawModel& rNewModel, sal_Bool bMasterPage=sal_False);
     ~SwDPage();
 
     // #i3694#
diff --git a/sw/inc/drawdoc.hxx b/sw/inc/drawdoc.hxx
index 41f679a..eac0bb0 100644
--- a/sw/inc/drawdoc.hxx
+++ b/sw/inc/drawdoc.hxx
@@ -32,12 +32,12 @@ class SwDocShell;
 
 //==================================================================
 
-class SwDrawDocument : public FmFormModel
+class SwDrawModel : public FmFormModel
 {
     SwDoc* pDoc;
 public:
-    SwDrawDocument( SwDoc* pDoc );
-    ~SwDrawDocument();
+    SwDrawModel( SwDoc* pDoc );
+    ~SwDrawModel();
 
     const SwDoc& GetDoc() const { return *pDoc; }
           SwDoc& GetDoc()       { return *pDoc; }
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index 11575b9..0fa7fd0 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -19,19 +19,15 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <vos/ref.hxx>
 #include <cppuhelper/weakref.hxx>
 #include <vcl/window.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/unomod.hxx>
 #include <tools/debug.hxx>
-
 #include <map>
 #include <list>
 #include <vector>
@@ -61,15 +57,9 @@
 #include <IDocumentDrawModelAccess.hxx>
 #include <svx/ShapeTypeHandler.hxx>
 #include <vcl/svapp.hxx>
-#ifndef _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
 #include <svx/ShapeTypeHandler.hxx>
-#endif
-#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
 #include <svx/SvxShapeTypes.hxx>
-#endif
-#ifndef _SVDPAGE_HXX
 #include <svx/svdpage.hxx>
-#endif
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
@@ -85,6 +75,7 @@
 #include <dflyobj.hxx>
 #include <prevwpage.hxx>
 #include <switerator.hxx>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 53f64d4..a41a6d0 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -19,15 +19,12 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <doc.hxx>
 #include <UndoManager.hxx>
 #include <hintids.hxx>
-
 #include <tools/shl.hxx>
 #include <tools/globname.hxx>
 #include <svx/svxids.hrc>
@@ -57,7 +54,6 @@
 #include <editeng/pbinitem.hxx>
 #include <unotools/charclass.hxx>
 #include <unotools/localedatawrapper.hxx>
-
 #include <swatrset.hxx>
 #include <swmodule.hxx>
 #include <fmtpdsc.hxx>
@@ -115,25 +111,16 @@
 #include <shellres.hxx>
 #include <txtfrm.hxx>
 #include <attrhint.hxx>
-
 #include <wdocsh.hxx>           // SwWebDocShell
 #include <prtopt.hxx>           // SwPrintOptions
-
 #include <vector>
 #include <map>
-
 #include <osl/diagnose.h>
 #include <osl/interlck.h>
 #include <vbahelper/vbaaccesshelper.hxx>
-
 #include "switerator.hxx"
-
-/* @@@MAINTAINABILITY-HORROR@@@
-   Probably unwanted dependency on SwDocShell
-*/
-// --> OD 2005-08-29 #125370#
 #include <layouter.hxx>
-// <--
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using ::rtl::OUString;
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index 5dca2c5..0b9757c 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -74,6 +72,7 @@
 #include <SwUndoPageDesc.hxx>
 #include <pagedeschint.hxx>
 #include <tgrditem.hxx>
+#include <drawdoc.hxx>
 
 using namespace com::sun::star;
 
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index c14e98f..3d8730a 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -605,7 +605,7 @@ void SwDoc::InitDrawModel()
     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 = new SwDrawModel( this );
 
     pDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
 
@@ -825,7 +825,7 @@ void SwDoc::ReleaseDrawModel()
 /*************************************************************************/
 
 
-SdrModel* SwDoc::_MakeDrawModel()
+SwDrawModel* SwDoc::_MakeDrawModel()
 {
     ASSERT( !pDrawModel, "_MakeDrawModel: Why?" );
     InitDrawModel();
@@ -955,15 +955,15 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
 
 /* TFFDI: The functions formerly declared 'inline'
  */
-const SdrModel* SwDoc::GetDrawModel() const { return pDrawModel; }
-SdrModel* SwDoc::GetDrawModel() { return pDrawModel; }
+const SwDrawModel* SwDoc::GetDrawModel() const { return pDrawModel; }
+SwDrawModel* 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(); }
+SwDrawModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); }
 
 // --> OD 2006-03-14 #i62875#
 namespace docfunc
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index 1f37b97..99ba831 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -39,7 +37,6 @@
 #include <fmtornt.hxx>
 #include <fmtsrnd.hxx>
 #include <dcontact.hxx>
-
 #include <ndgrf.hxx>
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
@@ -67,14 +64,12 @@
 #include <dflyobj.hxx>
 #include <undoflystrattr.hxx>
 #include <switerator.hxx>
-
-//UUUU
 #include <svx/xbtmpit.hxx>
 #include <svx/xflftrit.hxx>
+#include <drawdoc.hxx>
 
 extern sal_uInt16 GetHtmlMode( const SwDocShell* );
 
-
 using namespace ::com::sun::star;
 
 sal_uInt16 SwDoc::GetFlyCount( FlyCntType eType ) const
@@ -438,7 +433,7 @@ lcl_SetFlyFrmAttr(SwDoc & rDoc,
 
 void SwDoc::CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet)
 {
-    SdrModel* pDrawModel = GetOrCreateDrawModel();
+    SwDrawModel* pDrawModel = GetOrCreateDrawModel();
     SfxItemIter aIter(rSet);
 
     for(const SfxPoolItem* pItem = aIter.FirstItem(); pItem; pItem = aIter.NextItem())
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 577b367..a47c1fc 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -44,7 +42,6 @@
 #include <svx/svdouno.hxx>
 #include <svx/fmpage.hxx>
 #include <editeng/frmdiritem.hxx>
-
 #include <swmodule.hxx>
 #include <modcfg.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
@@ -96,15 +93,10 @@
 #include <pagedesc.hxx>
 #include <PostItMgr.hxx>
 #include <comcore.hrc>      // STR-ResId's
-
-// #i11176#
 #include <unoframe.hxx>
-// OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
-
-// --> OD 2004-07-26 #i32089#
 #include <vector>
-// <--
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using ::rtl::OUString;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 53b5eb6..d0847fc 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -769,27 +769,25 @@ SfxPrinter& SwDoc::CreatePrinter_() const
 
 void SwDoc::SetDocShell( SwDocShell* pDSh )
 {
-    if( pDocShell != pDSh )
+    if(pDocShell != pDSh)
     {
         if (pDocShell)
         {
             pDocShell->SetUndoManager(0);
         }
+
         pDocShell = pDSh;
+
         if (pDocShell)
         {
             pDocShell->SetUndoManager(& GetUndoManager());
         }
 
-        pLinkMgr->SetPersist( pDocShell );
-        //JP 27.08.98: Bug 55570 - DocShell Pointer auch am DrawModel setzen
-        if( pDrawModel )
-        {
-            ((SwDrawDocument*)pDrawModel)->SetObjectShell( pDocShell );
-            pDrawModel->SetPersist( pDocShell );
-            ASSERT( pDrawModel->GetPersist() == GetPersist(),
-                    "draw model's persist is out of sync" );
-        }
+        pLinkMgr->SetPersist(pDocShell);
+
+        // set DocShell pointer also on DrawModel
+        InitDrawModelAndDocShell(pDocShell, GetDrawModel());
+        OSL_ENSURE(!pDrawModel || pDrawModel->GetPersist() == GetPersist(), "draw model's persist is out of sync");
     }
 }
 
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 4aa6352..a657f73 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 #include "hintids.hxx"
@@ -70,10 +68,10 @@
 #include <com/sun/star/text/WritingMode2.hpp>
 #include <switerator.hxx>
 #include <algorithm>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
-
 TYPEINIT1( SwContact, SwClient )
 TYPEINIT1( SwFlyDrawContact, SwContact )
 TYPEINIT1( SwDrawContact, SwContact )
diff --git a/sw/source/core/draw/dpage.cxx b/sw/source/core/draw/dpage.cxx
index 525ebac..87d1719 100644
--- a/sw/source/core/draw/dpage.cxx
+++ b/sw/source/core/draw/dpage.cxx
@@ -59,7 +59,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::drawing;
 using namespace ::com::sun::star::frame;
 
-SwDPage::SwDPage(SwDrawDocument& rNewModel, sal_Bool bMasterPage) :
+SwDPage::SwDPage(SwDrawModel& rNewModel, sal_Bool bMasterPage) :
     FmFormPage(rNewModel, 0, bMasterPage),
     pGridLst( 0 ),
     rDoc(rNewModel.GetDoc())
@@ -114,7 +114,7 @@ void InsertGridFrame( SdrPageGridFrameList *pLst, const SwFrm *pPg )
 const SdrPageGridFrameList*  SwDPage::GetGridFrameList(
                         const SdrPageView* pPV, const Rectangle *pRect ) const
 {
-    ViewShell *pSh = ((SwDrawDocument*)GetModel())->GetDoc().GetCurrentViewShell(); //swmod 071108//swmod 071225
+    ViewShell *pSh = static_cast< SwDrawModel* >(GetModel())->GetDoc().GetCurrentViewShell();   //swmod 071108//swmod 071225
     if ( pSh )
     {
         while ( pSh->Imp()->GetPageView() != pPV )
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 02c53e3..af41bf8 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -62,37 +62,16 @@ const String GetPalettePath()
     return aPathOpt.GetPalettePath();
 }
 
-SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
-    FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(), pD->GetDocShell() ),
+SwDrawModel::SwDrawModel( SwDoc* pD )
+:   FmFormModel( ::GetPalettePath(), &pD->GetAttrPool(), pD->GetDocShell() ),
     pDoc( pD )
 {
     SetScaleUnit( MAP_TWIP );
     SetSwapGraphics( sal_True );
 
-    SwDocShell* pDocSh = pDoc->GetDocShell();
-    if ( pDocSh )
-    {
-        SetObjectShell( pDocSh );
-        SvxColorTableItem* pColItem = ( SvxColorTableItem* )
-                                ( pDocSh->GetItem( SID_COLOR_TABLE ) );
-        XColorListSharedPtr aXCol = pColItem ?
-            pColItem->GetColorTable() :
-            XColorList::GetStdColorList();
-        SetColorTableAtSdrModel( aXCol );
-
-        if ( !pColItem )
-            pDocSh->PutItem( SvxColorTableItem( aXCol, SID_COLOR_TABLE ) );
-
-        pDocSh->PutItem( SvxGradientListItem( GetGradientListFromSdrModel(), SID_GRADIENT_LIST ));
-        pDocSh->PutItem( SvxHatchListItem( GetHatchListFromSdrModel(), SID_HATCH_LIST ) );
-        pDocSh->PutItem( SvxBitmapListItem( GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) );
-        pDocSh->PutItem( SvxDashListItem( GetDashListFromSdrModel(), SID_DASH_LIST ) );
-        pDocSh->PutItem( SvxLineEndListItem( GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) );
-        pDocSh->PutItem( SfxUInt16Item(SID_ATTR_LINEEND_WIDTH_DEFAULT, 111) );
-        SetObjectShell( pDocSh );
-    }
-    else
-        SetColorTableAtSdrModel( XColorList::GetStdColorList() );
+    // use common InitDrawModelAndDocShell which will set the associations as needed,
+    // including SvxColorTableItem  with WhichID SID_COLOR_TABLE
+    InitDrawModelAndDocShell(pDoc ? pDoc->GetDocShell() : 0, this);
 
     // copy all the default values to the SdrModel
     SfxItemPool* pSdrPool = pD->GetAttrPool().GetSecondaryPool();
@@ -137,7 +116,7 @@ SwDrawDocument::SwDrawDocument( SwDoc* pD ) :
 \************************************************************************/
 
 
-SwDrawDocument::~SwDrawDocument()
+SwDrawModel::~SwDrawModel()
 {
     Broadcast(SdrHint(HINT_MODELCLEARED));
 
@@ -156,7 +135,7 @@ SwDrawDocument::~SwDrawDocument()
 \************************************************************************/
 
 
-SdrPage* SwDrawDocument::AllocPage(FASTBOOL bMasterPage)
+SdrPage* SwDrawModel::AllocPage(FASTBOOL bMasterPage)
 {
     SwDPage* pPage = new SwDPage(*this, 0 != bMasterPage);
     pPage->SetName( String::CreateFromAscii(
@@ -165,7 +144,7 @@ SdrPage* SwDrawDocument::AllocPage(FASTBOOL bMasterPage)
 }
 
 
-SvStream* SwDrawDocument::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const
+SvStream* SwDrawModel::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) const
 {
     SvStream* pRet = NULL;
     uno::Reference < embed::XStorage > xRoot( pDoc->GetDocStorage() );
@@ -205,14 +184,14 @@ SvStream* SwDrawDocument::GetDocumentStream( SdrDocumentStreamInfo& rInfo ) cons
     return pRet;
 }
 
-SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const
+SdrLayerID SwDrawModel::GetControlExportLayerId( const SdrObject & ) const
 {
     //fuer Versionen < 5.0, es gab nur Hell und Heaven
     return (SdrLayerID)pDoc->GetHeavenId();
 }
 
 // --> OD 2006-03-01 #b6382898#
-uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel()
+uno::Reference< uno::XInterface > SwDrawModel::createUnoModel()
 {
 
     uno::Reference< uno::XInterface > xModel;
@@ -226,8 +205,7 @@ uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel()
     }
     catch( uno::RuntimeException& )
     {
-        ASSERT( false,
-                "<SwDrawDocument::createUnoModel()> - could *not* retrieve model at <SwDocShell>" );
+        ASSERT( false, "<SwDrawModel::createUnoModel()> - could *not* retrieve model at <SwDocShell>" );
     }
 
     return xModel;
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index ff33b4b..e26c904 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -19,15 +19,11 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <com/sun/star/embed/EmbedMisc.hpp>
-
 #include "hintids.hxx"
-
 #include <svx/sdrobjectfilter.hxx>
 #include <svx/svditer.hxx>
 #include <svx/svdobj.hxx>
@@ -86,6 +82,7 @@
 #include <HandleAnchorNodeChg.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <switerator.hxx>
+#include <drawdoc.hxx>
 
 #define SCROLLVAL 75
 
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index e0c7602..839f677 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 #include "hintids.hxx"
 #include <svl/itemiter.hxx>
 #include <svtools/imap.hxx>
@@ -85,10 +84,10 @@
 #include <vcl/svapp.hxx>
 #include <vcl/salbtype.hxx>     // FRound
 #include "switerator.hxx"
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
-
 // OD 2004-03-23 #i26791
 TYPEINIT2(SwFlyFrm,SwLayoutFrm,SwAnchoredObject);
 
@@ -450,8 +449,7 @@ void SwFlyFrm::InitDrawObj( sal_Bool bNotify )
     if ( !pContact )
     {
         // --> OD 2005-08-08 #i52858# - method name changed
-        pContact = new SwFlyDrawContact( (SwFlyFrmFmt*)GetFmt(),
-                                          pIDDMA->GetOrCreateDrawModel() );
+        pContact = new SwFlyDrawContact( (SwFlyFrmFmt*)GetFmt(), pIDDMA->GetOrCreateDrawModel() );
         // <--
     }
     ASSERT( pContact, "InitDrawObj failed" );
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 7250b8c..56726cc 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 #include <hintids.hxx>
 #include <tools/bigint.hxx>
 #include <svx/svdmodel.hxx>
@@ -35,7 +34,6 @@
 #include <editeng/boxitem.hxx>
 #include <sfx2/printer.hxx>
 #include <editeng/lspcitem.hxx>
-
 #include <fmtornt.hxx>
 #include <fmtanchr.hxx>
 #include <fmthdft.hxx>
@@ -80,9 +78,8 @@
 #include <sortedobjs.hxx>
 #include <objectformatter.hxx>
 #include <switerator.hxx>
-
-//UUUU
 #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
+#include <drawdoc.hxx>
 
 // ftnfrm.cxx:
 void lcl_RemoveFtns( SwFtnBossFrm* pBoss, sal_Bool bPageOnly, sal_Bool bEndNotes );
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index aecf27b..48f7700 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
 #include <fmtfordr.hxx>
@@ -51,6 +50,7 @@
 #include "IDocumentDrawModelAccess.hxx"
 #include <hints.hxx>
 #include <viewopt.hxx>
+#include <drawdoc.hxx>
 
 SwLayVout     *SwRootFrm::pVout = 0;
 sal_Bool           SwRootFrm::bInPaint = sal_False;
@@ -515,7 +515,7 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
     pLayoutAccess->SetCurrentViewShell( this->GetCurrShell() );     //Fuer das Erzeugen der Flys durch MakeFrms()   //swmod 071108//swmod 071225
     bCallbackActionEnabled = sal_False; //vor Verlassen auf sal_True setzen!
 
-    SdrModel *pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel();
+    SwDrawModel* pMd = pFmt->getIDocumentDrawModelAccess()->GetDrawModel();
     if ( pMd )
     {
         // Disable "multiple layout"
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ca5e6ae..2b61006 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -82,23 +80,18 @@
 #include <svx/svdogrp.hxx>
 #include <sortedobjs.hxx>
 #include <EnhancedPDFExportHelper.hxx>
-// <--
-// --> OD #i76669#
 #include <svx/sdr/contact/viewobjectcontactredirector.hxx>
 #include <svx/sdr/contact/viewobjectcontact.hxx>
 #include <svx/sdr/contact/viewcontact.hxx>
-// <--
-
 #include <ndole.hxx>
 #include <svx/charthelper.hxx>
 #include <PostItMgr.hxx>
 #include <tools/color.hxx>
 #include <vcl/svapp.hxx>
-
-//UUUU
 #include <svx/sdr/attribute/sdrallfillattributeshelper.hxx>
 #include <drawinglayer/processor2d/processor2dtools.hxx>
 #include <ndtxt.hxx>
+#include <drawdoc.hxx>
 
 #define COL_NOTES_SIDEPANE                  RGB_COLORDATA(230,230,230)
 #define COL_NOTES_SIDEPANE_BORDER           RGB_COLORDATA(200,200,200)
@@ -6926,7 +6919,7 @@ Graphic SwFlyFrmFmt::MakeGraphic( ImageMap* pMap )
 Graphic SwDrawFrmFmt::MakeGraphic( ImageMap* )
 {
     Graphic aRet;
-    SdrModel *pMod = getIDocumentDrawModelAccess()->GetDrawModel();
+    SwDrawModel* pMod = getIDocumentDrawModelAccess()->GetDrawModel();
     if ( pMod )
     {
         SdrObject *pObj = FindSdrObject();
@@ -6940,4 +6933,4 @@ Graphic SwDrawFrmFmt::MakeGraphic( ImageMap* )
     return aRet;
 }
 
-
+//eof
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 462c335..3b985d9 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -19,19 +19,13 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <UndoManager.hxx>
-
 #include <unotools/undoopt.hxx>
-
 #include <vcl/wrkwin.hxx>
-
 #include <svx/svdmodel.hxx>
-
 #include <swmodule.hxx>
 #include <doc.hxx>
 #include <ndarr.hxx>
@@ -44,16 +38,13 @@
 #include <editsh.hxx>
 #include <unobaseclass.hxx>
 #include <limits>
-
-#include <limits>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
-
 // the undo array should never grow beyond this limit:
 #define UNDO_ACTION_LIMIT (USHRT_MAX - 1000)
 
-
 // UndoManager ///////////////////////////////////////////////////////////
 
 namespace sw {
@@ -98,7 +89,7 @@ void UndoManager::DoUndo(bool const bDoUndo)
     {
         EnableUndo(bDoUndo);
 
-        SdrModel *const pSdrModel = m_rDrawModelAccess.GetDrawModel();
+        SwDrawModel*const pSdrModel = m_rDrawModelAccess.GetDrawModel();
         if( pSdrModel )
         {
             pSdrModel->EnableUndo(bDoUndo);
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index 3359fa9..cda6c94 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -19,22 +19,16 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #define _SVSTDARR_USHORTS
 #define _SVSTDARR_USHORTSSORT
 #include <UndoAttribute.hxx>
-
 #include <svl/itemiter.hxx>
-
 #include <editeng/tstpitem.hxx>
-
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
-
 #include <hintids.hxx>
 #include <fmtflcnt.hxx>
 #include <txtftn.hxx>
@@ -63,7 +57,7 @@
 #include <section.hxx>
 #include <charfmt.hxx>
 #include <switerator.hxx>
-
+#include <drawdoc.hxx>
 
 // -----------------------------------------------------
 
diff --git a/sw/source/core/unocore/unodraw.cxx b/sw/source/core/unocore/unodraw.cxx
index 7cc73e4..a8ffef7 100644
--- a/sw/source/core/unocore/unodraw.cxx
+++ b/sw/source/core/unocore/unodraw.cxx
@@ -19,14 +19,11 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <swtypes.hxx>
 #include <cmdid.h>
-
 #include <unomid.h>
 #include <unodraw.hxx>
 #include <unocoll.hxx>
@@ -83,6 +80,7 @@
 #include <list>
 #include <iterator>
 #include <switerator.hxx>
+#include <drawdoc.hxx>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
@@ -862,7 +860,7 @@ SwFmDrawPage*   SwXDrawPage::GetSvxPage()
     {
         vos::OGuard  aGuard(Application::GetSolarMutex());
         // --> OD 2005-08-08 #i52858# - method name changed
-        SdrModel* pModel = pDoc->GetOrCreateDrawModel();
+        SwDrawModel* pModel = pDoc->GetOrCreateDrawModel();
         // <--
         SdrPage* pPage = pModel->GetPage( 0 );
 
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index a3b5489..9dde595 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -116,8 +116,6 @@
 #include <fmtwrapinfluenceonobjpos.hxx>
 #include <toolkit/helper/vclunohelper.hxx>
 #include <switerator.hxx>
-
-//UUUU
 #include <svx/unobrushitemhelper.hxx>
 #include <svx/xfillit0.hxx>
 #include <svx/xbtmpit.hxx>
@@ -135,6 +133,7 @@
 #include <svx/xflbckit.hxx>
 #include <svx/unoshape.hxx>
 #include <swunohelper.hxx>
+#include <drawdoc.hxx>
 
 // from fefly1.cxx
 extern sal_Bool lcl_ChkAndSetNewAnchor( SwEditShell& rEditShell, const SwFlyFrm& rFly, SfxItemSet& rSet );
@@ -1287,7 +1286,7 @@ SdrObject *SwXFrame::GetOrCreateSdrObject( SwFlyFrmFmt *pFmt )
     {
         SwDoc *pDoc = pFmt->GetDoc();
         // --> OD 2005-08-08 #i52858# - method name changed
-        SdrModel *pDrawModel = pDoc->GetOrCreateDrawModel();
+        SwDrawModel* pDrawModel = pDoc->GetOrCreateDrawModel();
         // <--
         SwFlyDrawContact* pContactObject
                     = new SwFlyDrawContact( pFmt, pDrawModel );
@@ -1680,7 +1679,7 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
             {
                 SdrObject* pObject =
                     GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
-                SdrModel *pDrawModel = pDoc->GetDrawModel();
+                SwDrawModel* pDrawModel = pDoc->GetDrawModel();
                 pDrawModel->GetPage(0)->
                             SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
             }
diff --git a/sw/source/core/view/vdraw.cxx b/sw/source/core/view/vdraw.cxx
index aa782af..70614c5 100644
--- a/sw/source/core/view/vdraw.cxx
+++ b/sw/source/core/view/vdraw.cxx
@@ -19,12 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
 #include <tools/shl.hxx>
@@ -33,15 +30,10 @@
 #include <svx/svdpagv.hxx>
 #include <fmtanchr.hxx>
 #include <frmfmt.hxx>
-
-/// OD 29.08.2002 #102450#
-/// include <svx/svdoutl.hxx>
 #include <svx/svdoutl.hxx>
-
 #ifdef DBG_UTIL
 #include <svx/fmglob.hxx>
 #endif
-
 #include "fesh.hxx"
 #include "pagefrm.hxx"
 #include "rootfrm.hxx"
@@ -53,9 +45,8 @@
 #include "dview.hxx"
 #include "flyfrm.hxx"
 #include <vcl/svapp.hxx>
-
 #include <IDocumentDrawModelAccess.hxx>
-
+#include <drawdoc.hxx>
 
 /*************************************************************************
 |*
diff --git a/sw/source/core/view/viewimp.cxx b/sw/source/core/view/viewimp.cxx
index 0a1485d..fa5daa9 100644
--- a/sw/source/core/view/viewimp.cxx
+++ b/sw/source/core/view/viewimp.cxx
@@ -19,12 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include "crsrsh.hxx"
 #include "rootfrm.hxx"
 #include "pagefrm.hxx"
@@ -41,16 +38,14 @@
 #include <swmodule.hxx>
 #include <svx/svdpage.hxx>
 #include <accmap.hxx>
-
-// OD 12.12.2002 #103492#
 #include <pagepreviewlayout.hxx>
-
 #include <comcore.hrc>
 #include <svx/svdundo.hxx>
 #include <IDocumentLayoutAccess.hxx>
 #include <IDocumentDrawModelAccess.hxx>
 #include <IDocumentDeviceAccess.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <drawdoc.hxx>
 
 /*************************************************************************
 |*
diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx
index 05ebb43..2fe2dc2 100644
--- a/sw/source/core/view/viewsh.cxx
+++ b/sw/source/core/view/viewsh.cxx
@@ -71,6 +71,7 @@
 #include <vcl/svapp.hxx>
 #include <svx/sdrpaintwindow.hxx>
 #include <vcl/dibtools.hxx>
+#include <drawdoc.hxx>
 
 sal_Bool ViewShell::bLstAct = sal_False;
 ShellResource *ViewShell::pShellRes = 0;
@@ -844,7 +845,7 @@ void ViewShell::SetAddExtLeading( bool bNew )
     {
         SwWait aWait( *GetDoc()->GetDocShell(), true );
         pIDSA->set(IDocumentSettingAccess::ADD_EXT_LEADING, bNew );
-        SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
+        SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
         if ( pTmpDrawModel )
             pTmpDrawModel->SetAddExtLeading( bNew );
         const sal_uInt8 nInv = INV_PRTAREA | INV_SIZE | INV_TABLE | INV_SECTION;
@@ -978,7 +979,7 @@ void ViewShell::Reformat()
 
  void ViewShell::ChgNumberDigits()
  {
-     SdrModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
+     SwDrawModel* pTmpDrawModel = getIDocumentDrawModelAccess()->GetDrawModel();
      if ( pTmpDrawModel )
             pTmpDrawModel->ReformatAllTextObjects();
      Reformat();
diff --git a/sw/source/filter/html/htmldraw.cxx b/sw/source/filter/html/htmldraw.cxx
index f287a1c..3b0d526 100644
--- a/sw/source/filter/html/htmldraw.cxx
+++ b/sw/source/filter/html/htmldraw.cxx
@@ -19,12 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include "hintids.hxx"
 #include <vcl/svapp.hxx>
 #include <vcl/wrkwin.hxx>
@@ -33,7 +30,6 @@
 #include <svx/svdobj.hxx>
 #include <svx/svdotext.hxx>
 #include <editeng/eeitem.hxx>
-
 #ifndef _OUTLINER_HXX //autogen
 #define _EEITEMID_HXX
 #include <editeng/outliner.hxx>
@@ -49,8 +45,6 @@
 #include <svtools/htmltokn.h>
 #include <svtools/htmlkywd.hxx>
 #include <svx/svdpool.hxx>
-
-
 #include "charatr.hxx"
 #include <frmfmt.hxx>
 #include <fmtanchr.hxx>
@@ -62,10 +56,10 @@
 #include "swcss1.hxx"
 #include "swhtml.hxx"
 #include "wrthtml.hxx"
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
-
 const sal_uInt32 HTML_FRMOPTS_MARQUEE   =
     HTML_FRMOPT_ALIGN |
     HTML_FRMOPT_SPACE;
@@ -383,7 +377,7 @@ void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
 
     // Ein DrawTxtobj anlegen
     // --> OD 2005-08-08 #i52858# - method name changed
-    SdrModel* pModel = pDoc->GetOrCreateDrawModel();
+    SwDrawModel* pModel = pDoc->GetOrCreateDrawModel();
     // <--
     SdrPage* pPg = pModel->GetPage( 0 );
     pMarquee = SdrObjFactory::MakeNewObject( SdrInventor,
diff --git a/sw/source/filter/rtf/rtffly.cxx b/sw/source/filter/rtf/rtffly.cxx
index f6802bc..dba3787 100644
--- a/sw/source/filter/rtf/rtffly.cxx
+++ b/sw/source/filter/rtf/rtffly.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
 #include <hintids.hxx>
 #include <tools/list.hxx>
@@ -61,15 +60,11 @@
 #include <deque>
 #include <map>
 #include <utility>
-// --> OD 2004-06-30 #i27767#
 #include <fmtwrapinfluenceonobjpos.hxx>
-// <--
 #include <editeng/brshitem.hxx>
 #include <fmtfollowtextflow.hxx>
-// --> OD, FLR 2006-02-16 #131205#
 #include "dcontact.hxx"
-// <--
-
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx
index cb2e0db..15e81c5 100644
--- a/sw/source/filter/rtf/swparrtf.cxx
+++ b/sw/source/filter/rtf/swparrtf.cxx
@@ -19,15 +19,12 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
 #include <hintids.hxx>
-
 #include <stack>
-
 #include <tools/errinf.hxx>
 #include <tools/stream.hxx>
 #include <svl/itemiter.hxx>
@@ -82,14 +79,11 @@
 #include <statstr.hrc>          // ResId fuer Statusleiste
 #include <SwStyleNameMapper.hxx>
 #include <tblsel.hxx>           // SwSelBoxes
-
 #include <docsh.hxx>
 #include <fmtlsplt.hxx> // SwLayoutSplit
 #include <editeng/keepitem.hxx>
 #include <svx/svdopath.hxx>
 #include <svx/svdorect.hxx>
-
-
 #include <fmtsrnd.hxx>
 #include <fmtfollowtextflow.hxx>
 #include <svx/svdmodel.hxx>
@@ -101,19 +95,16 @@
 #include <svx/svdoutl.hxx>
 #include <editeng/outlobj.hxx>
 #include <editeng/paperinf.hxx>
-
 #include <tools/stream.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/polygon/b2dpolypolygon.hxx>
 #include <basegfx/range/b2drange.hxx>
 #include <vcl/salbtype.hxx>     // FRound
-
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
-
 // einige Hilfs-Funktionen
 // char
 inline const SvxFontHeightItem& GetSize(const SfxItemSet& rSet,sal_Bool bInP=sal_True)
@@ -1305,7 +1296,7 @@ void SwRTFParser::ReadDrawingObject()
         aFlySet.Put( aVert );
 
         pDoc->GetOrCreateDrawModel();
-        SdrModel* pDrawModel  = pDoc->GetDrawModel();
+        SwDrawModel* pDrawModel  = pDoc->GetDrawModel();
         SdrPage* pDrawPg = pDrawModel->GetPage(0);
         pDrawPg->InsertObject(pStroke, 0);
 
@@ -1339,7 +1330,7 @@ void SwRTFParser::InsertShpObject(SdrObject* pStroke, int _nZOrder)
         aFlySet.Put(SvxOpaqueItem(RES_OPAQUE,false));
 
         pDoc->GetOrCreateDrawModel();
-        SdrModel* pDrawModel  = pDoc->GetDrawModel();
+        SwDrawModel* pDrawModel  = pDoc->GetDrawModel();
         SdrPage* pDrawPg = pDrawModel->GetPage(0);
         pDrawPg->InsertObject(pStroke);
         pDrawPg->SetObjectOrdNum(pStroke->GetOrdNum(), _nZOrder);
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 8b46e24..188296d 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1696,7 +1696,7 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const sw::Frame &rFrame, const Po
                     bool bSwapInPage = false;
                     if ( !pSdrObj->GetPage() )
                     {
-                        if ( SdrModel* pModel = m_rExport.pDoc->GetDrawModel() )
+                        if ( SwDrawModel* pModel = m_rExport.pDoc->GetDrawModel() )
                         {
                             if ( SdrPage *pPage = pModel->GetPage( 0 ) )
                             {
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx b/sw/source/filter/ww8/rtfattributeoutput.cxx
index c967ab8..5563916 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -19,7 +19,8 @@
  *
  *************************************************************/
 
-
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
 
 #include "rtfattributeoutput.hxx"
 #include "rtfexport.hxx"
@@ -34,14 +35,10 @@
 #include "fmtruby.hxx"
 #include "charfmt.hxx"
 #include "breakit.hxx"
-
 #include <i18npool/mslangid.hxx>
-
 #include <hintids.hxx>
-
 #include <svl/poolitem.hxx>
 #include <svtools/rtfkeywd.hxx>
-
 #include <editeng/fontitem.hxx>
 #include <editeng/tstpitem.hxx>
 #include <editeng/adjitem.hxx>
@@ -86,7 +83,6 @@
 #include <svx/fmglob.hxx>
 #include <svx/svdouno.hxx>
 #include <filter/msfilter/msoleexp.hxx>
-
 #include <docufld.hxx>
 #include <flddropdown.hxx>
 #include <format.hxx>
@@ -116,23 +112,19 @@
 #include <ndole.hxx>
 #include <lineinfo.hxx>
 #include <rtf.hxx>
-
 #include <rtl/strbuf.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <rtl/ustring.hxx>
-
 #include <tools/color.hxx>
-
 #include <vcl/cvtgrf.hxx>
-
 #include <com/sun/star/i18n/ScriptType.hdl>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <com/sun/star/frame/XModel.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNamed.hpp>
-
 #include <osl/diagnose.h>
+#include <drawdoc.hxx>
 
 using rtl::OString;
 using rtl::OStringBuffer;
@@ -1732,7 +1724,7 @@ void RtfAttributeOutput::OutputFlyFrame_Impl( const sw::Frame& rFrame, const Poi
                     bool bSwapInPage = false;
                     if ( !pSdrObj->GetPage() )
                     {
-                        if ( SdrModel* pModel = m_rExport.pDoc->GetDrawModel() )
+                        if ( SwDrawModel* pModel = m_rExport.pDoc->GetDrawModel() )
                         {
                             if ( SdrPage *pPage = pModel->GetPage( 0 ) )
                             {
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index 4dc8077..85a72ca 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -19,16 +19,12 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
 #include <com/sun/star/embed/Aspects.hpp>
-
-
 #include <hintids.hxx>
-
 #define _SVSTDARR_ULONGSSORT
 #define _SVSTDARR_USHORTS
 #include <svl/svstdarr.hxx>
@@ -56,27 +52,21 @@
 #include <editeng/editeng.hxx>
 #ifndef _SVX_FLDITEM_HXX
 //miserable hack to get around #98519#
-
 #include <editeng/flditem.hxx>
 #endif
-
 #include <comphelper/seqstream.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <svtools/filter.hxx>
 #include <svx/fmglob.hxx>
 #include <svx/svdouno.hxx>
 #include <svx/unoapi.hxx>
-
-// #i71538#
 #include <svx/svdview.hxx>
 #include <fmtcnct.hxx>
 #include <fmtanchr.hxx>
 #include <fmtsrnd.hxx>
 #include <fmtornt.hxx>
 #include <fmtfsize.hxx>
-// --> OD 2005-01-06 #i30669#
 #include <fmtfollowtextflow.hxx>
-// <--
 #include <dcontact.hxx>
 #include <frmfmt.hxx>
 #include <fmtcntnt.hxx>
@@ -98,9 +88,7 @@
 #include "writerwordglue.hxx"
 #include "wrtww8.hxx"
 #include "escher.hxx"
-// --> OD 2007-07-24 #148096#
 #include <ndtxt.hxx>
-// <--
 #include "WW8FFData.hxx"
 #include <editeng/shaditem.hxx>
 #include <svx/unoapi.hxx>
@@ -110,6 +98,7 @@
 #include "sfx2/sfxsids.hrc"
 #include <svl/urihelper.hxx>
 #include <unotools/saveopt.hxx>
+#include <drawdoc.hxx>
 
 using namespace com::sun::star;
 using namespace sw::util;
@@ -986,7 +975,7 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
         SwFrmFmt* pFmt = (SwFrmFmt*)&rFmt;
         nOrdNum = pDoc->GetSpzFrmFmts()->GetPos( pFmt );
 
-        const SdrModel* pModel = pDoc->GetDrawModel();
+        const SwDrawModel* pModel = pDoc->GetDrawModel();
         if( pModel )
             nOrdNum += pModel->GetPage( 0 )->GetObjCount();
     }
@@ -2166,7 +2155,7 @@ sal_Int32 SwEscherEx::WriteFlyFrameAttr(const SwFrmFmt& rFmt, MSO_SPT eShapeType
 void SwBasicEscherEx::Init()
 {
     MapUnit eMap = MAP_TWIP;
-    if (SdrModel *pModel = rWrt.pDoc->GetDrawModel())
+    if (SwDrawModel* pModel = rWrt.pDoc->GetDrawModel())
     {
         // PPT arbeitet nur mit Einheiten zu 576DPI
         // WW hingegen verwendet twips, dh. 1440DPI.
@@ -2289,7 +2278,7 @@ SwEscherEx::SwEscherEx(SvStream* pStrm, WW8Export& rWW8Wrt)
                             bool bSwapInPage = false;
                             if (!pSdrObj->GetPage())
                             {
-                                if (SdrModel* pModel = rWrt.pDoc->GetDrawModel())
+                                if (SwDrawModel* pModel = rWrt.pDoc->GetDrawModel())
                                 {
                                     if (SdrPage *pPage = pModel->GetPage(0))
                                     {
@@ -3044,7 +3033,7 @@ void SwEscherEx::WriteOCXControl( const SwFrmFmt& rFmt, sal_uInt32 nShapeId )
     {
         OpenContainer( ESCHER_SpContainer );
 
-        SdrModel *pModel = rWrt.pDoc->GetDrawModel();
+        SwDrawModel* pModel = rWrt.pDoc->GetDrawModel();
         OutputDevice *pDevice = Application::GetDefaultDevice();
         ASSERT(pModel && pDevice, "no model or device");
 
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 15c140f..dc4c9e8 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -19,31 +19,23 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
 
 #include <iostream>
-
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <com/sun/star/embed/XStorage.hpp>
 #include <unotools/ucbstreamhelper.hxx>
-
 #include <algorithm>
-
 #include <map>
 #include <set>
-
 #include <hintids.hxx>
 #include <string.h>             // memcpy()
 #include <osl/endian.h>
 #include <docsh.hxx>
-
 #define _SVSTDARR_BOOLS
 #include <svl/svstdarr.hxx>
-
 #include <unotools/fltrcfg.hxx>
 #include <vcl/salbtype.hxx>
 #include <sot/storage.hxx>
@@ -97,19 +89,14 @@
 #include <comphelper/extract.hxx>
 #include <comphelper/stlunosequence.hxx>
 #include <writerfilter/doctok/sprmids.hxx>
-
 #include "writerhelper.hxx"
 #include "writerwordglue.hxx"
 #include "ww8attributeoutput.hxx"
-
 #include <IDocumentMarkAccess.hxx>
 #include <xmloff/odffields.hxx>
-
 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
 #include <com/sun/star/document/XDocumentProperties.hpp>
-
 #include "dbgoutsw.hxx"
-
 #include <sfx2/docfile.hxx>
 #include <sfx2/request.hxx>
 #include <sfx2/frame.hxx>
@@ -123,9 +110,8 @@
 #include <editeng/charrotateitem.hxx>
 #include "WW8FibData.hxx"
 #include "numrule.hxx"
-
 #include <boost/scoped_ptr.hpp>
-
+#include <drawdoc.hxx>
 
 using namespace sw::util;
 using namespace sw::types;
diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx
index 4adc469b..091d366 100644
--- a/sw/source/filter/ww8/ww8graf.cxx
+++ b/sw/source/filter/ww8/ww8graf.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil -*- */
 #include <svl/urihelper.hxx>
 #include <hintids.hxx>
@@ -89,20 +88,18 @@
 #include <fmtinfmt.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/flditem.hxx>
-// OD 30.09.2003 #i18732#
 #include <fmtfollowtextflow.hxx>
 #include "writerhelper.hxx"
 #include "writerwordglue.hxx"
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <editeng/editobj.hxx>
-
 #include <math.h>
-
 #include <fmturl.hxx>
 #include <svx/hlnkitem.hxx>
 #include <svl/whiter.hxx>
 #include "ww8par2.hxx"
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace sw::types;
diff --git a/sw/source/filter/xml/swxml.cxx b/sw/source/filter/xml/swxml.cxx
index 1f33ff7..fa91bae 100644
--- a/sw/source/filter/xml/swxml.cxx
+++ b/sw/source/filter/xml/swxml.cxx
@@ -19,14 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
-
-
 #define _SVSTDARR_STRINGS
 #include <rsc/rscsfx.hxx>
 #include <tools/urlobj.hxx>
@@ -57,7 +52,6 @@
 #include <svx/xmleohlp.hxx>
 #include <comphelper/genericpropertyset.hxx>
 #include <rtl/logfile.hxx>
-
 #include <sfx2/frame.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <swerror.h>
@@ -68,33 +62,21 @@
 #include <unotextrange.hxx>
 #include <swmodule.hxx>
 #include <SwXMLSectionList.hxx>
-
 #include <statstr.hrc>
-
-// --> OD 2005-09-06 #i44177#
 #include <SwStyleNameMapper.hxx>
 #include <poolfmt.hxx>
 #include <numrule.hxx>
 #include <paratr.hxx>
-// <--
-
-// --> OD 2006-02-22 #b6382898#
 #include <svx/svdmodel.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svditer.hxx>
 #include <svx/svdoole2.hxx>
 #include <svx/svdograf.hxx>
-// <--
-
-// --> OD 2008-12-17 #i70748#
 #include <sfx2/docfilt.hxx>
-// <--
-
 #include <istyleaccess.hxx>
 #define LOGFILE_AUTHOR "mb93740"
-
 #include <sfx2/DocumentMetadataAccess.hxx>
-
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
diff --git a/sw/source/filter/xml/xmlexp.cxx b/sw/source/filter/xml/xmlexp.cxx
index bdcd974..da2d47f 100644
--- a/sw/source/filter/xml/xmlexp.cxx
+++ b/sw/source/filter/xml/xmlexp.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -59,12 +57,10 @@
 #include <editeng/unolingu.hxx>
 #include <editeng/forbiddencharacterstable.hxx>
 #include <ForbiddenCharactersEnum.hxx>
-
-// for locking SolarMutex: svapp + mutex
 #include <vcl/svapp.hxx>
 #include <vos/mutex.hxx>
-
 #include <pausethreadstarting.hxx>
+#include <drawdoc.hxx>
 
 using ::rtl::OUString;
 using namespace ::com::sun::star;
@@ -326,7 +322,7 @@ sal_uInt32 SwXMLExport::exportDoc( enum XMLTokenEnum eClass )
     if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT)) != 0 )
     {
         //Auf die Korrektheit der OrdNums sind wir schon angewiesen.
-        SdrModel* pModel = pDoc->GetDrawModel();
+        SwDrawModel* pModel = pDoc->GetDrawModel();
         if( pModel )
             pModel->GetPage( 0 )->RecalcObjOrdNums();
     }
diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx
index 7ad8ea8..610bff5 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -61,14 +59,12 @@
 #include <tools/diagnose_ex.h>
 #include <hash_set>
 #include <stringhash.hxx>
-
-// for locking SolarMutex: svapp + mutex
 #include <vcl/svapp.hxx>
 #include <vos/mutex.hxx>
 #include <unotxdoc.hxx>    // for initXForms()
-
 #include <xmloff/xmlmetai.hxx>
 #include <xmloff/xformsimport.hxx>
+#include <drawdoc.hxx>
 
 using ::rtl::OUString;
 
@@ -759,7 +755,7 @@ void SwXMLImport::startDocument( void )
     // <--
 
     // SJ: #i49801# locking the modell to disable repaints
-    SdrModel* pDrawModel = pDoc->GetDrawModel();
+    SwDrawModel* pDrawModel = pDoc->GetDrawModel();
     if ( pDrawModel )
         pDrawModel->setLock( sal_True );
 
@@ -965,7 +961,7 @@ void SwXMLImport::endDocument( void )
     // SJ: #i49801# -> now permitting repaints
     if ( pDoc )
     {
-        SdrModel* pDrawModel = pDoc->GetDrawModel();
+        SwDrawModel* pDrawModel = pDoc->GetDrawModel();
         if ( pDrawModel )
             pDrawModel->setLock( sal_False );
     }
diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx
index 16e07a1..316b0be 100644
--- a/sw/source/ui/app/docsh.cxx
+++ b/sw/source/ui/app/docsh.cxx
@@ -271,7 +271,7 @@ sal_Bool SwDocShell::ConvertFrom( SfxMedium& rMedium )
     }
 
     UpdateFontList();
-    InitDraw();
+    InitDrawModelAndDocShell(this, pDoc ? pDoc->GetDrawModel() : 0);
 
     delete pRdr;
 
diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx
index 952b204..071e58a 100644
--- a/sw/source/ui/app/docshdrw.cxx
+++ b/sw/source/ui/app/docshdrw.cxx
@@ -19,35 +19,19 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <hintids.hxx>
-
-#ifndef _SVX_SVXIDS_HRC //autogen
 #include <svx/svxids.hrc>
-#endif
-
-
-
-
-
-
-
-
 #include <svl/stritem.hxx>
 #include <svx/drawitem.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/svdoutl.hxx>
 #include <svx/xtable.hxx>
-
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>
-#endif
 #include <doc.hxx>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
@@ -55,26 +39,58 @@ using namespace ::com::sun::star;
     Beschreibung: Document laden
  --------------------------------------------------------------------*/
 
-
-void  SwDocShell::InitDraw()
+void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocument)
 {
-    SdrModel *pDrDoc = pDoc->GetDrawModel();
-    if( pDrDoc )
+    if(pSwDrawDocument)
     {
-        // Listen, bzw. Tables im ItemSet der DocShell anlegen
-        PutItem( SvxGradientListItem( pDrDoc->GetGradientListFromSdrModel(), SID_GRADIENT_LIST ) );
-        PutItem( SvxHatchListItem( pDrDoc->GetHatchListFromSdrModel(), SID_HATCH_LIST ) );
-        PutItem( SvxBitmapListItem( pDrDoc->GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) );
-        PutItem( SvxDashListItem( pDrDoc->GetDashListFromSdrModel(), SID_DASH_LIST ) );
-        PutItem( SvxLineEndListItem( pDrDoc->GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) );
-
-        Outliner& rOutliner = pDrDoc->GetDrawOutliner();
-        uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() );
-        rOutliner.SetHyphenator( xHyphenator );
+        if(pSwDocShell == pSwDrawDocument->GetObjectShell())
+        {
+            // association already done, nothing to do
+        }
+        else
+        {
+            // set object shell (mainly for FormControl stuff), maybe zero
+            pSwDrawDocument->SetObjectShell(pSwDocShell);
+
+            // set persist, maybe zero
+            pSwDrawDocument->SetPersist(pSwDocShell);
+
+            // get and decide on the color table to use
+            if(pSwDocShell)
+            {
+                const SvxColorTableItem* pColItemFromDocShell = static_cast< const SvxColorTableItem* >(pSwDocShell->GetItem(SID_COLOR_TABLE));
+
+                if(pColItemFromDocShell)
+                {
+                    // the DocShell has a ColorTable, use it also in DrawingLayer
+                    pSwDrawDocument->SetColorTableAtSdrModel(pColItemFromDocShell->GetColorTable());
+                }
+                else
+                {
+                    // Use the ColorTable which is used at the DrawingLayer's SdrModel
+                    pSwDocShell->PutItem(SvxColorTableItem(pSwDrawDocument->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
+                }
+
+                // add other tables in SfxItemSet of the DocShell
+                pSwDocShell->PutItem(SvxGradientListItem(pSwDrawDocument->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
+                pSwDocShell->PutItem(SvxHatchListItem(pSwDrawDocument->GetHatchListFromSdrModel(), SID_HATCH_LIST));
+                pSwDocShell->PutItem(SvxBitmapListItem(pSwDrawDocument->GetBitmapListFromSdrModel(), SID_BITMAP_LIST));
+                pSwDocShell->PutItem(SvxDashListItem(pSwDrawDocument->GetDashListFromSdrModel(), SID_DASH_LIST));
+                pSwDocShell->PutItem(SvxLineEndListItem(pSwDrawDocument->GetLineEndListFromSdrModel(), SID_LINEEND_LIST));
+            }
+
+            // init hyphenator for DrawingLayer outliner
+            uno::Reference<linguistic2::XHyphenator> xHyphenator(::GetHyphenator());
+            Outliner& rOutliner = pSwDrawDocument->GetDrawOutliner();
+
+            rOutliner.SetHyphenator(xHyphenator);
+        }
+    }
+    else if(pSwDocShell)
+    {
+        // fallback: add the default color list to have one when someone requests it from the DocShell
+        pSwDocShell->PutItem(SvxColorTableItem(XColorList::GetStdColorList(), SID_COLOR_TABLE));
     }
-    else
-        PutItem( SvxColorTableItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ));
 }
 
-
-
+//eof
diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx
index c217d44..c104da9 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -637,7 +637,7 @@ sal_Bool  SwDocShell::Load( SfxMedium& rMedium )
         }
 
         UpdateFontList();
-        InitDraw();
+        InitDrawModelAndDocShell(this, pDoc ? pDoc->GetDrawModel() : 0);
 
         SetError( nErr, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX ) ) );
         bRet = !IsError( nErr );
@@ -736,7 +736,7 @@ void SwDocShell::SubInitNew()
     ASSERT( !mxBasePool.is(), "wer hat seinen Pool nicht zerstoert?" );
     mxBasePool = new SwDocStyleSheetPool( *pDoc, SFX_CREATE_MODE_ORGANIZER == GetCreateMode() );
     UpdateFontList();
-    InitDraw();
+    InitDrawModelAndDocShell(this, pDoc ? pDoc->GetDrawModel() : 0);
 
     pDoc->setLinkUpdateMode( GLOBALSETTING );
     pDoc->setFieldUpdateFlags( AUTOUPD_GLOBALSETTING );
diff --git a/sw/source/ui/app/docst.cxx b/sw/source/ui/app/docst.cxx
index 8225d86..e9eef34 100644
--- a/sw/source/ui/app/docst.cxx
+++ b/sw/source/ui/app/docst.cxx
@@ -19,15 +19,12 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/container/XNameAccess.hpp>
-
 #include <hintids.hxx>
 #include <sfx2/app.hxx>
 #include <svl/whiter.hxx>
@@ -53,11 +50,8 @@
 #include <SwRewriter.hxx>
 #include <numrule.hxx>
 #include <swundo.hxx>
-
-//UUUU
 #include <svx/svdmodel.hxx>
 #include <svx/drawitem.hxx>
-
 #include "view.hxx"
 #include "wrtsh.hxx"
 #include "docsh.hxx"
@@ -79,15 +73,12 @@
 #include "swevent.hxx"
 #include "edtwin.hxx"
 #include "unochart.hxx"
-
 #include "app.hrc"
 #include <fmtui.hrc>
 #include "swabstdlg.hxx"
-// --> OD 2008-03-27 #refactorlists#
 #include <list.hxx>
-// <--
-
 #include <paratr.hxx>   //#outline level,add by zhaojianwei
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
@@ -674,7 +665,7 @@ sal_uInt16 SwDocShell::Edit(
         //UUUU create needed items for XPropertyList entries from the DrawModel so that
         // the Area TabPage can access them
         SfxItemSet& rSet = xTmp->GetItemSet();
-        const SdrModel* pDrawModel = GetDoc()->GetDrawModel();
+        const SwDrawModel* pDrawModel = GetDoc()->GetDrawModel();
 
         rSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
         rSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
diff --git a/sw/source/ui/app/docstyle.cxx b/sw/source/ui/app/docstyle.cxx
index 5ea6db5..4346db0 100644
--- a/sw/source/ui/app/docstyle.cxx
+++ b/sw/source/ui/app/docstyle.cxx
@@ -19,13 +19,10 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #define _SVSTDARR_USHORTS
-
 #include <svl/smplhint.hxx>
 #include <hintids.hxx>
 #include <svl/itemiter.hxx>
@@ -63,12 +60,11 @@
 #include <fmthdft.hxx>
 #include <svx/svxids.hrc>
 #include <SwRewriter.hxx>
-
-//UUUU
 #include <svx/xfillit0.hxx>
 #include <svx/xflftrit.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/drawitem.hxx>
+#include <drawdoc.hxx>
 
 // MD 06.02.95: Die Formatnamen in der Liste aller Namen haben als
 // erstes Zeichen die Familie:
@@ -1115,7 +1111,7 @@ SfxItemSet&   SwDocStyleSheet::GetItemSet()
 
                     //UUUU create needed items for XPropertyList entries from the DrawModel so that
                     // the Area TabPage can access them
-                    const SdrModel* pDrawModel = rDoc.GetDrawModel();
+                    const SwDrawModel* pDrawModel = rDoc.GetDrawModel();
 
                     aCoreSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
                     aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
diff --git a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
index 18429be..b0ee422 100644
--- a/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/ui/dialog/SwSpellDialogChildWindow.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -54,7 +52,7 @@
 #include <unotextrange.hxx>
 #include <dialog.hrc>
 #include <cmdid.h>
-
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
diff --git a/sw/source/ui/lingu/sdrhhcwrap.cxx b/sw/source/ui/lingu/sdrhhcwrap.cxx
index 0110d41..12778cb 100644
--- a/sw/source/ui/lingu/sdrhhcwrap.cxx
+++ b/sw/source/ui/lingu/sdrhhcwrap.cxx
@@ -19,10 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
+
 #include <hintids.hxx>
 #include <svx/svditer.hxx>
 #include <svx/svdotext.hxx>
@@ -40,17 +39,14 @@
 #include <unotools/localedatawrapper.hxx>
 #include <sdrhhcwrap.hxx>
 #include <frmfmt.hxx>
-#ifndef _DOCSH_HXX
 #include <docsh.hxx>        //     "     "     "
-#endif
 #include <wrtsh.hxx>        //  MakeVisible
-#ifndef _VIEW_HXX
 #include <view.hxx>
-#endif
 #include <dcontact.hxx>     // Spelling von DrawObj
 #include <doc.hxx>        //     "     "     "
 #include <docary.hxx>
 #include <edtwin.hxx>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using ::rtl::OUString;
diff --git a/sw/source/ui/shells/drwbassh.cxx b/sw/source/ui/shells/drwbassh.cxx
index ed3bc84..53b2b2f 100644
--- a/sw/source/ui/shells/drwbassh.cxx
+++ b/sw/source/ui/shells/drwbassh.cxx
@@ -19,12 +19,9 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <tools/shl.hxx>
 #include <hintids.hxx>
 #include <helpid.h>
@@ -57,7 +54,6 @@
 #include <svx/svdogrp.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svditer.hxx>
-
 #include <shells.hrc>
 #define SwDrawBaseShell
 #include <sfx2/msg.hxx>
@@ -70,8 +66,8 @@
 #include <com/sun/star/text/HoriOrientation.hpp>
 #include <com/sun/star/text/VertOrientation.hpp>
 #include <com/sun/star/text/RelOrientation.hpp>
-
 #include <IDocumentDrawModelAccess.hxx>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 
@@ -651,7 +647,7 @@ IMPL_LINK( SwDrawBaseShell, CheckGroupShapeNameHdl, AbstractSvxNameDialog*, pNam
     else
     {
         nRet = 1;
-        SdrModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
+        SwDrawModel* pModel = rSh.getIDocumentDrawModelAccess()->GetDrawModel();
         // --> OD 2006-03-09 #i51726# - all drawing objects can be named now.
         // consider also drawing objects inside group objects
 //        SdrPage* pPage = pModel->GetPage(0);
diff --git a/sw/source/ui/shells/frmsh.cxx b/sw/source/ui/shells/frmsh.cxx
index 5d0bb98..385903b 100644
--- a/sw/source/ui/shells/frmsh.cxx
+++ b/sw/source/ui/shells/frmsh.cxx
@@ -76,9 +76,9 @@
 #include "swabstdlg.hxx"
 #include "misc.hrc"
 #include <svx/dialogs.hrc>
-
 #include <docsh.hxx>
 #include <svx/drawitem.hxx>
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -449,7 +449,7 @@ void SwFrameShell::Execute(SfxRequest &rReq)
 
                 //UUUU create needed items for XPropertyList entries from the DrawModel so that
                 // the Area TabPage can access them
-                const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
+                const SwDrawModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
 
                 aSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
                 aSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
diff --git a/sw/source/ui/shells/grfsh.cxx b/sw/source/ui/shells/grfsh.cxx
index 5b50490..2ecdeda 100644
--- a/sw/source/ui/shells/grfsh.cxx
+++ b/sw/source/ui/shells/grfsh.cxx
@@ -19,17 +19,10 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
-
-
-#ifndef _CMDID_H
 #include <cmdid.h>
-#endif
 #include <hintids.hxx>
 #include <tools/urlobj.hxx>
 #include <vcl/msgbox.hxx>
@@ -38,7 +31,6 @@
 #include <svl/urihelper.hxx>
 #include <sfx2/docfile.hxx>
 #include <sfx2/dispatch.hxx>
-
 #include <sfx2/objface.hxx>
 #include <editeng/sizeitem.hxx>
 #include <editeng/protitem.hxx>
@@ -74,16 +66,14 @@
 #include <swwait.hxx>
 #include <shells.hrc>
 #include <popup.hrc>
-
 #include <doc.hxx>
 #include <docsh.hxx>
 #include <svx/drawitem.hxx>
-
 #define SwGrfShell
 #include <sfx2/msg.hxx>
 #include "swslots.hxx"
-
 #include "swabstdlg.hxx"
+#include <drawdoc.hxx>
 
 #define TOOLBOX_NAME    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "colorbar" ) )
 
@@ -161,7 +151,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
 
             //UUUU create needed items for XPropertyList entries from the DrawModel so that
             // the Area TabPage can access them
-            const SdrModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
+            const SwDrawModel* pDrawModel = rSh.GetView().GetDocShell()->GetDoc()->GetDrawModel();
 
             aSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
             aSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
diff --git a/sw/source/ui/shells/textsh1.cxx b/sw/source/ui/shells/textsh1.cxx
index c33e766..8c5b875 100644
--- a/sw/source/ui/shells/textsh1.cxx
+++ b/sw/source/ui/shells/textsh1.cxx
@@ -19,20 +19,16 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
 #include <com/sun/star/i18n/WordType.hpp>
 #include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-
 #include <comphelper/processfactory.hxx>
 #include <svx/dialogs.hrc>
 #include <hintids.hxx>
 #include <cmdid.h>
 #include <helpid.h>
-
 #include <i18npool/mslangid.hxx>
 #include <svl/languageoptions.hxx>
 #include <editeng/langitem.hxx>
@@ -91,7 +87,6 @@
 #include <edtwin.hxx>
 #include <redlndlg.hxx>
 #include "fldmgr.hxx"
-
 #include <globals.hrc>
 #include <shells.hrc>
 #include <app.hrc>
@@ -102,15 +97,12 @@
 #include <vcl/svapp.hxx>
 #include <sfx2/app.hxx>
 #include <breakit.hxx>
-
 #include <SwSmartTagMgr.hxx>
-
 #include <editeng/acorrcfg.hxx>
 #include "swabstdlg.hxx"
 #include "misc.hrc"
 #include "chrdlg.hrc"
 #include <IDocumentStatistics.hxx>
-
 #include <sfx2/sfxdlg.hxx>
 #include <svl/languageoptions.hxx>
 #include <unotools/lingucfg.hxx>
@@ -125,25 +117,16 @@
 #include <pam.hxx>
 #include <sfx2/objface.hxx>
 #include <langhelper.hxx>
-
-#ifndef _NBDTMGFACT_HXX
 #include <svx/nbdtmgfact.hxx>
-#endif
-#ifndef _NBDTMG_HXX
 #include <svx/nbdtmg.hxx>
-#endif
-
-//UUUU
 #include <svx/svdmodel.hxx>
 #include <svx/drawitem.hxx>
-
 #include <numrule.hxx>
-
+#include <drawdoc.hxx>
 
 using namespace ::com::sun::star;
 using namespace svx::sidebar;
 
-
 void lcl_CharDialog( SwWrtShell &rWrtSh, sal_Bool bUseDialog, sal_uInt16 nSlot,const SfxItemSet *pArgs, SfxRequest *pReq )
 {
     FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &rWrtSh.GetView()));
@@ -931,7 +914,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             //UUUU create needed items for XPropertyList entries from the DrawModel so that
             // the Area TabPage can access them
             // Do this after GetCurAttr, this resets the ItemSet content again
-            const SdrModel* pDrawModel = GetView().GetDocShell()->GetDoc()->GetDrawModel();
+            const SwDrawModel* pDrawModel = GetView().GetDocShell()->GetDoc()->GetDrawModel();
 
             aCoreSet.Put(SvxColorTableItem(pDrawModel->GetColorTableFromSdrModel(), SID_COLOR_TABLE));
             aCoreSet.Put(SvxGradientListItem(pDrawModel->GetGradientListFromSdrModel(), SID_GRADIENT_LIST));
diff --git a/sw/source/ui/uiview/view.cxx b/sw/source/ui/uiview/view.cxx
index b91d748..e974a65 100644
--- a/sw/source/ui/uiview/view.cxx
+++ b/sw/source/ui/uiview/view.cxx
@@ -1677,10 +1677,11 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
                     //#i76332# if document is to be opened in alive-mode then this has to be regarded while switching from readonly-mode to edit-mode
                     if( !bReadonly )
                     {
-                        SwDrawDocument * pDrawDoc = 0;
-                        if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (GetDocShell()->GetDoc()->GetDrawModel() ) ) )
+                        SwDrawModel* pDrawModel = 0;
+
+                        if ( 0 != ( pDrawModel = GetDocShell()->GetDoc()->GetDrawModel() ) )
                         {
-                            if( !pDrawDoc->GetOpenInDesignMode() )
+                            if( !pDrawModel->GetOpenInDesignMode() )
                                 break;// don't touch the design mode
                         }
                     }
diff --git a/sw/source/ui/uno/unodefaults.cxx b/sw/source/ui/uno/unodefaults.cxx
index 199133d..fbac525 100644
--- a/sw/source/ui/uno/unodefaults.cxx
+++ b/sw/source/ui/uno/unodefaults.cxx
@@ -19,16 +19,14 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
-
 #include <unodefaults.hxx>
 #include <svx/svdmodel.hxx>
 #include <svx/unoprov.hxx>
 #include <doc.hxx>
+#include <drawdoc.hxx>
 
 /* -----------------------------13.03.01 14:16--------------------------------
 
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 29b9752..efee181 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -2088,11 +2088,13 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
         break;
         case WID_DOC_AUTOMATIC_CONTROL_FOCUS:
         {
-            SwDrawDocument * pDrawDoc;
+            SwDrawModel* pDrawModel = 0;
             sal_Bool bAuto = *(sal_Bool*) aValue.getValue();
 
-            if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * >( pDocShell->GetDoc()->GetDrawModel() ) ) )
-                pDrawDoc->SetAutoControlFocus( bAuto );
+            if ( 0 != ( pDrawModel = pDocShell->GetDoc()->GetDrawModel() ) )
+            {
+                pDrawModel->SetAutoControlFocus( bAuto );
+            }
             else if (bAuto)
             {
                 // if setting to true, and we don't have an
@@ -2101,19 +2103,21 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
                 // SdrModel and we are leaving the default at false,
                 // we don't need to make an SdrModel and can do nothing
                 // --> OD 2005-08-08 #i52858# - method name changed
-                pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() );
+                pDrawModel = pDocShell->GetDoc()->GetOrCreateDrawModel();
                 // <--
-                pDrawDoc->SetAutoControlFocus ( bAuto );
+                pDrawModel->SetAutoControlFocus ( bAuto );
             }
         }
         break;
         case WID_DOC_APPLY_FORM_DESIGN_MODE:
         {
-            SwDrawDocument * pDrawDoc;
+            SwDrawModel* pDrawModel = 0;
             sal_Bool bMode = *(sal_Bool*)aValue.getValue();
 
-            if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
-                pDrawDoc->SetOpenInDesignMode( bMode );
+            if ( 0 != ( pDrawModel = pDocShell->GetDoc()->GetDrawModel() ) )
+            {
+                pDrawModel->SetOpenInDesignMode( bMode );
+            }
             else if (!bMode)
             {
                 // if setting to false, and we don't have an
@@ -2123,9 +2127,9 @@ void SwXTextDocument::setPropertyValue(const OUString& rPropertyName,
                 // we don't need to make an SdrModel and can do
                 // nothing
                 // --> OD 2005-08-08 #i52858# - method name changed
-                pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetOrCreateDrawModel() );
+                pDrawModel = pDocShell->GetDoc()->GetOrCreateDrawModel();
                 // <--
-                pDrawDoc->SetOpenInDesignMode ( bMode );
+                pDrawModel->SetOpenInDesignMode ( bMode );
             }
         }
         break;
@@ -2268,23 +2272,35 @@ Any SwXTextDocument::getPropertyValue(const OUString& rPropertyName)
         break;
         case WID_DOC_AUTOMATIC_CONTROL_FOCUS:
         {
-            SwDrawDocument * pDrawDoc;
-            sal_Bool bAuto;
-            if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
-                bAuto = pDrawDoc->GetAutoControlFocus();
+            SwDrawModel* pDrawModel = 0;
+            sal_Bool bAuto(sal_False);
+
+            if ( 0 != ( pDrawModel = pDocShell->GetDoc()->GetDrawModel() ) )
+            {
+                bAuto = pDrawModel->GetAutoControlFocus();
+            }
             else
+            {
                 bAuto = sal_False;
+            }
+
             aAny.setValue(&bAuto, ::getBooleanCppuType());
         }
         break;
         case WID_DOC_APPLY_FORM_DESIGN_MODE:
         {
-            SwDrawDocument * pDrawDoc;
-            sal_Bool bMode;
-            if ( 0 != ( pDrawDoc = dynamic_cast< SwDrawDocument * > (pDocShell->GetDoc()->GetDrawModel() ) ) )
-                bMode = pDrawDoc->GetOpenInDesignMode();
+            SwDrawModel* pDrawModel = 0;
+            sal_Bool bMode(sal_False);
+
+            if ( 0 != ( pDrawModel = pDocShell->GetDoc()->GetDrawModel() ) )
+            {
+                bMode = pDrawModel->GetOpenInDesignMode();
+            }
             else
+            {
                 bMode = sal_True;
+            }
+
             aAny.setValue(&bMode, ::getBooleanCppuType());
         }
         break;
diff --git a/sw/source/ui/utlui/content.cxx b/sw/source/ui/utlui/content.cxx
index 9b94012..d95b645 100644
--- a/sw/source/ui/utlui/content.cxx
+++ b/sw/source/ui/utlui/content.cxx
@@ -19,8 +19,6 @@
  *
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_sw.hxx"
 
@@ -85,21 +83,15 @@
 #include <numrule.hxx>
 #include <swundo.hxx>
 #include <ndtxt.hxx>
-//#include <ndgrf.hxx>
 #include <fmtcntnt.hxx>
 #include <PostItMgr.hxx>
-//#include <../../core/inc/flyfrm.hxx>
-//#include <../../core/inc/cntfrm.hxx>
-//#include <ndnotxt.hxx>
-//#include <postit.hxx>
 #include <postithelper.hxx>
 #include <redline.hxx>
 #include <docary.hxx>
-
 #include "swabstdlg.hxx"
 #include "globals.hrc"
 #include <unomid.h>
-
+#include <drawdoc.hxx>
 
 #define CTYPE_CNT   0
 #define CTYPE_CTT   1
@@ -445,7 +437,7 @@ void SwContentType::Init(sal_Bool* pbInvalidateWindow)
         {
             sTypeToken = aEmptyStr;
             nMemberCount = 0;
-            SdrModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel();
+            SwDrawModel* pModel = pWrtShell->getIDocumentDrawModelAccess()->GetDrawModel();
             if(pModel)
             {
                 SdrPage* pPage = pModel->GetPage(0);
@@ -813,7 +805,7 @@ void    SwContentType::FillMemberList(sal_Bool* pbLevelOrVisibiblityChanged)
                 pMember->DeleteAndDestroy(0, pMember->Count());
 
             IDocumentDrawModelAccess* pIDDMA = pWrtShell->getIDocumentDrawModelAccess();
-            SdrModel* pModel = pIDDMA->GetDrawModel();
+            SwDrawModel* pModel = pIDDMA->GetDrawModel();
             if(pModel)
             {
                 SdrPage* pPage = pModel->GetPage(0);
@@ -953,7 +945,7 @@ String SwContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const
                 SdrView* pDrawView = pActiveShell->GetDrawView();
                 if (pDrawView)
                 {
-                    SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                    SwDrawModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
                     SdrPage* pPage = pDrawModel->GetPage(0);
                     const sal_uInt32 nCount = pPage->GetObjCount();
                     for( sal_uInt32 i=0; i< nCount; i++ )
@@ -1046,7 +1038,7 @@ String SwContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
                 SdrView* pDrawView = pActiveShell->GetDrawView();
                 if (pDrawView)
                 {
-                    SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                    SwDrawModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
                     SdrPage* pPage = pDrawModel->GetPage(0);
                     sal_uInt32 nCount = pPage->GetObjCount();
                     for( sal_uInt32 i=0; i< nCount; i++ )
@@ -1432,7 +1424,7 @@ SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
             SdrView* pDrawView = pActiveShell->GetDrawView();
             if (pDrawView)
             {
-                SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                SwDrawModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
                 SdrPage* pPage = pDrawModel->GetPage(0);
                 sal_uInt32 nCount = pPage->GetObjCount();
 
@@ -2713,7 +2705,7 @@ void  SwContentTree::KeyInput(const KeyEvent& rEvent)
                         {
                             pDrawView->SdrEndTextEdit();//Change from "EndTextEdit" to "SdrEndTextEdit" for acc migration
 
-                            SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                            SwDrawModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
                             SdrPage* pPage = pDrawModel->GetPage(0);
                             sal_uInt32 nCount = pPage->GetObjCount();
                             sal_Bool hasObjectMarked = sal_False;
@@ -3428,7 +3420,7 @@ void SwContentTree::GotoContent(SwContent* pCnt)
             {
                 pDrawView->SdrEndTextEdit();
                 pDrawView->UnmarkAll();
-                SdrModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel();
+                SwDrawModel* _pModel = pActiveShell->getIDocumentDrawModelAccess()->GetDrawModel();
                 SdrPage* pPage = _pModel->GetPage(0);
                 sal_uInt32 nCount = pPage->GetObjCount();
                 for( sal_uInt32 i=0; i< nCount; i++ )


More information about the Libreoffice-commits mailing list