[Libreoffice-commits] core.git: Branch 'feature/refactor-god-objects' - 1335 commits - 2 accessibility/inc accessibility/source animations/source autogen.sh avmedia/source basctl/inc basctl/source basebmp/test basegfx/source basic/source binaryurp/source bin/fixincludeguards.sh bin/lo-all-static-libs bin/update_pch.sh bridges/inc bridges/source canvas/source chart2/inc chart2/opengl chart2/Package_opengl.mk chart2/qa chart2/source chart2/uiconfig cli_ure/source codemaker/source comphelper/source compilerplugins/clang compilerplugins/Makefile-clang.mk config_host.mk.in configmgr/inc configmgr/Library_configmgr.mk configmgr/qa configmgr/source configure.ac connectivity/qa connectivity/source cppcanvas/qa cppcanvas/source cppuhelper/source cppuhelper/test cppu/source cpputools/source crashrep/source cui/source cui/uiconfig cui/UIConfig_cui.mk dbaccess/inc dbaccess/source desktop/Library_deploymentgui.mk desktop/Library_sofficeapp.mk desktop/source desktop/uiconfig desktop/UIConfig_deployment.mk desk top/unx download.lst drawinglayer/source dtrans/source editeng/source embeddedobj/source embedserv/source eventattacher/source extensions/inc extensions/source extensions/test external/apache-commons external/clucene external/coinmp external/collada2gltf external/cppunit external/freetype external/glew external/hyphen external/icu external/lcms2 external/libabw external/libcdr external/libebook external/libetonyek external/libfreehand external/libgltf external/liblangtag external/libmspub external/libmwaw external/libodfgen external/librevenge external/libvisio external/libwpd external/libwpg external/libwps external/Module_external.mk external/mythes external/opencollada external/openssl external/python3 extras/AllLangPackage_autotextshare.mk extras/source filter/Configuration_filter.mk filter/qa filter/source forms/source formula/source fpicker/source framework/inc framework/source helpcompiler/source helpcontent2 hwpfilter/source i18nlangtag/qa i18nlangtag/source i18npool/inc i18 npool/Library_localedata_euro.mk i18npool/source i18nutil/source icon-themes/galaxy idlc/inc idlc/source idl/inc idl/source include/avmedia include/basegfx include/basic include/canvas include/codemaker include/com include/comphelper include/drawinglayer include/editeng include/filter include/formula include/framework include/i18nlangtag include/oox include/osl include/sal include/sax include/sfx2 include/svl include/svtools include/svx include/test include/toolkit include/tools include/unoidl include/unotest include/unotools include/vbahelper include/vcl include/writerperfect include/xmloff instsetoo_native/CustomTarget_install.mk ios/CustomTarget_TiledLibreOffice_app.mk ios/experimental io/source io/test javaunohelper/source jvmaccess/source jvmfwk/plugins l10ntools/inc l10ntools/source leak-suppress.txt lingucomponent/source linguistic/source lotuswordpro/inc lotuswordpro/Library_lwpft.mk lotuswordpro/source Makefile.fetch mysqlc/source o3tl/qa odk/examples offapi/com officecfg/r egistry oovbaapi/ooo oox/inc oox/source package/source postprocess/CustomTarget_registry.mk postprocess/Rdb_services.mk pyuno/inc pyuno/source readlicense_oo/license registry/source registry/test remotebridges/source reportbuilder/java reportdesign/inc reportdesign/source RepositoryExternal.mk Repository.mk rsc/inc rsc/source sal/cppunittester sal/inc sal/osl sal/qa sal/rtl sal/textenc sal/util sal/workben sax/inc sax/source sax/test scaddins/source sc/inc scp2/inc scp2/InstallModule_extensions.mk scp2/source sc/qa scripting/source scripting/workben sc/sdi sc/source sc/uiconfig sd/AllLangResTarget_sd.mk sdext/Library_pdfimport.mk sdext/source sd/inc sd/qa sd/sdi sd/source sd/uiconfig sd/UIConfig_simpress.mk setup_native/Library_getuid.mk sfx2/inc sfx2/source sfx2/uiconfig shell/qa shell/source slideshow/inc slideshow/Library_OGLTrans.mk slideshow/source solenv/bin solenv/gbuild solenv/gcc-wrappers soltools/cpp soltools/mkdepend sot/qa sot/source starmath/inc starmath/qa starmath/sou rce starmath/uiconfig stoc/inc stoc/source stoc/test svgio/source svl/source svtools/inc svtools/source svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk svx/workben sw/AllLangResTarget_sw.mk sw/CppunitTest_sw_htmlexport.mk sw/CppunitTest_sw_macros_test.mk sw/CppunitTest_sw_odfimport.mk sw/CppunitTest_sw_uiwriter.mk sw/Executable_tiledrendering.mk swext/Extension_wiki-publisher.mk sw/inc sw/Library_msword.mk sw/Library_sw.mk sw/Library_swui.mk sw/Library_vbaswobj.mk sw/qa sw/README sw/source sw/uiconfig sysui/CustomTarget_deb.mk test/source testtools/source toolkit/source tools/CustomTarget_reversemap.mk tools/inc tools/Library_tl.mk tools/qa tools/source translations ucbhelper/source ucb/source ucb/workben UnoControls/source unoidl/README unoidl/source unotest/Library_unotest.mk unotest/source unotools/inc unotools/source unoxml/inc unoxml/Library_unoxml.mk unoxml/source unusedcode.easy ure/source uui/source vbahelper/source vcl/android vcl/generic vcl/inc vcl/ios vcl/Library_vcl .mk vcl/osx vcl/qa vcl/quartz vcl/source vcl/unx vcl/win vcl/workben winaccessibility/source wizards/source writerfilter/CustomTarget_source.mk writerfilter/documentation writerfilter/inc writerfilter/source writerperfect/CppunitTest_writerperfect_calc.mk writerperfect/CppunitTest_writerperfect_stream.mk writerperfect/Library_wpftcalc.mk writerperfect/Library_wpftdraw.mk writerperfect/Library_wpftimpress.mk writerperfect/Library_wpftwriter.mk writerperfect/Library_writerperfect.mk writerperfect/Module_writerperfect.mk writerperfect/qa writerperfect/source xmlhelp/source xmloff/inc xmloff/Library_xof.mk xmloff/source xmlreader/source xmlscript/source xmlscript/test xmlsecurity/inc xmlsecurity/qa xmlsecurity/source

Valentin Kettner vakevk+libreoffice at gmail.com
Tue Jun 3 09:55:12 PDT 2014


Rebased ref, commits from common ancestor:
commit 9ef61462bbe6255f7b3d36bab8d32e702ee1de79
Author: Valentin Kettner <vakevk+libreoffice at gmail.com>
Date:   Tue Jun 3 18:51:55 2014 +0200

    Finished rebasing to master.
    
    I forgot some lines while rebasing and had to fix this here.
    
    Change-Id: I6a29497aa779d2b104db685161d89ae7c27805b3

diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 8f83f79..6bcbd45 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -1677,13 +1677,8 @@ void SwXFrame::setPropertyValue(const :: OUString& rPropertyName, const :: uno::
             if( nZOrder >= 0)
             {
                 SdrObject* pObject =
-<<<<<<< HEAD
                     GetOrCreateSdrObject( (SwFlyFrmFmt&)*pFmt );
-                SdrModel *pDrawModel = pDoc->GetDrawModel();
-=======
-                    GetOrCreateSdrObject( (SwFlyFrmFmt*)pFmt );
                 SdrModel *pDrawModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
                 pDrawModel->GetPage(0)->
                             SetObjectOrdNum(pObject->GetOrdNum(), nZOrder);
             }
@@ -3030,13 +3025,8 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
                     pDoc->SetFlyName((SwFlyFrmFmt&)*pFrmFmt, m_sName);
             }
         }
-<<<<<<< HEAD
-        if( pFmt && pDoc->GetDrawModel() )
-            GetOrCreateSdrObject(*pFmt);
-=======
         if( pFmt && pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
-            GetOrCreateSdrObject( pFmt );
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
+            GetOrCreateSdrObject(*pFmt);
         const ::uno::Any* pOrder;
         if( pProps->GetProperty(FN_UNO_Z_ORDER, 0, pOrder) )
             setPropertyValue(UNO_NAME_Z_ORDER, *pOrder);
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index faed2f2..c88007c 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -596,13 +596,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertOOoLink(
 
             SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE );
             xPropSet = pXFrame;
-<<<<<<< HEAD
-            if( pDoc->GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(*
-=======
             if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
+                SwXFrame::GetOrCreateSdrObject(*
                         static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order
         }
     }
@@ -658,13 +653,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertApplet(
                                        NULL);
     SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE );
     xPropSet = pXFrame;
-<<<<<<< HEAD
-    if( pDoc->GetDrawModel() )
-        SwXFrame::GetOrCreateSdrObject(*
-=======
     if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
-        SwXFrame::GetOrCreateSdrObject(
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
+        SwXFrame::GetOrCreateSdrObject(*
                 static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order
 
     return xPropSet;
@@ -736,13 +726,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertPlugin(
                                             NULL);
             SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE );
             xPropSet = pXFrame;
-<<<<<<< HEAD
-            if( pDoc->GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(*
-=======
             if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
+                SwXFrame::GetOrCreateSdrObject(*
                         static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order
         }
     }
@@ -892,13 +877,8 @@ uno::Reference< XPropertySet > SwXMLTextImportHelper::createAndInsertFloatingFra
                                             NULL);
             SwXFrame *pXFrame = SwXFrames::GetObject( *pFrmFmt, FLYCNTTYPE_OLE );
             xPropSet = pXFrame;
-<<<<<<< HEAD
-            if( pDoc->GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(*
-=======
             if( pDoc->getIDocumentDrawModelAccess().GetDrawModel() )
-                SwXFrame::GetOrCreateSdrObject(
->>>>>>> Split out IDocumentDrawModelAccess from SwDoc.
+                SwXFrame::GetOrCreateSdrObject(*
                         static_cast<SwFlyFrmFmt*>( pXFrame->GetFrmFmt() ) ); // req for z-order
         }
     }
diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx
index ed9bba1..b515077 100644
--- a/sw/source/uibase/uno/SwXDocumentSettings.cxx
+++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx
@@ -801,7 +801,7 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf
         case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
         {
             bool bTmp = *(sal_Bool*)rValue.getValue();
-            mpDoc->set(IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp);
+            mpDoc->getIDocumentSettingAccess().set(IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING, bTmp);
         }
         break;
         default:
@@ -1229,7 +1229,7 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf
         break;
         case HANDLE_APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING:
         {
-            sal_Bool bTmp = mpDoc->get( IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING );
+            sal_Bool bTmp = mpDoc->getIDocumentSettingAccess().get( IDocumentSettingAccess::APPLY_PARAGRAPH_MARK_FORMAT_TO_NUMBERING );
             rValue.setValue( &bTmp, ::getBooleanCppuType() );
         }
         break;
commit 3cd042dea68bd251205c56f50820d57b56e6a81a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Mon Jun 2 16:31:40 2014 +0200

    sw: fix some assertions that still use removed SwDoc methods
    
    Change-Id: Ia33dff51cdb58030ec11ec499ee5c518fba31641

diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 392654f..aabfd96 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -297,7 +297,7 @@ void DocumentDeviceManager::PrtDataChanged()
 // If you change this, also modify InJobSetup in Sw3io if appropriate.
 
     // #i41075#
-    OSL_ENSURE( m_rSwdoc.get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ||
+    OSL_ENSURE( m_rSwdoc.getIDocumentSettingAccess().get(IDocumentSettingAccess::USE_VIRTUAL_DEVICE) ||
             0 != getPrinter( false ), "PrtDataChanged will be called recursively!" );
     SwRootFrm* pTmpRoot = m_rSwdoc.GetCurrentLayout();
     boost::scoped_ptr<SwWait> pWait;
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index c454ac9..5401023 100644
--- a/sw/source/core/undo/unattr.cxx
+++ b/sw/source/core/undo/unattr.cxx
@@ -552,7 +552,8 @@ bool SwUndoFmtAttr::RestoreFlyAnchor(::sw::UndoRedoContext & rContext)
 
         if( pCont->GetAnchorFrm() && !pObj->IsInserted() )
         {
-            OSL_ENSURE( pDoc->GetDrawModel(), "RestoreFlyAnchor without DrawModel" );
+            OSL_ENSURE( pDoc->getIDocumentDrawModelAccess().GetDrawModel(),
+                    "RestoreFlyAnchor without DrawModel" );
             pDoc->getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )->InsertObject( pObj );
         }
         pObj->SetRelativePos( aDrawSavePt );
diff --git a/sw/source/filter/html/htmldrawwriter.cxx b/sw/source/filter/html/htmldrawwriter.cxx
index 49baf60..27d0775 100644
--- a/sw/source/filter/html/htmldrawwriter.cxx
+++ b/sw/source/filter/html/htmldrawwriter.cxx
@@ -40,6 +40,7 @@
 
 #include <rtl/strbuf.hxx>
 
+#include <IDocumentDrawModelAccess.hxx>
 #include "charatr.hxx"
 #include <frmfmt.hxx>
 #include <fmtanchr.hxx>
@@ -134,7 +135,8 @@ Writer& OutHTML_DrawFrmFmtAsMarquee( Writer& rWrt,
 {
     SwHTMLWriter & rHTMLWrt = (SwHTMLWriter&)rWrt;
 
-    OSL_ENSURE( rWrt.pDoc->GetDrawModel(), "Da gibt's ein Draw-Obj ohne ein Draw-Model zu haben?" );
+    OSL_ENSURE( rWrt.pDoc->getIDocumentDrawModelAccess().GetDrawModel(),
+            "There is a Draw-Obj with no Draw-Model?" );
     const SdrTextObj *pTextObj = (const SdrTextObj *)&rSdrObject;
 
     // Gibt es ueberhaupt auszugebenden Text
commit 28ca2efafb51acc6d27fefb9ff6845226bef3a0a
Author: Valentin Kettner <vakevk+libreoffice at gmail.com>
Date:   Sun Jun 1 22:39:37 2014 +0200

    Moved SwDoc's get<Interface> methods from docnew to doc.cxx
    
    To have them all in the same place.
    
    Change-Id: I8fd0f7fa0c88b5b17596998810d505deb14a8c06

diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index e4ea756..01e9478 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -150,6 +150,32 @@ sal_Int32 SwDoc::getReferenceCount() const
     return mReferenceCount;
 }
 
+::sw::MetaFieldManager & SwDoc::GetMetaFieldManager()
+{
+    return *m_pMetaFieldManager;
+}
+
+::sw::UndoManager & SwDoc::GetUndoManager()
+{
+    return *m_pUndoManager;
+}
+
+::sw::UndoManager const & SwDoc::GetUndoManager() const
+{
+    return *m_pUndoManager;
+}
+
+
+IDocumentUndoRedo & SwDoc::GetIDocumentUndoRedo()
+{
+    return *m_pUndoManager;
+}
+
+IDocumentUndoRedo const & SwDoc::GetIDocumentUndoRedo() const
+{
+    return *m_pUndoManager;
+}
+
 /* IDocumentDrawModelAccess */
 IDocumentDrawModelAccess const & SwDoc::getIDocumentDrawModelAccess() const
 {
@@ -182,6 +208,16 @@ IDocumentSettingAccess & SwDoc::getIDocumentSettingAccess()
     return GetDocumentSettingManager();
 }
 
+::sw::DocumentSettingManager & SwDoc::GetDocumentSettingManager()
+{
+    return *m_pDocumentSettingManager;
+}
+
+::sw::DocumentSettingManager const & SwDoc::GetDocumentSettingManager() const
+{
+    return *m_pDocumentSettingManager;
+}
+
 sal_uInt32 SwDoc::getRsid() const
 {
     return mnRsid;
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index 61441b4..8699fca 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -912,48 +912,6 @@ SwDoc::GetXmlIdRegistry()
     return *m_pXmlIdRegistry;
 }
 
-::sw::MetaFieldManager &
-SwDoc::GetMetaFieldManager()
-{
-    return *m_pMetaFieldManager;
-}
-
-::sw::UndoManager &
-SwDoc::GetUndoManager()
-{
-    return *m_pUndoManager;
-}
-
-::sw::UndoManager const&
-SwDoc::GetUndoManager() const
-{
-    return *m_pUndoManager;
-}
-
-::sw::DocumentSettingManager &
-SwDoc::GetDocumentSettingManager()
-{
-    return *m_pDocumentSettingManager;
-}
-
-::sw::DocumentSettingManager const&
-SwDoc::GetDocumentSettingManager() const
-{
-    return *m_pDocumentSettingManager;
-}
-
-IDocumentUndoRedo &
-SwDoc::GetIDocumentUndoRedo()
-{
-    return *m_pUndoManager;
-}
-
-IDocumentUndoRedo const&
-SwDoc::GetIDocumentUndoRedo() const
-{
-    return *m_pUndoManager;
-}
-
 void SwDoc::InitTOXTypes()
 {
    ShellResource* pShellRes = SwViewShell::GetShellRes();
commit af247add3f000667086e0f2f47a7b51ac12f2c07
Author: Valentin Kettner <vakevk+libreoffice at gmail.com>
Date:   Sun Jun 1 22:21:38 2014 +0200

    Split out IDocumentDrawModelAccess from SwDoc.
    
    To the new class DocumentDrawModelManager.
    All moved methods and members have the same in thew new class.
    
    Change-Id: I89ad0e0c4a42885d5810e834983ea8e8e6c0a2d2

diff --git a/2 b/2
new file mode 100644
index 0000000..a3670fa
--- /dev/null
+++ b/2
@@ -0,0 +1,592 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include "hintids.hxx"
+#include <vcl/svapp.hxx>
+#include <vcl/wrkwin.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdotext.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/outliner.hxx>
+#include <svx/xfillit.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/brushitem.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/ulspitem.hxx>
+#include <svl/itemiter.hxx>
+#include <svl/whiter.hxx>
+#include <svtools/htmlout.hxx>
+#include <svtools/htmltokn.h>
+#include <svtools/htmlkywd.hxx>
+#include <svx/svdpool.hxx>
+
+#include "charatr.hxx"
+#include <frmfmt.hxx>
+#include <fmtanchr.hxx>
+#include <fmtsrnd.hxx>
+#include "ndtxt.hxx"
+#include "doc.hxx"
+#include <IDocumentDrawModelAccess.hxx>
+#include "dcontact.hxx"
+#include "poolfmt.hxx"
+#include "swcss1.hxx"
+#include "swhtml.hxx"
+#include <shellio.hxx>
+#include <rtl/strbuf.hxx>
+
+using namespace css;
+
+static HTMLOptionEnum aHTMLMarqBehaviorTable[] =
+{
+    { OOO_STRING_SVTOOLS_HTML_BEHAV_scroll,     SDRTEXTANI_SCROLL       },
+    { OOO_STRING_SVTOOLS_HTML_BEHAV_alternate,  SDRTEXTANI_ALTERNATE    },
+    { OOO_STRING_SVTOOLS_HTML_BEHAV_slide,      SDRTEXTANI_SLIDE        },
+    { 0,                                        0                       }
+};
+
+static HTMLOptionEnum aHTMLMarqDirectionTable[] =
+{
+    { OOO_STRING_SVTOOLS_HTML_AL_left,          SDRTEXTANI_LEFT         },
+    { OOO_STRING_SVTOOLS_HTML_AL_right,         SDRTEXTANI_RIGHT        },
+    { 0,                                        0                       }
+};
+
+void SwHTMLParser::InsertDrawObject( SdrObject* pNewDrawObj,
+                                     const Size& rPixSpace,
+                                     sal_Int16 eVertOri,
+                                     sal_Int16 eHoriOri,
+                                     SfxItemSet& rCSS1ItemSet,
+                                     SvxCSS1PropertyInfo& rCSS1PropInfo,
+                                     bool bHidden )
+{
+    // always on top of text.
+    // but in invisible layer. <ConnectToLayout> will move the object
+    // to the visible layer.
+    pNewDrawObj->SetLayer( pDoc->getIDocumentDrawModelAccess().GetInvisibleHeavenId() );
+
+    SfxItemSet aFrmSet( pDoc->GetAttrPool(),
+                        RES_FRMATR_BEGIN, RES_FRMATR_END-1 );
+    if( !IsNewDoc() )
+        Reader::ResetFrmFmtAttrs( aFrmSet );
+
+    sal_uInt16 nLeftSpace = 0, nRightSpace = 0, nUpperSpace = 0, nLowerSpace = 0;
+    if( (rPixSpace.Width() || rPixSpace.Height()) && Application::GetDefaultDevice() )
+    {
+        Size aTwipSpc( rPixSpace.Width(), rPixSpace.Height() );
+        aTwipSpc =
+            Application::GetDefaultDevice()->PixelToLogic( aTwipSpc,
+                                                MapMode(MAP_TWIP) );
+        nLeftSpace = nRightSpace = (sal_uInt16)aTwipSpc.Width();
+        nUpperSpace = nLowerSpace = (sal_uInt16)aTwipSpc.Height();
+    }
+
+    // linken/rechten Rand setzen
+    const SfxPoolItem *pItem;
+    if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_LR_SPACE, true, &pItem ) )
+    {
+        // Ggf. den Erstzeilen-Einzug noch plaetten
+        const SvxLRSpaceItem *pLRItem = (const SvxLRSpaceItem *)pItem;
+        SvxLRSpaceItem aLRItem( *pLRItem );
+        aLRItem.SetTxtFirstLineOfst( 0 );
+        if( rCSS1PropInfo.bLeftMargin )
+        {
+            nLeftSpace = static_cast< sal_uInt16 >(aLRItem.GetLeft());
+            rCSS1PropInfo.bLeftMargin = false;
+        }
+        if( rCSS1PropInfo.bRightMargin )
+        {
+            nRightSpace = static_cast< sal_uInt16 >(aLRItem.GetRight());
+            rCSS1PropInfo.bRightMargin = false;
+        }
+        rCSS1ItemSet.ClearItem( RES_LR_SPACE );
+    }
+    if( nLeftSpace || nRightSpace )
+    {
+        SvxLRSpaceItem aLRItem( RES_LR_SPACE );
+        aLRItem.SetLeft( nLeftSpace );
+        aLRItem.SetRight( nRightSpace );
+        aFrmSet.Put( aLRItem );
+    }
+
+    // oberen/unteren Rand setzen
+    if( SFX_ITEM_SET==rCSS1ItemSet.GetItemState( RES_UL_SPACE, true, &pItem ) )
+    {
+        // Ggf. den Erstzeilen-Einzug noch plaetten
+        const SvxULSpaceItem *pULItem = (const SvxULSpaceItem *)pItem;
+        if( rCSS1PropInfo.bTopMargin )
+        {
+            nUpperSpace = pULItem->GetUpper();
+            rCSS1PropInfo.bTopMargin = false;
+        }
+        if( rCSS1PropInfo.bBottomMargin )
+        {
+            nLowerSpace = pULItem->GetLower();
+            rCSS1PropInfo.bBottomMargin = false;
+        }
+
+        rCSS1ItemSet.ClearItem( RES_UL_SPACE );
+    }
+    if( nUpperSpace || nLowerSpace )
+    {
+        SvxULSpaceItem aULItem( RES_UL_SPACE );
+        aULItem.SetUpper( nUpperSpace );
+        aULItem.SetLower( nLowerSpace );
+        aFrmSet.Put( aULItem );
+    }
+
+    SwFmtAnchor aAnchor( FLY_AS_CHAR );
+    if( SVX_CSS1_POS_ABSOLUTE == rCSS1PropInfo.ePosition &&
+        SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.eLeftType &&
+        SVX_CSS1_LTYPE_TWIP == rCSS1PropInfo.eTopType )
+    {
+        const SwStartNode *pFlySttNd =
+            pPam->GetPoint()->nNode.GetNode().FindFlyStartNode();
+
+        if( pFlySttNd )
+        {
+            aAnchor.SetType( FLY_AT_FLY );
+            SwPosition aPos( *pFlySttNd );
+            aAnchor.SetAnchor( &aPos );
+        }
+        else
+        {
+            aAnchor.SetType( FLY_AT_PAGE );
+        }
+        // #i26791# - direct positioning for <SwDoc::Insert(..)>
+        pNewDrawObj->SetRelativePos( Point(rCSS1PropInfo.nLeft + nLeftSpace,
+                                           rCSS1PropInfo.nTop + nUpperSpace) );
+        aFrmSet.Put( SwFmtSurround(SURROUND_THROUGHT) );
+    }
+    else if( SVX_ADJUST_LEFT == rCSS1PropInfo.eFloat ||
+             text::HoriOrientation::LEFT == eHoriOri )
+    {
+        aAnchor.SetType( FLY_AT_PARA );
+        aFrmSet.Put( SwFmtSurround(bHidden ? SURROUND_THROUGHT
+                                             : SURROUND_RIGHT) );
+        // #i26791# - direct positioning for <SwDoc::Insert(..)>
+        pNewDrawObj->SetRelativePos( Point(nLeftSpace, nUpperSpace) );
+    }
+    else if( text::VertOrientation::NONE != eVertOri )
+    {
+        aFrmSet.Put( SwFmtVertOrient( 0, eVertOri ) );
+    }
+
+    if (FLY_AT_PAGE == aAnchor.GetAnchorId())
+    {
+        aAnchor.SetPageNum( 1 );
+    }
+    else if( FLY_AT_FLY != aAnchor.GetAnchorId() )
+    {
+        aAnchor.SetAnchor( pPam->GetPoint() );
+    }
+    aFrmSet.Put( aAnchor );
+
+    pDoc->InsertDrawObj( *pPam, *pNewDrawObj, aFrmSet );
+}
+
+static void PutEEPoolItem( SfxItemSet &rEEItemSet,
+                           const SfxPoolItem& rSwItem )
+{
+
+    sal_uInt16 nEEWhich = 0;
+
+    switch( rSwItem.Which() )
+    {
+    case RES_CHRATR_COLOR:          nEEWhich = EE_CHAR_COLOR; break;
+    case RES_CHRATR_CROSSEDOUT:     nEEWhich = EE_CHAR_STRIKEOUT; break;
+    case RES_CHRATR_ESCAPEMENT:     nEEWhich = EE_CHAR_ESCAPEMENT; break;
+    case RES_CHRATR_FONT:           nEEWhich = EE_CHAR_FONTINFO; break;
+    case RES_CHRATR_CJK_FONT:       nEEWhich = EE_CHAR_FONTINFO_CJK; break;
+    case RES_CHRATR_CTL_FONT:       nEEWhich = EE_CHAR_FONTINFO_CTL; break;
+    case RES_CHRATR_FONTSIZE:       nEEWhich = EE_CHAR_FONTHEIGHT; break;
+    case RES_CHRATR_CJK_FONTSIZE:   nEEWhich = EE_CHAR_FONTHEIGHT_CJK; break;
+    case RES_CHRATR_CTL_FONTSIZE:   nEEWhich = EE_CHAR_FONTHEIGHT_CTL; break;
+    case RES_CHRATR_KERNING:        nEEWhich = EE_CHAR_KERNING; break;
+    case RES_CHRATR_POSTURE:        nEEWhich = EE_CHAR_ITALIC; break;
+    case RES_CHRATR_CJK_POSTURE:    nEEWhich = EE_CHAR_ITALIC_CJK; break;
+    case RES_CHRATR_CTL_POSTURE:    nEEWhich = EE_CHAR_ITALIC_CTL; break;
+    case RES_CHRATR_UNDERLINE:      nEEWhich = EE_CHAR_UNDERLINE; break;
+    case RES_CHRATR_WEIGHT:         nEEWhich = EE_CHAR_WEIGHT; break;
+    case RES_CHRATR_CJK_WEIGHT:     nEEWhich = EE_CHAR_WEIGHT_CJK; break;
+    case RES_CHRATR_CTL_WEIGHT:     nEEWhich = EE_CHAR_WEIGHT_CTL; break;
+    case RES_BACKGROUND:
+    case RES_CHRATR_BACKGROUND:
+        {
+            const SvxBrushItem& rBrushItem = (const SvxBrushItem&)rSwItem;
+            rEEItemSet.Put( XFillStyleItem(XFILL_SOLID) );
+            rEEItemSet.Put( XFillColorItem(aEmptyOUStr,
+                            rBrushItem.GetColor()) );
+        }
+        break;
+    }
+
+    if( nEEWhich )
+    {
+        SfxPoolItem *pEEItem = rSwItem.Clone();
+        pEEItem->SetWhich( nEEWhich );
+        rEEItemSet.Put( *pEEItem );
+        delete pEEItem;
+    }
+}
+
+void SwHTMLParser::NewMarquee( HTMLTable *pCurTable )
+{
+
+    OSL_ENSURE( !pMarquee, "Marquee in Marquee???" );
+    aContents = "";
+
+    OUString aId, aStyle, aClass;
+
+    long nWidth=0, nHeight=0;
+    bool bPrcWidth = false, bDirection = false, bBGColor = false;
+    Size aSpace( 0, 0 );
+    sal_Int16 eVertOri = text::VertOrientation::TOP;
+    sal_Int16 eHoriOri = text::HoriOrientation::NONE;
+    SdrTextAniKind eAniKind = SDRTEXTANI_SCROLL;
+    SdrTextAniDirection eAniDir = SDRTEXTANI_LEFT;
+    sal_uInt16 nCount = 0, nDelay = 60;
+    sal_Int16 nAmount = -6;
+    Color aBGColor;
+
+    const HTMLOptions& rHTMLOptions = GetOptions();
+    for (size_t i = 0, n = rHTMLOptions.size(); i < n; ++i)
+    {
+        const HTMLOption& rOption = rHTMLOptions[i];
+        switch( rOption.GetToken() )
+        {
+            case HTML_O_ID:
+                aId = rOption.GetString();
+                break;
+            case HTML_O_STYLE:
+                aStyle = rOption.GetString();
+                break;
+            case HTML_O_CLASS:
+                aClass = rOption.GetString();
+                break;
+
+            case HTML_O_BEHAVIOR:
+                eAniKind =
+                    (SdrTextAniKind)rOption.GetEnum( aHTMLMarqBehaviorTable,
+                                                      static_cast< sal_uInt16 >(eAniKind) );
+                break;
+
+            case HTML_O_BGCOLOR:
+                rOption.GetColor( aBGColor );
+                bBGColor = true;
+                break;
+
+            case HTML_O_DIRECTION:
+                eAniDir =
+                    (SdrTextAniDirection)rOption.GetEnum( aHTMLMarqDirectionTable,
+                                                      static_cast< sal_uInt16 >(eAniDir) );
+                bDirection = true;
+                break;
+
+            case HTML_O_LOOP:
+                if (rOption.GetString().
+                    equalsIgnoreAsciiCase(OOO_STRING_SVTOOLS_HTML_LOOP_infinite))
+                {
+                    nCount = 0;
+                }
+                else
+                {
+                    sal_uInt32 nLoop = rOption.GetSNumber();
+                    nCount = (sal_uInt16)(nLoop>0 ? nLoop : 0 );
+                }
+                break;
+
+            case HTML_O_SCROLLAMOUNT:
+                nAmount = -((sal_Int16)rOption.GetNumber());
+                break;
+
+            case HTML_O_SCROLLDELAY:
+                nDelay = (sal_uInt16)rOption.GetNumber();
+                break;
+
+            case HTML_O_WIDTH:
+                // erstmal nur als Pixelwerte merken!
+                nWidth = rOption.GetNumber();
+                bPrcWidth = rOption.GetString().indexOf('%') != -1;
+                if( bPrcWidth && nWidth>100 )
+                    nWidth = 100;
+                break;
+
+            case HTML_O_HEIGHT:
+                // erstmal nur als Pixelwerte merken!
+                nHeight = rOption.GetNumber();
+                if( rOption.GetString().indexOf('%') != -1 )
+                    nHeight = 0;
+                break;
+
+            case HTML_O_HSPACE:
+                // erstmal nur als Pixelwerte merken!
+                aSpace.Height() = rOption.GetNumber();
+                break;
+
+            case HTML_O_VSPACE:
+                // erstmal nur als Pixelwerte merken!
+                aSpace.Width() = rOption.GetNumber();
+                break;
+
+            case HTML_O_ALIGN:
+                eVertOri =
+                    rOption.GetEnum( aHTMLImgVAlignTable,
+                                                    text::VertOrientation::TOP );
+                eHoriOri =
+                    rOption.GetEnum( aHTMLImgHAlignTable,
+                                                    text::HoriOrientation::NONE );
+                break;
+        }
+    }
+
+    // Ein DrawTxtobj anlegen
+    // #i52858# - method name changed
+    SdrModel* pModel = pDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
+
+    SdrPage* pPg = pModel->GetPage( 0 );
+    pMarquee = SdrObjFactory::MakeNewObject( SdrInventor,
+                                             OBJ_TEXT, pPg, pModel );
+    if( !pMarquee )
+        return;
+
+    pPg->InsertObject( pMarquee );
+
+    if( !aId.isEmpty() )
+        InsertBookmark( aId );
+
+    // (Nur) Alternate leueft per Default von links nach rechts
+    if( SDRTEXTANI_ALTERNATE==eAniKind && !bDirection )
+        eAniDir = SDRTEXTANI_RIGHT;
+
+    // die fuer das Scrollen benoetigten Attribute umsetzen
+    sal_uInt16 aWhichMap[7] =   { XATTR_FILL_FIRST,   XATTR_FILL_LAST,
+                              SDRATTR_MISC_FIRST, SDRATTR_MISC_LAST,
+                              EE_CHAR_START,      EE_CHAR_END,
+                              0 };
+    SfxItemSet aItemSet( pModel->GetItemPool(), aWhichMap );
+    aItemSet.Put( SdrTextAutoGrowWidthItem( false ) );
+    aItemSet.Put( SdrTextAutoGrowHeightItem( true ) );
+    aItemSet.Put( SdrTextAniKindItem( eAniKind ) );
+    aItemSet.Put( SdrTextAniDirectionItem( eAniDir ) );
+    aItemSet.Put( SdrTextAniCountItem( nCount ) );
+    aItemSet.Put( SdrTextAniDelayItem( nDelay ) );
+    aItemSet.Put( SdrTextAniAmountItem( nAmount ) );
+    if( SDRTEXTANI_ALTERNATE==eAniKind )
+    {
+        // (Nur) Alternate startet und stoppt per default Inside
+        aItemSet.Put( SdrTextAniStartInsideItem(true) );
+        aItemSet.Put( SdrTextAniStopInsideItem(true) );
+        if( SDRTEXTANI_LEFT==eAniDir )
+            aItemSet.Put( SdrTextHorzAdjustItem(SDRTEXTHORZADJUST_RIGHT) );
+    }
+
+    // die Default-Farbe (aus der Standard-Vorlage) setzen, damit ueberhaupt
+    // eine sinnvolle Farbe gesetzt ist.
+    const Color& rDfltColor =
+        pCSS1Parser->GetTxtCollFromPool( RES_POOLCOLL_STANDARD )
+            ->GetColor().GetValue();
+    aItemSet.Put( SvxColorItem( rDfltColor, EE_CHAR_COLOR ) );
+
+    // Die Attribute der aktuellen Absatzvorlage setzen
+    sal_uInt16 nWhichIds[] =
+    {
+        RES_CHRATR_COLOR,   RES_CHRATR_CROSSEDOUT, RES_CHRATR_ESCAPEMENT,
+        RES_CHRATR_FONT,    RES_CHRATR_FONTSIZE,   RES_CHRATR_KERNING,
+        RES_CHRATR_POSTURE, RES_CHRATR_UNDERLINE,  RES_CHRATR_WEIGHT,
+        RES_CHRATR_BACKGROUND,
+        RES_CHRATR_CJK_FONT, RES_CHRATR_CJK_FONTSIZE,
+        RES_CHRATR_CJK_POSTURE, RES_CHRATR_CJK_WEIGHT,
+        RES_CHRATR_CTL_FONT, RES_CHRATR_CTL_FONTSIZE,
+        RES_CHRATR_CTL_POSTURE, RES_CHRATR_CTL_WEIGHT,
+        0
+    };
+    SwTxtNode const*const pTxtNd =
+        pPam->GetPoint()->nNode.GetNode().GetTxtNode();
+    if( pTxtNd )
+    {
+        const SfxItemSet& rItemSet = pTxtNd->GetAnyFmtColl().GetAttrSet();
+        const SfxPoolItem *pItem;
+        for( sal_uInt16 i=0; nWhichIds[i]; i++ )
+        {
+            if( SFX_ITEM_SET == rItemSet.GetItemState( nWhichIds[i], true, &pItem ) )
+                PutEEPoolItem( aItemSet, *pItem );
+        }
+    }
+
+    // die Attribute der Umgebung am Draw-Objekt setzen
+    _HTMLAttr** pTbl = (_HTMLAttr**)&aAttrTab;
+    for( sal_uInt16 nCnt = sizeof( _HTMLAttrTable ) / sizeof( _HTMLAttr* );
+         nCnt--; ++pTbl )
+    {
+        _HTMLAttr *pAttr = *pTbl;
+        if( pAttr )
+            PutEEPoolItem( aItemSet, pAttr->GetItem() );
+    }
+
+    if( bBGColor )
+    {
+        aItemSet.Put( XFillStyleItem(XFILL_SOLID) );
+        aItemSet.Put( XFillColorItem(aEmptyOUStr, aBGColor) );
+    }
+
+    // Styles parsen (funktioniert hier nur fuer Attribute, die auch
+    // am Zeichen-Objekt gesetzt werden koennen)
+    SfxItemSet aStyleItemSet( pDoc->GetAttrPool(),
+                              pCSS1Parser->GetWhichMap() );
+    SvxCSS1PropertyInfo aPropInfo;
+    if( HasStyleOptions( aStyle, aId, aClass )  &&
+        ParseStyleOptions( aStyle, aId, aClass, aStyleItemSet, aPropInfo ) )
+    {
+        SfxItemIter aIter( aStyleItemSet );
+
+        const SfxPoolItem *pItem = aIter.FirstItem();
+        while( pItem )
+        {
+            PutEEPoolItem( aItemSet, *pItem );
+            pItem = aIter.NextItem();
+        }
+    }
+
+    // jetzt noch die Groesse setzen
+    Size aTwipSz( bPrcWidth ? 0 : nWidth, nHeight );
+    if( (aTwipSz.Width() || aTwipSz.Height()) && Application::GetDefaultDevice() )
+    {
+        aTwipSz = Application::GetDefaultDevice()
+                    ->PixelToLogic( aTwipSz, MapMode( MAP_TWIP ) );
+    }
+
+    if( SVX_CSS1_LTYPE_TWIP== aPropInfo.eWidthType )
+    {
+        aTwipSz.Width() = aPropInfo.nWidth;
+        nWidth = 1; // != 0;
+        bPrcWidth = false;
+    }
+    if( SVX_CSS1_LTYPE_TWIP== aPropInfo.eHeightType )
+        aTwipSz.Height() = aPropInfo.nHeight;
+
+    bFixMarqueeWidth = false;
+    if( !nWidth || bPrcWidth )
+    {
+        if( pTable )
+        {
+            if( !pCurTable )
+            {
+                // Die Laufschrift steht in einer Tabelle, aber nicht
+                // in einer Zelle. Da jetzt keine vernuenftige Zuordung
+                // zu einer Zelle moeglich ist, passen wir hir die
+                // Breite dem Inhalt der Laufschrift an.
+                bFixMarqueeWidth = true;
+            }
+            else if( !nWidth )
+            {
+                // Da wir wissen, in welcher Zelle die Laufschrift ist,
+                // koennen wir die Breite auch anpassen. Keine Breitenangabe
+                // wird wie 100% behandelt.
+                nWidth = 100;
+                bPrcWidth = true;
+            }
+            aTwipSz.Width() = MINLAY;
+        }
+        else
+        {
+            long nBrowseWidth = GetCurrentBrowseWidth();
+            aTwipSz.Width() = !nWidth ? nBrowseWidth
+                                      : (nWidth*nBrowseWidth) / 100;
+        }
+    }
+
+    // Die Hoehe ist nur eine Mindest-Hoehe
+    if( aTwipSz.Height() < MINFLY )
+        aTwipSz.Height() = MINFLY;
+    aItemSet.Put( SdrTextMinFrameHeightItem( aTwipSz.Height() ) );
+
+    pMarquee->SetMergedItemSetAndBroadcast(aItemSet);
+
+    if( aTwipSz.Width() < MINFLY )
+        aTwipSz.Width() = MINFLY;
+    pMarquee->SetLogicRect( Rectangle( 0, 0, aTwipSz.Width(), aTwipSz.Height() ) );
+
+    // und das Objekt in das Dok einfuegen
+    InsertDrawObject( pMarquee, aSpace, eVertOri, eHoriOri, aStyleItemSet,
+                      aPropInfo );
+
+    // Das Zeichen-Objekt der Tabelle bekanntmachen. Ist ein bisserl
+    // umstaendlich, weil noch ueber den Parser gegangen wird, obwohl die
+    // Tabelle bekannt ist, aber anderenfalls muesste man die Tabelle
+    // oeffentlich machen, und das ist auch nicht schoen. Das globale
+    // pTable kann uebrigens auch nicht verwendet werden, denn die
+    // Laufschrift kann sich auch mal in einer Sub-Tabelle befinden.
+    if( pCurTable && bPrcWidth)
+        RegisterDrawObjectToTable( pCurTable, pMarquee, (sal_uInt8)nWidth );
+}
+
+void SwHTMLParser::EndMarquee()
+{
+    OSL_ENSURE( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(),
+            "kein Marquee oder falscher Typ" );
+
+    if( bFixMarqueeWidth )
+    {
+        // Da es keine fixe Hoehe gibt, das Text-Objekt erstmal breiter
+        // als den Text machen, damit nicht umgebrochen wird.
+        const Rectangle& rOldRect = pMarquee->GetLogicRect();
+        pMarquee->SetLogicRect( Rectangle( rOldRect.TopLeft(),
+                                           Size( USHRT_MAX, 240 ) ) );
+    }
+
+    // den gesammelten Text einfuegen
+    ((SdrTextObj*)pMarquee)->SetText( aContents );
+    pMarquee->SetMergedItemSetAndBroadcast( pMarquee->GetMergedItemSet() );
+
+    if( bFixMarqueeWidth )
+    {
+        // die Groesse dem Text anpassen.
+        ((SdrTextObj*)pMarquee)->FitFrameToTextSize();
+    }
+
+    aContents = "";
+    pMarquee = 0;
+}
+
+void SwHTMLParser::InsertMarqueeText()
+{
+    OSL_ENSURE( pMarquee && OBJ_TEXT==pMarquee->GetObjIdentifier(),
+            "kein Marquee oder falscher Typ" );
+
+    // das akteulle Textstueck an den Text anhaengen
+    aContents += aToken;
+}
+
+void SwHTMLParser::ResizeDrawObject( SdrObject* pObj, SwTwips nWidth )
+{
+    OSL_ENSURE( OBJ_TEXT==pObj->GetObjIdentifier(),
+            "kein Marquee oder falscher Typ" );
+
+    if( OBJ_TEXT!=pObj->GetObjIdentifier() )
+        return;
+
+    // die alte Groesse
+    const Rectangle& rOldRect = pObj->GetLogicRect();
+    Size aNewSz( nWidth, rOldRect.GetSize().Height() );
+    pObj->SetLogicRect( Rectangle( rOldRect.TopLeft(), aNewSz ) );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index c9fe775..d9eecf0 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -186,6 +186,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/core/doc/DocumentDeviceManager \
     sw/source/core/doc/docxforms \
     sw/source/core/doc/DocumentSettingManager \
+    sw/source/core/doc/DocumentDrawModelManager \
     sw/source/core/doc/extinput \
     sw/source/core/doc/fmtcol \
     sw/source/core/doc/ftnidx \
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index 7cabfd8..f9f904d 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -30,7 +30,6 @@
 #include <IDocumentLineNumberAccess.hxx>
 #include <IDocumentStatistics.hxx>
 #include <IDocumentState.hxx>
-#include <IDocumentDrawModelAccess.hxx>
 #include <IDocumentLayoutAccess.hxx>
 #include <IDocumentTimerAccess.hxx>
 #include <IDocumentChartDataProviderAccess.hxx>
@@ -208,6 +207,7 @@ namespace sw {
     class IShellCursorSupplier;
     class DocumentSettingManager;
     class DocumentDeviceManager;
+    class DocumentDrawModelManager;
 }
 
 namespace com { namespace sun { namespace star {
@@ -253,7 +253,6 @@ class SW_DLLPUBLIC SwDoc :
     public IDocumentLineNumberAccess,
     public IDocumentStatistics,
     public IDocumentState,
-    public IDocumentDrawModelAccess,
     public IDocumentLayoutAccess,
     public IDocumentTimerAccess,
     public IDocumentChartDataProviderAccess,
@@ -287,6 +286,7 @@ class SW_DLLPUBLIC SwDoc :
 
     const ::boost::scoped_ptr< ::sw::mark::MarkManager> mpMarkManager;
     const ::boost::scoped_ptr< ::sw::MetaFieldManager > m_pMetaFieldManager;
+    const ::boost::scoped_ptr< ::sw::DocumentDrawModelManager > m_pDocumentDrawModelManager;
     const ::boost::scoped_ptr< ::sw::UndoManager > m_pUndoManager;
     const ::boost::scoped_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager;
     ::boost::scoped_ptr< ::sw::DocumentDeviceManager > m_pDeviceAccess;
@@ -311,7 +311,6 @@ class SW_DLLPUBLIC SwDoc :
     SwDefTOXBase_Impl * mpDefTOXBases;   //< defaults of SwTOXBase's
 
     SwViewShell       *mpCurrentView;  //< SwDoc should get a new member mpCurrentView
-    SdrModel        *mpDrawModel;        //< StarView Drawing
 
     SwDocUpdtFld    *mpUpdtFlds;         //< Struct for updating fields
     SwFldTypes      *mpFldTypes;
@@ -405,18 +404,6 @@ private:
     sal_Int32   mIdleBlockCount;
     sal_Int8    mnLockExpFld;        //< If != 0 UpdateExpFlds() has no effect!
 
-    /** Draw Model Layer IDs
-     * LayerIds, Heaven == above document
-     *           Hell   == below document
-     *         Controls == at the very top
-     */
-    SdrLayerID  mnHeaven;
-    SdrLayerID  mnHell;
-    SdrLayerID  mnControls;
-    SdrLayerID  mnInvisibleHeaven;
-    SdrLayerID  mnInvisibleHell;
-    SdrLayerID  mnInvisibleControls;
-
     bool mbGlossDoc              : 1;    //< TRUE: glossary document.
     bool mbModified              : 1;    //< TRUE: document has changed.
     bool mbDtor                  : 1;    /**< TRUE: is in SwDoc DTOR.
@@ -466,10 +453,6 @@ private:
     // private methods
     void checkRedlining(RedlineMode_t& _rReadlineMode);
 
-    DECL_LINK( AddDrawUndo, SdrUndoAction * );
-                                        // DrawModel
-    void DrawNotifyUndoHdl();
-
     /** Only for internal use and therefore private.
      Copy a range within the same or to another document.
      Position may not lie within range! */
@@ -521,9 +504,6 @@ private:
                                 const OUString& rFormula,
                                 std::vector<OUString>& rUsedDBNames );
 
-    void InitDrawModel();
-    void ReleaseDrawModel();
-
     void _CreateNumberFormatter();
 
     bool _UnProtectTblCells( SwTable& rTbl );
@@ -782,20 +762,12 @@ public:
     virtual void SetLoaded(bool b) SAL_OVERRIDE;
 
     // IDocumentDrawModelAccess
-    virtual const SdrModel* GetDrawModel() const SAL_OVERRIDE;
-    virtual SdrModel* GetDrawModel() SAL_OVERRIDE;
-    virtual SdrLayerID GetHeavenId() const SAL_OVERRIDE;
-    virtual SdrLayerID GetHellId() const SAL_OVERRIDE;
-    virtual SdrLayerID GetControlsId() const SAL_OVERRIDE;
-    virtual SdrLayerID GetInvisibleHeavenId() const SAL_OVERRIDE;
-    virtual SdrLayerID GetInvisibleHellId() const SAL_OVERRIDE;
-    virtual SdrLayerID GetInvisibleControlsId() const SAL_OVERRIDE;
-    virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) SAL_OVERRIDE;
-    virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const SAL_OVERRIDE;
-    virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) SAL_OVERRIDE;
-    virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) SAL_OVERRIDE;
-    virtual SdrModel* _MakeDrawModel() SAL_OVERRIDE;
-    virtual SdrModel* GetOrCreateDrawModel() SAL_OVERRIDE;
+    DECL_LINK( AddDrawUndo, SdrUndoAction * );
+    IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const;
+    IDocumentDrawModelAccess & getIDocumentDrawModelAccess();
+
+    ::sw::DocumentDrawModelManager const & GetDocumentDrawModelManager() const;
+    ::sw::DocumentDrawModelManager & GetDocumentDrawModelManager();
 
     // IDocumentLayoutAccess
     virtual void SetCurrentViewShell( SwViewShell* pNew ) SAL_OVERRIDE;
diff --git a/sw/source/core/access/accfrmobjmap.cxx b/sw/source/core/access/accfrmobjmap.cxx
index 6c49b85..e669699 100644
--- a/sw/source/core/access/accfrmobjmap.cxx
+++ b/sw/source/core/access/accfrmobjmap.cxx
@@ -24,6 +24,7 @@
 
 #include <viewsh.hxx>
 #include <doc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <frmfmt.hxx>
 #include <pagefrm.hxx>
 #include <txtfrm.hxx>
@@ -38,8 +39,8 @@ using namespace sw::access;
 SwAccessibleChildMap::SwAccessibleChildMap( const SwRect& rVisArea,
                                             const SwFrm& rFrm,
                                             SwAccessibleMap& rAccMap )
-    : nHellId( rAccMap.GetShell()->GetDoc()->GetHellId() )
-    , nControlsId( rAccMap.GetShell()->GetDoc()->GetControlsId() )
+    : nHellId( rAccMap.GetShell()->GetDoc()->getIDocumentDrawModelAccess().GetHellId() )
+    , nControlsId( rAccMap.GetShell()->GetDoc()->getIDocumentDrawModelAccess().GetControlsId() )
 {
     const bool bVisibleChildrenOnly = SwAccessibleChild( &rFrm ).IsVisibleChildrenOnly();
 
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index 377c125..599d62d 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -755,8 +755,8 @@ bool SwFmt::IsShadowTransparent() const
  * Document Interface Access
  */
 const IDocumentSettingAccess* SwFmt::getIDocumentSettingAccess() const { return & GetDoc()->GetDocumentSettingManager(); }
-const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return GetDoc(); }
-IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return GetDoc(); }
+const IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); }
+IDocumentDrawModelAccess* SwFmt::getIDocumentDrawModelAccess() { return & GetDoc()->getIDocumentDrawModelAccess(); }
 const IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() const { return GetDoc(); }
 IDocumentLayoutAccess* SwFmt::getIDocumentLayoutAccess() { return GetDoc(); }
 IDocumentTimerAccess* SwFmt::getIDocumentTimerAccess() { return GetDoc(); }
diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx
index 524b231..392654f 100644
--- a/sw/source/core/doc/DocumentDeviceManager.cxx
+++ b/sw/source/core/doc/DocumentDeviceManager.cxx
@@ -22,6 +22,7 @@
 #include <IDocumentDeviceAccess.hxx>
 #include <doc.hxx>
 #include <DocumentSettingManager.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <sfx2/printer.hxx>
 #include <vcl/virdev.hxx>
 #include <vcl/outdev.hxx>
@@ -77,8 +78,8 @@ void DocumentDeviceManager::setPrinter(/*[in]*/ SfxPrinter *pP,/*[in]*/ bool bDe
              mpPrt->SetMapMode( aMapMode );
         }
 
-        if ( m_rSwdoc.GetDrawModel() && !m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
-            m_rSwdoc.GetDrawModel()->SetRefDevice( mpPrt );
+        if ( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() && !m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+            m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( mpPrt );
     }
 
     if ( bCallPrtDataChanged &&
@@ -107,8 +108,8 @@ void DocumentDeviceManager::setVirtualDevice(/*[in]*/ VirtualDevice* pVd,/*[in]*
             delete mpVirDev;
         mpVirDev = pVd;
 
-        if ( m_rSwdoc.GetDrawModel() && m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
-            m_rSwdoc.GetDrawModel()->SetRefDevice( mpVirDev );
+        if ( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() && m_rSwdoc.GetDocumentSettingManager().get( IDocumentSettingAccess::USE_VIRTUAL_DEVICE ) )
+            m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( mpVirDev );
     }
 }
 
@@ -145,8 +146,8 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*
             else
                 pMyVirDev->SetReferenceDevice( VirtualDevice::REFDEV_MODE_MSO1 );
 
-            if( m_rSwdoc.GetDrawModel() )
-                m_rSwdoc.GetDrawModel()->SetRefDevice( pMyVirDev );
+            if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() )
+                m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pMyVirDev );
         }
         else
         {
@@ -157,8 +158,8 @@ void DocumentDeviceManager::setReferenceDeviceType(/*[in]*/ bool bNewVirtual, /*
             // getReferenceDevice()->getPrinter()->CreatePrinter_()
             // ->setPrinter()-> PrtDataChanged()
             SfxPrinter* pPrinter = getPrinter( true );
-            if( m_rSwdoc.GetDrawModel() )
-                m_rSwdoc.GetDrawModel()->SetRefDevice( pPrinter );
+            if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() )
+                m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pPrinter );
         }
 
         m_rSwdoc.GetDocumentSettingManager().set(IDocumentSettingAccess::USE_VIRTUAL_DEVICE, bNewVirtual );
@@ -320,10 +321,10 @@ void DocumentDeviceManager::PrtDataChanged()
             bEndAction = true;
 
             bDraw = false;
-            if( m_rSwdoc.GetDrawModel() )
+            if( m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() )
             {
-                m_rSwdoc.GetDrawModel()->SetAddExtLeading( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) );
-                m_rSwdoc.GetDrawModel()->SetRefDevice( getReferenceDevice( false ) );
+                m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetAddExtLeading( m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) );
+                m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( getReferenceDevice( false ) );
             }
 
             pFntCache->Flush();
@@ -339,15 +340,15 @@ void DocumentDeviceManager::PrtDataChanged()
             while ( pSh != m_rSwdoc.GetCurrentViewShell() );
         }
     }
-    if ( bDraw && m_rSwdoc.GetDrawModel() )
+    if ( bDraw && m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel() )
     {
         const bool bTmpAddExtLeading = m_rSwdoc.GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING);
-        if ( bTmpAddExtLeading != m_rSwdoc.GetDrawModel()->IsAddExtLeading() )
-            m_rSwdoc.GetDrawModel()->SetAddExtLeading( bTmpAddExtLeading );
+        if ( bTmpAddExtLeading != m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->IsAddExtLeading() )
+            m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetAddExtLeading( bTmpAddExtLeading );
 
         OutputDevice* pOutDev = getReferenceDevice( false );
-        if ( pOutDev != m_rSwdoc.GetDrawModel()->GetRefDevice() )
-            m_rSwdoc.GetDrawModel()->SetRefDevice( pOutDev );
+        if ( pOutDev != m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->GetRefDevice() )
+            m_rSwdoc.getIDocumentDrawModelAccess().GetDrawModel()->SetRefDevice( pOutDev );
     }
 
     m_rSwdoc.PrtOLENotify( true );
diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx
new file mode 100644
index 0000000..09fdbd7
--- /dev/null
+++ b/sw/source/core/doc/DocumentDrawModelManager.cxx
@@ -0,0 +1,367 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <DocumentDrawModelManager.hxx>
+
+#include <doc.hxx>
+#include <IDocumentUndoRedo.hxx>
+#include <IDocumentSettingAccess.hxx>
+#include <IDocumentDeviceAccess.hxx>
+#include <docsh.hxx>
+#include <swtypes.hxx>
+#include <swhints.hxx>
+#include <viewsh.hxx>
+#include <drawdoc.hxx>
+#include <rootfrm.hxx>
+#include <editeng/eeitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdlayer.hxx>
+#include <svx/svdoutl.hxx>
+#include <svx/svdpage.hxx>
+#include <svx/svdpagv.hxx>
+#include <svl/smplhint.hxx>
+#include <tools/link.hxx>
+
+class SdrOutliner;
+class XSpellChecker1;
+
+namespace sw
+{
+
+DocumentDrawModelManager::DocumentDrawModelManager( SwDoc& i_rSwdoc ) : m_rSwdoc(i_rSwdoc), mpDrawModel(0) {}
+
+
+// Is also called by the Sw3 Reader, if there was an error when reading the
+// drawing layer. If it is called by the Sw3 Reader the layer is rebuilt
+// from scratch.
+void DocumentDrawModelManager::InitDrawModel()
+{
+    // !! Attention: there is similar code in the Sw3 Reader (sw3imp.cxx) that
+    // also has to be maintained!!
+    if ( mpDrawModel )
+        ReleaseDrawModel();
+
+//UUUU
+//  // Setup DrawPool and EditEnginePool. Ownership is ours and only gets passed
+//  // to the Drawing.
+//  // The pools are destroyed in the ReleaseDrawModel.
+//  // for loading the drawing items. This must be loaded without RefCounts!
+//  SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
+//  // 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();
+
+    // set FontHeight pool defaults without changing static SdrEngineDefaults
+    m_rSwdoc.GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
+
+    SAL_INFO( "sw.doc", "before create DrawDocument" );
+    // The document owns the SdrModel. We always have two layers and one page.
+    mpDrawModel = new SwDrawDocument( &m_rSwdoc );
+
+    mpDrawModel->EnableUndo( m_rSwdoc.GetIDocumentUndoRedo().DoesUndo() );
+
+    OUString sLayerNm;
+    sLayerNm = "Hell";
+    mnHell   = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+    sLayerNm = "Heaven";
+    mnHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+    sLayerNm = "Controls";
+    mnControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+    // add invisible layers corresponding to the visible ones.
+    {
+        sLayerNm = "InvisibleHell";
+        mnInvisibleHell   = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+        sLayerNm = "InvisibleHeaven";
+        mnInvisibleHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+
+        sLayerNm = "InvisibleControls";
+        mnInvisibleControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
+    }
+
+    SdrPage* pMasterPage = mpDrawModel->AllocPage( false );
+    mpDrawModel->InsertPage( pMasterPage );
+    SAL_INFO( "sw.doc", "after create DrawDocument" );
+    SAL_INFO( "sw.doc", "before create Spellchecker/Hyphenator" );
+    SdrOutliner& rOutliner = mpDrawModel->GetDrawOutliner();
+    ::com::sun::star::uno::Reference< com::sun::star::linguistic2::XSpellChecker1 > xSpell = ::GetSpellChecker();
+    rOutliner.SetSpeller( xSpell );
+    ::com::sun::star::uno::Reference< com::sun::star::linguistic2::XHyphenator > xHyphenator( ::GetHyphenator() );
+    rOutliner.SetHyphenator( xHyphenator );
+    SAL_INFO( "sw.doc", "after create Spellchecker/Hyphenator" );
+    m_rSwdoc.SetCalcFieldValueHdl(&rOutliner);
+    m_rSwdoc.SetCalcFieldValueHdl(&mpDrawModel->GetHitTestOutliner());
+
+    // Set the LinkManager in the model so that linked graphics can be inserted.
+    // The WinWord import needs it too.
+    mpDrawModel->SetLinkManager( & m_rSwdoc.GetLinkManager() );
+    mpDrawModel->SetAddExtLeading( m_rSwdoc.getIDocumentSettingAccess().get(IDocumentSettingAccess::ADD_EXT_LEADING) );
+
+    OutputDevice* pRefDev = m_rSwdoc.getIDocumentDeviceAccess().getReferenceDevice( false );
+    if ( pRefDev )
+        mpDrawModel->SetRefDevice( pRefDev );
+
+    mpDrawModel->SetNotifyUndoActionHdl( LINK( &m_rSwdoc, SwDoc, AddDrawUndo ));
+    if ( m_rSwdoc.GetCurrentViewShell() )
+    {
+        SwViewShell* pViewSh = m_rSwdoc.GetCurrentViewShell();
+        do
+        {
+            SwRootFrm* pRoot =  pViewSh->GetLayout();
+            if( pRoot && !pRoot->GetDrawPage() )
+            {
+                // Disable "multiple layout" for the moment:
+                // use pMasterPage instead of a new created SdrPage
+                // mpDrawModel->AllocPage( FALSE );
+                // mpDrawModel->InsertPage( pDrawPage );
+                SdrPage* pDrawPage = pMasterPage;
+                pRoot->SetDrawPage( pDrawPage );
+                pDrawPage->SetSize( pRoot->Frm().SSize() );
+            }
+            pViewSh = (SwViewShell*)pViewSh->GetNext();
+        }while( pViewSh != m_rSwdoc.GetCurrentViewShell() );
+    }
+}
+
+
+void DocumentDrawModelManager::ReleaseDrawModel()
+{
+    if ( mpDrawModel )
+    {
+        // !! Also maintain the code in the sw3io for inserting documents!!
+
+        delete mpDrawModel; mpDrawModel = 0;
+//UUUU
+//      SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
+//
+//      OSL_ENSURE( pSdrPool, "missing pool" );
+//      SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
+//      OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "I don't accept additional pools");
+//      pSdrPool->Delete();                 // First have the items destroyed,
+//                                          // then destroy the chain!
+//      GetAttrPool().SetSecondaryPool( 0 );    // This one's a must!
+//      pSdrPool->SetSecondaryPool( 0 );    // That one's safer
+//      SfxItemPool::Free(pSdrPool);
+//      SfxItemPool::Free(pEEgPool);
+    }
+}
+
+
+
+
+
+const SdrModel* DocumentDrawModelManager::GetDrawModel() const
+{
+    return mpDrawModel;
+}
+
+SdrModel* DocumentDrawModelManager::GetDrawModel()
+{
+    return mpDrawModel;
+}
+
+SdrModel* DocumentDrawModelManager::_MakeDrawModel()
+{
+    OSL_ENSURE( !mpDrawModel, "_MakeDrawModel: Why?" );
+    InitDrawModel();
+    if ( m_rSwdoc.GetCurrentViewShell() )
+    {
+        SwViewShell* pTmp = m_rSwdoc.GetCurrentViewShell();
+        do
+        {
+            pTmp->MakeDrawView();
+            pTmp = (SwViewShell*) pTmp->GetNext();
+        } while ( pTmp != m_rSwdoc.GetCurrentViewShell() );
+
+        // Broadcast, so that the FormShell can be connected to the DrawView
+        if( m_rSwdoc.GetDocShell() )
+        {
+            SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
+            m_rSwdoc.GetDocShell()->Broadcast( aHnt );
+        }
+    }
+    return mpDrawModel;
+}
+
+SdrModel* DocumentDrawModelManager::GetOrCreateDrawModel()
+{
+    return GetDrawModel() ? GetDrawModel() : _MakeDrawModel();
+}
+
+SdrLayerID DocumentDrawModelManager::GetHeavenId() const
+{
+    return mnHeaven;
+}
+
+SdrLayerID DocumentDrawModelManager::GetHellId() const
+{
+    return mnHell;
+}
+
+SdrLayerID DocumentDrawModelManager::GetControlsId() const
+{
+    return mnControls;
+}
+
+SdrLayerID DocumentDrawModelManager::GetInvisibleHeavenId() const
+{
+    return mnInvisibleHeaven;
+}
+
+SdrLayerID DocumentDrawModelManager::GetInvisibleHellId() const
+{
+    return mnInvisibleHell;
+}
+
+SdrLayerID DocumentDrawModelManager::GetInvisibleControlsId() const
+{
+    return mnInvisibleControls;
+}
+
+void DocumentDrawModelManager::NotifyInvisibleLayers( SdrPageView& _rSdrPageView )
+{
+    OUString sLayerNm;
+    sLayerNm = "InvisibleHell";
+    _rSdrPageView.SetLayerVisible( sLayerNm, false );
+
+    sLayerNm = "InvisibleHeaven";
+    _rSdrPageView.SetLayerVisible( sLayerNm, false );
+
+    sLayerNm = "InvisibleControls";
+    _rSdrPageView.SetLayerVisible( sLayerNm, false );
+}
+
+bool DocumentDrawModelManager::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
+    {
+        OSL_FAIL( "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
+        bRetVal = false;
+    }
+
+    return bRetVal;
+}
+
+SdrLayerID DocumentDrawModelManager::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() )
+    {
+        OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
+        nVisibleLayerId = _nInvisibleLayerId;
+    }
+    else
+    {
+        OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
+        nVisibleLayerId = _nInvisibleLayerId;
+    }
+
+    return nVisibleLayerId;
+}
+
+SdrLayerID DocumentDrawModelManager::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() )
+    {
+        OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
+        nInvisibleLayerId = _nVisibleLayerId;
+    }
+    else
+    {
+        OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
+        nInvisibleLayerId = _nVisibleLayerId;
+    }
+
+    return nInvisibleLayerId;
+}
+
+void DocumentDrawModelManager::DrawNotifyUndoHdl()
+{
+    mpDrawModel->SetNotifyUndoActionHdl( Link() );
+}
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 4a7b085..85f605b 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -19,6 +19,7 @@
 
 #include <DocumentSettingManager.hxx>
 #include <doc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <comphelper/processfactory.hxx>
 #include <editeng/forbiddencharacterstable.hxx>
 #include <svx/svdmodel.hxx>
@@ -388,7 +389,7 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ sal_uInt16 nLan
     }
     mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
 
-    SdrModel *pDrawModel = m_rDoc.GetDrawModel();
+    SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
     if( pDrawModel )
     {
         pDrawModel->SetForbiddenCharsTable( mxForbiddenCharsTable );
@@ -458,7 +459,7 @@ void sw::DocumentSettingManager::setCharacterCompressionType( /*[in]*/SwCharComp
     {
         meChrCmprType = n;
 
-        SdrModel *pDrawModel = m_rDoc.GetDrawModel();
+        SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
         if( pDrawModel )
         {
             pDrawModel->SetCharCompressType( static_cast<sal_uInt16>(n) );
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index d513e69..e4ea756 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -19,6 +19,7 @@
 
 #include <doc.hxx>
 #include <DocumentSettingManager.hxx>
+#include <DocumentDrawModelManager.hxx>
 #include <UndoManager.hxx>
 #include <hintids.hxx>
 
@@ -149,6 +150,27 @@ sal_Int32 SwDoc::getReferenceCount() const
     return mReferenceCount;
 }
 
+/* IDocumentDrawModelAccess */
+IDocumentDrawModelAccess const & SwDoc::getIDocumentDrawModelAccess() const
+{
+    return GetDocumentDrawModelManager();
+}
+
+IDocumentDrawModelAccess & SwDoc::getIDocumentDrawModelAccess()
+{
+    return GetDocumentDrawModelManager();
+}
+
+::sw::DocumentDrawModelManager const & SwDoc::GetDocumentDrawModelManager() const
+{
+    return *m_pDocumentDrawModelManager;
+}
+
+::sw::DocumentDrawModelManager & SwDoc::GetDocumentDrawModelManager()
+{
+    return *m_pDocumentDrawModelManager;
+}
+
 /* IDocumentSettingAccess */
 IDocumentSettingAccess const & SwDoc::getIDocumentSettingAccess() const
 {
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index bce20c1..f7dd645 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -41,6 +41,7 @@
 #include <IDocumentUndoRedo.hxx>
 #include <DocumentSettingManager.hxx>
 #include <IDocumentDeviceAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <docsh.hxx>
 #include <rootfrm.hxx>
 #include <poolfmt.hxx>
@@ -510,287 +511,6 @@ _ZSortFly::_ZSortFly( const SwFrmFmt* pFrmFmt, const SwFmtAnchor* pFlyAn,
     }
 }
 
-#include <svx/sxenditm.hxx>
-
-// Is also called by the Sw3 Reader, if there was an error when reading the
-// drawing layer. If it is called by the Sw3 Reader the layer is rebuilt
-// from scratch.
-void SwDoc::InitDrawModel()
-{
-    // !! Attention: there is similar code in the Sw3 Reader (sw3imp.cxx) that
-    // also has to be maintained!!
-    if ( mpDrawModel )
-        ReleaseDrawModel();
-
-//UUUU
-//  // Setup DrawPool and EditEnginePool. Ownership is ours and only gets passed
-//  // to the Drawing.
-//  // The pools are destroyed in the ReleaseDrawModel.
-//  // for loading the drawing items. This must be loaded without RefCounts!
-//  SfxItemPool *pSdrPool = new SdrItemPool( &GetAttrPool() );
-//  // 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();
-
-    // set FontHeight pool defaults without changing static SdrEngineDefaults
-    GetAttrPool().SetPoolDefaultItem(SvxFontHeightItem( 240, 100, EE_CHAR_FONTHEIGHT ));
-
-    SAL_INFO( "sw.doc", "before create DrawDocument" );
-    // The document owns the SdrModel. We always have two layers and one page.
-    mpDrawModel = new SwDrawDocument( this );
-
-    mpDrawModel->EnableUndo( GetIDocumentUndoRedo().DoesUndo() );
-
-    OUString sLayerNm;
-    sLayerNm = "Hell";
-    mnHell   = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-    sLayerNm = "Heaven";
-    mnHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-    sLayerNm = "Controls";
-    mnControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-    // add invisible layers corresponding to the visible ones.
-    {
-        sLayerNm = "InvisibleHell";
-        mnInvisibleHell   = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-        sLayerNm = "InvisibleHeaven";
-        mnInvisibleHeaven = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-
-        sLayerNm = "InvisibleControls";
-        mnInvisibleControls = mpDrawModel->GetLayerAdmin().NewLayer( sLayerNm )->GetID();
-    }
-
-    SdrPage* pMasterPage = mpDrawModel->AllocPage( false );
-    mpDrawModel->InsertPage( pMasterPage );
-    SAL_INFO( "sw.doc", "after create DrawDocument" );
-    SAL_INFO( "sw.doc", "before create Spellchecker/Hyphenator" );
-    SdrOutliner& rOutliner = mpDrawModel->GetDrawOutliner();
-    uno::Reference< XSpellChecker1 > xSpell = ::GetSpellChecker();
-    rOutliner.SetSpeller( xSpell );
-    uno::Reference<XHyphenator> xHyphenator( ::GetHyphenator() );
-    rOutliner.SetHyphenator( xHyphenator );
-    SAL_INFO( "sw.doc", "after create Spellchecker/Hyphenator" );
-    SetCalcFieldValueHdl(&rOutliner);
-    SetCalcFieldValueHdl(&mpDrawModel->GetHitTestOutliner());
-
-    // Set the LinkManager in the model so that linked graphics can be inserted.
-    // The WinWord import needs it too.
-    mpDrawModel->SetLinkManager( &GetLinkManager() );
-    mpDrawModel->SetAddExtLeading( GetDocumentSettingManager().get(IDocumentSettingAccess::ADD_EXT_LEADING) );
-
-    OutputDevice* pRefDev = getIDocumentDeviceAccess().getReferenceDevice( false );
-    if ( pRefDev )
-        mpDrawModel->SetRefDevice( pRefDev );
-
-    mpDrawModel->SetNotifyUndoActionHdl( LINK( this, SwDoc, AddDrawUndo ));
-    if ( mpCurrentView )
-    {
-        SwViewShell* pViewSh = mpCurrentView;
-        do
-        {
-            SwRootFrm* pRoot =  pViewSh->GetLayout();
-            if( pRoot && !pRoot->GetDrawPage() )
-            {
-                // Disable "multiple layout" for the moment:
-                // use pMasterPage instead of a new created SdrPage
-                // mpDrawModel->AllocPage( FALSE );
-                // mpDrawModel->InsertPage( pDrawPage );
-                SdrPage* pDrawPage = pMasterPage;
-                pRoot->SetDrawPage( pDrawPage );
-                pDrawPage->SetSize( pRoot->Frm().SSize() );
-            }
-            pViewSh = (SwViewShell*)pViewSh->GetNext();
-        }while( pViewSh != mpCurrentView );
-    }
-}
-
-/** method to notify drawing page view about the invisible layers */
-void SwDoc::NotifyInvisibleLayers( SdrPageView& _rSdrPageView )
-{
-    OUString sLayerNm;
-    sLayerNm = "InvisibleHell";
-    _rSdrPageView.SetLayerVisible( sLayerNm, false );
-
-    sLayerNm = "InvisibleHeaven";
-    _rSdrPageView.SetLayerVisible( sLayerNm, false );
-
-    sLayerNm = "InvisibleControls";
-    _rSdrPageView.SetLayerVisible( sLayerNm, false );
-}
-
-/** method to determine, if a layer ID belongs to the visible ones.
-
-    @note If given layer ID is unknown, method asserts and returns <false>.
-*/
-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
-    {
-        OSL_FAIL( "<SwDoc::IsVisibleLayerId(..)> - unknown layer ID." );
-        bRetVal = false;
-    }
-
-    return bRetVal;
-}
-
-/** method to determine, if the corresponding visible layer ID for a invisible one.
-
-    @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.
-*/
-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() )
-    {
-        OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID already an invisible one." );
-        nVisibleLayerId = _nInvisibleLayerId;
-    }
-    else
-    {
-        OSL_FAIL( "<SwDoc::GetVisibleLayerIdByInvisibleOne(..)> - given layer ID is unknown." );
-        nVisibleLayerId = _nInvisibleLayerId;
-    }
-
-    return nVisibleLayerId;
-}
-
-/** method to determine, if the corresponding invisible layer ID for a visible one.
-
-    @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.
-*/
-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() )
-    {
-        OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID already an invisible one." );
-        nInvisibleLayerId = _nVisibleLayerId;
-    }
-    else
-    {
-        OSL_FAIL( "<SwDoc::GetInvisibleLayerIdByVisibleOne(..)> - given layer ID is unknown." );
-        nInvisibleLayerId = _nVisibleLayerId;
-    }
-
-    return nInvisibleLayerId;
-}
-
-void SwDoc::ReleaseDrawModel()
-{
-    if ( mpDrawModel )
-    {
-        // !! Also maintain the code in the sw3io for inserting documents!!
-
-        delete mpDrawModel; mpDrawModel = 0;
-//UUUU
-//      SfxItemPool *pSdrPool = GetAttrPool().GetSecondaryPool();
-//
-//      OSL_ENSURE( pSdrPool, "missing pool" );
-//      SfxItemPool *pEEgPool = pSdrPool->GetSecondaryPool();
-//      OSL_ENSURE( !pEEgPool->GetSecondaryPool(), "I don't accept additional pools");
-//      pSdrPool->Delete();                 // First have the items destroyed,
-//                                          // then destroy the chain!
-//      GetAttrPool().SetSecondaryPool( 0 );    // This one's a must!
-//      pSdrPool->SetSecondaryPool( 0 );    // That one's safer
-//      SfxItemPool::Free(pSdrPool);
-//      SfxItemPool::Free(pEEgPool);
-    }
-}
-
-SdrModel* SwDoc::_MakeDrawModel()
-{
-    OSL_ENSURE( !mpDrawModel, "_MakeDrawModel: Why?" );
-    InitDrawModel();
-    if ( mpCurrentView )
-    {
-        SwViewShell* pTmp = mpCurrentView;
-        do
-        {
-            pTmp->MakeDrawView();
-            pTmp = (SwViewShell*) pTmp->GetNext();
-        } while ( pTmp != mpCurrentView );
-
-        // Broadcast, so that the FormShell can be connected to the DrawView
-        if( GetDocShell() )
-        {
-            SfxSimpleHint aHnt( SW_BROADCAST_DRAWVIEWS_CREATED );
-            GetDocShell()->Broadcast( aHnt );
-        }
-    }
-    return mpDrawModel;
-}
-
-void SwDoc::DrawNotifyUndoHdl()
-{
-    mpDrawModel->SetNotifyUndoActionHdl( Link() );
-}
-
 /// In the Outliner, set a link to the method for field display in edit objects.
 void SwDoc::SetCalcFieldValueHdl(Outliner* pOutliner)
 {
@@ -870,18 +590,6 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo)
     return(0);
 }
 
-/* TFFDI: The functions formerly declared 'inline'
- */
-const SdrModel* SwDoc::GetDrawModel() const { return mpDrawModel; }
-SdrModel* SwDoc::GetDrawModel() { return mpDrawModel; }
-SdrLayerID SwDoc::GetHeavenId() const { return mnHeaven; }
-SdrLayerID SwDoc::GetHellId() const { return mnHell; }
-SdrLayerID SwDoc::GetControlsId() const { return mnControls;   }
-SdrLayerID SwDoc::GetInvisibleHeavenId() const { return mnInvisibleHeaven; }
-SdrLayerID SwDoc::GetInvisibleHellId() const { return mnInvisibleHell; }
-SdrLayerID SwDoc::GetInvisibleControlsId() const { return mnInvisibleControls; }
-SdrModel* SwDoc::GetOrCreateDrawModel() { return GetDrawModel() ? GetDrawModel() : _MakeDrawModel(); }
-
 // #i62875#
 namespace docfunc
 {
@@ -889,10 +597,10 @@ namespace docfunc
     {
         bool bExistsDrawObjs( false );
 
-        if ( p_rDoc.GetDrawModel() &&
-             p_rDoc.GetDrawModel()->GetPage( 0 ) )
+        if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
+             p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) )
         {
-            const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
+            const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
 
             SdrObjListIter aIter( rSdrPage, IM_FLAT );
             while( aIter.IsMore() )
@@ -914,10 +622,10 @@ namespace docfunc
     {
         bool bAllDrawObjsOnPage( true );
 
-        if ( p_rDoc.GetDrawModel() &&
-             p_rDoc.GetDrawModel()->GetPage( 0 ) )
+        if ( p_rDoc.getIDocumentDrawModelAccess().GetDrawModel() &&
+             p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 ) )
         {
-            const SdrPage& rSdrPage( *(p_rDoc.GetDrawModel()->GetPage( 0 )) );
+            const SdrPage& rSdrPage( *(p_rDoc.getIDocumentDrawModelAccess().GetDrawModel()->GetPage( 0 )) );
 
             SdrObjListIter aIter( rSdrPage, IM_FLAT );
             while( aIter.IsMore() )
diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx
index f610cce..8418a99 100644
--- a/sw/source/core/doc/docfly.cxx
+++ b/sw/source/core/doc/docfly.cxx
@@ -32,6 +32,7 @@
 #include <ndgrf.hxx>
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <ndindex.hxx>
 #include <docary.hxx>
 #include <fmtcntnt.hxx>
@@ -445,7 +446,7 @@ lcl_SetFlyFrmAttr(SwDoc & rDoc,
 
 void SwDoc::CheckForUniqueItemForLineFillNameOrIndex(SfxItemSet& rSet)
 {
-    SdrModel* pDrawModel = GetOrCreateDrawModel();
+    SdrModel* pDrawModel = getIDocumentDrawModelAccess().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 b925f86..942ac12 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -63,6 +63,7 @@
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <DocumentSettingManager.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <rootfrm.hxx>
 #include <pagefrm.hxx>
 #include <cntfrm.hxx>
@@ -500,11 +501,11 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc,
                                 bool bInsInPage )
 {
     // #i52858# - method name changed
-    SdrPage *pPg = GetOrCreateDrawModel()->GetPage( 0 );
+    SdrPage *pPg = getIDocumentDrawModelAccess().GetOrCreateDrawModel()->GetPage( 0 );
     if( !pPg )
     {
-        pPg = GetDrawModel()->AllocPage( false );
-        GetDrawModel()->InsertPage( pPg );
+        pPg = getIDocumentDrawModelAccess().GetDrawModel()->AllocPage( false );
+        getIDocumentDrawModelAccess().GetDrawModel()->InsertPage( pPg );
     }
 
     SdrObject *pObj = rObj.Clone();
@@ -531,9 +532,9 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc,
          !pObj->ISA(SwVirtFlyDrawObj) &&
          !IS_TYPE(SdrObject,pObj) )
     {
-        if ( IsVisibleLayerId( nLayerIdForClone ) )
+        if ( getIDocumentDrawModelAccess().IsVisibleLayerId( nLayerIdForClone ) )
         {
-            nLayerIdForClone = GetInvisibleLayerIdByVisibleOne( nLayerIdForClone );
+            nLayerIdForClone = getIDocumentDrawModelAccess().GetInvisibleLayerIdByVisibleOne( nLayerIdForClone );
         }
     }
     pObj->SetLayer( nLayerIdForClone );
@@ -1556,8 +1557,8 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
 
     // Send the frame to the back, if needed.
     // Consider the 'invisible' hell layer.
-    if ( rDoc.GetHellId() != nLayerId &&
-         rDoc.GetInvisibleHellId() != nLayerId )
+    if ( rDoc.getIDocumentDrawModelAccess().GetHellId() != nLayerId &&
+         rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId() != nLayerId )
     {
         SvxOpaqueItem aOpaque( RES_OPAQUE );
         aOpaque.SetValue( true );
@@ -1624,14 +1625,14 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
     pNewSet->ClearItem();
 
     pNewSet->Put( SwFmtSurround( SURROUND_NONE ) );
-    if (nLayerId == rDoc.GetHellId())
+    if (nLayerId == rDoc.getIDocumentDrawModelAccess().GetHellId())
     {
     // Consider drawing objects in the 'invisible' hell layer
-        rSdrObj.SetLayer( rDoc.GetHeavenId() );
+        rSdrObj.SetLayer( rDoc.getIDocumentDrawModelAccess().GetHeavenId() );
     }
-    else if (nLayerId == rDoc.GetInvisibleHellId())
+    else if (nLayerId == rDoc.getIDocumentDrawModelAccess().GetInvisibleHellId())
     {
-        rSdrObj.SetLayer( rDoc.GetInvisibleHeavenId() );
+        rSdrObj.SetLayer( rDoc.getIDocumentDrawModelAccess().GetInvisibleHeavenId() );
     }
     pNewSet->Put( SvxLRSpaceItem( RES_LR_SPACE ) );
     pNewSet->Put( SvxULSpaceItem( RES_UL_SPACE ) );
diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index ea387a8..61441b4 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -20,7 +20,6 @@
 #include <config_features.h>
 
 #include <doc.hxx>
-#include <DocumentSettingManager.hxx>
 #include <dcontact.hxx>
 #include <com/sun/star/document/PrinterIndependentLayout.hpp>
 #include <com/sun/star/document/UpdateDocMode.hpp>
@@ -89,6 +88,8 @@
 #include <MarkManager.hxx>
 #include <UndoManager.hxx>
 #include <DocumentDeviceManager.hxx>
+#include <DocumentSettingManager.hxx>
+#include <DocumentDrawModelManager.hxx>
 #include <unochart.hxx>
 #include <fldbas.hxx>
 
@@ -187,8 +188,9 @@ SwDoc::SwDoc()
     mpAttrPool(new SwAttrPool(this)),
     mpMarkManager(new ::sw::mark::MarkManager(*this)),
     m_pMetaFieldManager(new ::sw::MetaFieldManager()),
+    m_pDocumentDrawModelManager( new ::sw::DocumentDrawModelManager( *this ) ),
     m_pUndoManager(new ::sw::UndoManager(
-            boost::shared_ptr<SwNodes>(new SwNodes(this)), *this, *this, *this)),
+            boost::shared_ptr<SwNodes>(new SwNodes(this)), *m_pDocumentDrawModelManager, *this, *this)),
     m_pDocumentSettingManager(new ::sw::DocumentSettingManager(*this)),
     m_pDeviceAccess( new ::sw::DocumentDeviceManager( *this ) ),
     mpDfltFrmFmt( new SwFrmFmt( GetAttrPool(), sFrmFmtStr, 0 ) ),
@@ -207,7 +209,6 @@ SwDoc::SwDoc()
     mpTOXTypes( new SwTOXTypes() ),
     mpDefTOXBases( new SwDefTOXBase_Impl() ),
     mpCurrentView( 0 ),
-    mpDrawModel( 0 ),
     mpUpdtFlds( new SwDocUpdtFld( this ) ),
     mpFldTypes( new SwFldTypes() ),
     mpGlossaryDoc( 0 ),
@@ -456,9 +457,9 @@ SwDoc::~SwDoc()
     mpLayouter = 0L;
 
     // Deactivate Undo notification from Draw
-    if( mpDrawModel )
+    if( GetDocumentDrawModelManager().GetDrawModel() )
     {
-        DrawNotifyUndoHdl();
+        GetDocumentDrawModelManager().DrawNotifyUndoHdl();
         ClrContourCache();
     }
 
@@ -593,7 +594,7 @@ SwDoc::~SwDoc()
     // Only now destroy the Model, the drawing objects - which are also
     // contained in the Undo - need to remove their attributes from the
     // Model. Also, DrawContacts could exist before this.
-    ReleaseDrawModel();
+    GetDocumentDrawModelManager().ReleaseDrawModel();
     // Destroy DrawModel before the LinkManager, because it's always set
     // in the DrawModel.
     DELETEZ( mpLinkMgr );
@@ -658,11 +659,11 @@ void SwDoc::SetDocShell( SwDocShell* pDSh )
         }
 
         mpLinkMgr->SetPersist( mpDocShell );
-        if( mpDrawModel )
+        if( GetDocumentDrawModelManager().GetDrawModel() )
         {
-            ((SwDrawDocument*)mpDrawModel)->SetObjectShell( mpDocShell );
-            mpDrawModel->SetPersist( mpDocShell );
-            OSL_ENSURE( mpDrawModel->GetPersist() == GetPersist(),
+            ((SwDrawDocument*)GetDocumentDrawModelManager().GetDrawModel())->SetObjectShell( mpDocShell );
+            GetDocumentDrawModelManager().GetDrawModel()->SetPersist( mpDocShell );
+            OSL_ENSURE( GetDocumentDrawModelManager().GetDrawModel()->GetPersist() == GetPersist(),
                     "draw model's persist is out of sync" );
         }
     }
@@ -689,9 +690,9 @@ void SwDoc::ClearDoc()
     ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
 
     // Deactivate Undo notification from Draw
-    if( mpDrawModel )
+    if( GetDocumentDrawModelManager().GetDrawModel() )
     {
-        DrawNotifyUndoHdl();
+        GetDocumentDrawModelManager().DrawNotifyUndoHdl();
         ClrContourCache();
     }
 
@@ -699,7 +700,7 @@ void SwDoc::ClearDoc()
     sal_uInt16 n;
     while ( 0 != (n = GetSpzFrmFmts()->size()) )
         DelLayoutFmt((*mpSpzFrmFmtTbl)[n-1]);
-    OSL_ENSURE( !mpDrawModel || !mpDrawModel->GetPage(0)->GetObjCount(),
+    OSL_ENSURE( !GetDocumentDrawModelManager().GetDrawModel() || !GetDocumentDrawModelManager().GetDrawModel()->GetPage(0)->GetObjCount(),
                 "not all DrawObjects removed from the page" );
 
     mpRedlineTbl->DeleteAndDestroyAll();
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 48d9339..5cb751e 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -1918,7 +1918,7 @@ const IDocumentDeviceAccess* SwNode::getIDocumentDeviceAccess() const { return &
 const IDocumentRedlineAccess* SwNode::getIDocumentRedlineAccess() const { return GetDoc(); }
 const IDocumentStylePoolAccess* SwNode::getIDocumentStylePoolAccess() const { return GetDoc(); }
 const IDocumentLineNumberAccess* SwNode::getIDocumentLineNumberAccess() const { return GetDoc(); }
-const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return GetDoc(); }
+const IDocumentDrawModelAccess* SwNode::getIDocumentDrawModelAccess() const { return & GetDoc()->getIDocumentDrawModelAccess(); }
 const IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() const { return GetDoc(); }
 IDocumentLayoutAccess* SwNode::getIDocumentLayoutAccess() { return GetDoc(); }
 const IDocumentLinksAdministration* SwNode::getIDocumentLinksAdministration() const { return GetDoc(); }
diff --git a/sw/source/core/docnode/nodedump.cxx b/sw/source/core/docnode/nodedump.cxx
index 5283af3..fde49d7 100644
--- a/sw/source/core/docnode/nodedump.cxx
+++ b/sw/source/core/docnode/nodedump.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "doc.hxx"
+#include <IDocumentDrawModelAccess.hxx>
 #include "ndtxt.hxx"
 #include "MarkManager.hxx"
 #include "docary.hxx"
@@ -189,7 +190,7 @@ void SwDoc::dumpAsXml( xmlTextWriterPtr w )
     mpNumRuleTbl->dumpAsXml( writer );
     mpRedlineTbl->dumpAsXml( writer );
     mpExtraRedlineTbl->dumpAsXml( writer );
-    lcl_dumpSdrModel( writer, mpDrawModel );
+    lcl_dumpSdrModel( writer, getIDocumentDrawModelAccess().GetDrawModel() );
     writer.endElement();
 }
 
diff --git a/sw/source/core/draw/drawdoc.cxx b/sw/source/core/draw/drawdoc.cxx
index 7f6236d..8090dfe 100644
--- a/sw/source/core/draw/drawdoc.cxx
+++ b/sw/source/core/draw/drawdoc.cxx
@@ -37,6 +37,7 @@
 #include <hintids.hxx>
 #include <com/sun/star/embed/ElementModes.hpp>
 #include <DocumentSettingManager.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 
 using namespace com::sun::star;
 
@@ -147,7 +148,7 @@ uno::Reference<embed::XStorage> SwDrawDocument::GetDocumentStorage() const
 SdrLayerID SwDrawDocument::GetControlExportLayerId( const SdrObject & ) const
 {
     //for versions < 5.0, there was only Hell and Heaven
-    return (SdrLayerID)pDoc->GetHeavenId();
+    return (SdrLayerID)pDoc->getIDocumentDrawModelAccess().GetHeavenId();
 }
 
 uno::Reference< uno::XInterface > SwDrawDocument::createUnoModel()
diff --git a/sw/source/core/fields/textapi.cxx b/sw/source/core/fields/textapi.cxx
index 719c341..c9a3820 100644
--- a/sw/source/core/fields/textapi.cxx
+++ b/sw/source/core/fields/textapi.cxx
@@ -19,6 +19,7 @@
 
 #include <textapi.hxx>
 #include <doc.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <docsh.hxx>
 #include <editeng/eeitem.hxx>
 #include <editeng/editeng.hxx>
@@ -123,7 +124,7 @@ SvxTextForwarder* SwTextAPIEditSource::GetTextForwarder()
     if( !pImpl->mpOutliner )
     {
         //init draw model first
-        pImpl->mpDoc->GetOrCreateDrawModel();
+        pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
         pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT );
         pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner );
     }
@@ -141,7 +142,7 @@ void SwTextAPIEditSource::SetText( OutlinerParaObject& rText )
         if( !pImpl->mpOutliner )
         {
             //init draw model first
-            pImpl->mpDoc->GetOrCreateDrawModel();
+            pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
             pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT );
             pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner );
         }
@@ -157,7 +158,7 @@ void SwTextAPIEditSource::SetString( const OUString& rText )
         if( !pImpl->mpOutliner )
         {
             //init draw model first
-            pImpl->mpDoc->GetOrCreateDrawModel();
+            pImpl->mpDoc->getIDocumentDrawModelAccess().GetOrCreateDrawModel();
             pImpl->mpOutliner = new Outliner( pImpl->mpPool, OUTLINERMODE_TEXTOBJECT );
             pImpl->mpDoc->SetCalcFieldValueHdl( pImpl->mpOutliner );
         }
diff --git a/sw/source/core/frmedt/fecopy.cxx b/sw/source/core/frmedt/fecopy.cxx
index f248666..9aaab2a 100644
--- a/sw/source/core/frmedt/fecopy.cxx
+++ b/sw/source/core/frmedt/fecopy.cxx
@@ -54,6 +54,7 @@
 #include <fesh.hxx>
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <rootfrm.hxx>
 #include <ndtxt.hxx>
 #include <pam.hxx>
@@ -1393,9 +1394,9 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
                 pNewObj->NbcMove(Size(aVec.getX(), aVec.getY()));
 
                 if( pNewObj->ISA( SdrUnoObj ) )
-                    pNewObj->SetLayer( GetDoc()->GetControlsId() );
+                    pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() );
                 else if( pOldObj->ISA( SdrUnoObj ) )
-                    pNewObj->SetLayer( GetDoc()->GetHeavenId() );
+                    pNewObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetHeavenId() );
                 else
                     pNewObj->SetLayer( pOldObj->GetLayer() );
 
@@ -1524,11 +1525,11 @@ void SwFEShell::Paste( SvStream& rStrm, sal_uInt16 nAction, const Point* pPt )
             SdrObject *pObj = pView->GetMarkedObjectList().GetMark(0)->GetMarkedSdrObj();
             if( pObj->ISA( SdrUnoObj ) )
             {
-                pObj->SetLayer( GetDoc()->GetControlsId() );
+                pObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetControlsId() );
                 bDesignMode = true;
             }
             else
-                pObj->SetLayer( GetDoc()->GetHeavenId() );
+                pObj->SetLayer( GetDoc()->getIDocumentDrawModelAccess().GetHeavenId() );
             const Rectangle &rSnap = pObj->GetSnapRect();
             const Size aDiff( rSnap.GetWidth()/2, rSnap.GetHeight()/2 );
             pView->MoveMarkedObj( aDiff );
diff --git a/sw/source/core/inc/DocumentDrawModelManager.hxx b/sw/source/core/inc/DocumentDrawModelManager.hxx
new file mode 100644
index 0000000..596ee83
--- /dev/null
+++ b/sw/source/core/inc/DocumentDrawModelManager.hxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ *   Licensed to the Apache Software Foundation (ASF) under one or more
+ *   contributor license agreements. See the NOTICE file distributed
+ *   with this work for additional information regarding copyright
+ *   ownership. The ASF licenses this file to you under the Apache
+ *   License, Version 2.0 (the "License"); you may not use this file
+ *   except in compliance with the License. You may obtain a copy of
+ *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTDRAWMODELMANAGER_HXX
+#define INCLUDED_SW_SOURCE_CORE_INC_DOCUMENTDRAWMODELMANAGER_HXX
+
+#include <sal/types.h>
+#include <IDocumentDrawModelAccess.hxx>
+#include <boost/utility.hpp>
+#include <svx/svdtypes.hxx>
+
+class SdrModel;
+class SdrPageView;
+class SwDoc;
+
+namespace sw
+{
+
+class DocumentDrawModelManager : public IDocumentDrawModelAccess,
+                                 public ::boost::noncopyable
+{
+public:
+
+    DocumentDrawModelManager( SwDoc& i_rSwdoc );
+
+    void InitDrawModel();
+    void ReleaseDrawModel();
+    void DrawNotifyUndoHdl();
+
+    //IDocumentDrawModelAccess
+    virtual const SdrModel* GetDrawModel() const SAL_OVERRIDE;
+    virtual SdrModel* GetDrawModel() SAL_OVERRIDE;
+    virtual SdrModel* _MakeDrawModel() SAL_OVERRIDE;
+    virtual SdrModel* GetOrCreateDrawModel() SAL_OVERRIDE;
+    virtual SdrLayerID GetHeavenId() const SAL_OVERRIDE;
+    virtual SdrLayerID GetHellId() const SAL_OVERRIDE;
+    virtual SdrLayerID GetControlsId() const SAL_OVERRIDE;
+    virtual SdrLayerID GetInvisibleHeavenId() const SAL_OVERRIDE;
+    virtual SdrLayerID GetInvisibleHellId() const SAL_OVERRIDE;
+    virtual SdrLayerID GetInvisibleControlsId() const SAL_OVERRIDE;
+
+    virtual void NotifyInvisibleLayers( SdrPageView& _rSdrPageView ) SAL_OVERRIDE;
+
+    virtual bool IsVisibleLayerId( const SdrLayerID& _nLayerId ) const SAL_OVERRIDE;
+
+    virtual SdrLayerID GetVisibleLayerIdByInvisibleOne( const SdrLayerID& _nInvisibleLayerId ) SAL_OVERRIDE;
+
+    virtual SdrLayerID GetInvisibleLayerIdByVisibleOne( const SdrLayerID& _nVisibleLayerId ) SAL_OVERRIDE;
+
+    virtual ~DocumentDrawModelManager() {}
+
+private:
+
+    SwDoc& m_rSwdoc;
+
+
+    SdrModel* mpDrawModel;
+
+    /** Draw Model Layer IDs
+     * LayerIds, Heaven == above document
+     *           Hell   == below document
+     *         Controls == at the very top
+     */
+    SdrLayerID mnHeaven;
+    SdrLayerID mnHell;
+    SdrLayerID mnControls;
+    SdrLayerID mnInvisibleHeaven;
+    SdrLayerID mnInvisibleHell;
+    SdrLayerID mnInvisibleControls;
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/core/layout/anchoredobject.cxx b/sw/source/core/layout/anchoredobject.cxx
index cd45f56..a97fa82 100644
--- a/sw/source/core/layout/anchoredobject.cxx
+++ b/sw/source/core/layout/anchoredobject.cxx
@@ -21,6 +21,7 @@
 #include <fmtornt.hxx>
 #include <doc.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include <fmtsrnd.hxx>
 #include <dcontact.hxx>
 #include <editeng/ulspitem.hxx>
@@ -783,7 +784,7 @@ SwTxtFrm* SwAnchoredObject::FindAnchorCharFrm()
 */
 bool SwAnchoredObject::IsFormatPossible() const
 {
-    return GetFrmFmt().GetDoc()->IsVisibleLayerId( GetDrawObj()->GetLayer() );
+    return GetFrmFmt().GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetDrawObj()->GetLayer() );
 }
 
 // --> #i3317#
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 28671ea..7a7441e 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -50,6 +50,7 @@
 #include <fmtfollowtextflow.hxx>
 #include <switerator.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 
 bool SwFlowFrm::m_bMoveBwdJump = false;
 
@@ -1047,7 +1048,7 @@ bool SwFlowFrm::IsPrevObjMove() const
             // OD 2004-01-20 #110582# - do not consider hidden objects
             // #i26945# - do not consider object, which
             // doesn't follow the text flow.
-            if ( pObj->GetFrmFmt().GetDoc()->IsVisibleLayerId(
+            if ( pObj->GetFrmFmt().GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(
                                             pObj->GetDrawObj()->GetLayer() ) &&
                  pObj->GetFrmFmt().GetFollowTextFlow().GetValue() )
             {
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index f4082f1..513efae 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -23,6 +23,7 @@
 #include <doc.hxx>
 #include <IDocumentUndoRedo.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include "frmtool.hxx"
 #include "dflyobj.hxx"
 #include "hints.hxx"
@@ -302,7 +303,7 @@ bool SwOszControl::ChkOsz()
 |*/
 void SwFlyAtCntFrm::MakeAll()
 {
-    if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
+    if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
     {
         return;
     }
@@ -473,7 +474,7 @@ void SwFlyAtCntFrm::MakeAll()
                       !bConsiderWrapInfluenceDueToOverlapPrevCol &&
                       // #i40444#
                       !bConsiderWrapInfluenceDueToMovedFwdAnchor &&
-                      GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
+                      GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) );
 
             // #i3317# - instead of attribute change apply
             // temporarly the 'straightforward positioning process'.
diff --git a/sw/source/core/layout/flyincnt.cxx b/sw/source/core/layout/flyincnt.cxx
index 422e7d7..3f0bc43 100644
--- a/sw/source/core/layout/flyincnt.cxx
+++ b/sw/source/core/layout/flyincnt.cxx
@@ -25,6 +25,7 @@
 #include "flyfrms.hxx"
 #include <dflyobj.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 
 SwFlyInCntFrm::SwFlyInCntFrm( SwFlyFrmFmt *pFmt, SwFrm* pSib, SwFrm *pAnch ) :
     SwFlyFrm( pFmt, pSib, pAnch )
@@ -199,7 +200,7 @@ void SwFlyInCntFrm::RegistFlys()
 void SwFlyInCntFrm::MakeAll()
 {
     // OD 2004-01-19 #110582#
-    if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
+    if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
     {
         return;
     }
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 15a694b..d5487dd 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -39,6 +39,7 @@
 #include <sortedobjs.hxx>
 #include <viewimp.hxx>
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 
 using namespace ::com::sun::star;
 
@@ -95,7 +96,7 @@ void SwFlyFreeFrm::NotifyBackground( SwPageFrm *pPageFrm,
 
 void SwFlyFreeFrm::MakeAll()
 {
-    if ( !GetFmt()->GetDoc()->IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
+    if ( !GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( GetVirtDrawObj()->GetLayer() ) )
     {
         return;
     }
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 663affd..78e8c85 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -45,6 +45,7 @@
 #include "flyfrm.hxx"
 #include "doc.hxx"
 #include <IDocumentSettingAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 #include "fesh.hxx"
 #include "dview.hxx"
 #include "dflyobj.hxx"
@@ -1327,7 +1328,7 @@ void SwRootFrm::RemoveSuperfluous()
                 // #i28701#
                 SwAnchoredObject* pAnchoredObj = rObjs[i];
                 // OD 2004-01-19 #110582# - do not consider hidden objects
-                if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId(
+                if ( pPage->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(
                                     pAnchoredObj->GetDrawObj()->GetLayer() ) &&
                      !pAnchoredObj->GetAnchorFrm()->FindFooterOrHeader() )
                 {
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 3133080..a8dbaa8 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -70,6 +70,7 @@
 #include <svx/sdr/contact/viewcontact.hxx>
 #include <DocumentSettingManager.hxx>
 #include <IDocumentDeviceAccess.hxx>
+#include <IDocumentDrawModelAccess.hxx>
 
 #include <ndole.hxx>
 #include <svx/charthelper.hxx>
@@ -3331,7 +3332,7 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
                 {
                     // OD 29.08.2002 #102450# - add 3rd parameter
                     // OD 09.12.2002 #103045# - add 4th parameter for horizontal text direction.
-                    pSh->Imp()->PaintLayer( pSh->GetDoc()->GetHeavenId(),
+                    pSh->Imp()->PaintLayer( pSh->GetDoc()->getIDocumentDrawModelAccess().GetHeavenId(),
                                             pPrintData,
                                             pPage->Frm(),
                                             &aPageBackgrdColor,
@@ -6665,7 +6666,7 @@ void SwLayoutFrm::RefreshLaySubsidiary( const SwPageFrm *pPage,
                 for ( sal_uInt32 i = 0; i < rObjs.Count(); ++i )
                 {
                     const SwAnchoredObject* pAnchoredObj = rObjs[i];
-                    if ( pPage->GetFmt()->GetDoc()->IsVisibleLayerId(
+                    if ( pPage->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId(
                                     pAnchoredObj->GetDrawObj()->GetLayer() ) &&
                          pAnchoredObj->ISA(SwFlyFrm) )
                     {
@@ -6755,7 +6756,7 @@ static void lcl_RefreshLine( const SwLayoutFrm *pLay,
             // OD 2004-02-12 #110582#-2 - do *not* consider fly frame, which
             // belongs to a invisible layer
             if ( pFly->IsBackgroundTransparent() ||
-                 !pFly->GetFmt()->GetDoc()->IsVisibleLayerId( pObj->GetLayer() ) )
+                 !pFly->GetFmt()->GetDoc()->getIDocumentDrawModelAccess().IsVisibleLayerId( pObj->GetLayer() ) )
             {
                 aIter.Next();
                 continue;
diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx
index 4959028..9f6c498 100644
--- a/sw/source/core/undo/docundo.cxx
+++ b/sw/source/core/undo/docundo.cxx
@@ -35,6 +35,7 @@
 #include <editsh.hxx>
 #include <unobaseclass.hxx>
 #include <limits>
+#include <IDocumentDrawModelAccess.hxx>
 
 using namespace ::com::sun::star;
 
diff --git a/sw/source/core/undo/unattr.cxx b/sw/source/core/undo/unattr.cxx
index e716b35..c454ac9 100644

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list