diff options
Diffstat (limited to 'sw/source/ui/app/docshdrw.cxx')
-rw-r--r-- | sw/source/ui/app/docshdrw.cxx | 86 |
1 files changed, 51 insertions, 35 deletions
diff --git a/sw/source/ui/app/docshdrw.cxx b/sw/source/ui/app/docshdrw.cxx index a3764be9a45a..2f1093d7ded7 100644 --- a/sw/source/ui/app/docshdrw.cxx +++ b/sw/source/ui/app/docshdrw.cxx @@ -19,36 +19,20 @@ * *************************************************************/ - - // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_sw.hxx" - #include <hintids.hxx> - -#ifndef _SVX_SVXIDS_HRC //autogen #include <svx/svxids.hrc> -#endif - - - - - - - - #include <svl/stritem.hxx> #include <svx/drawitem.hxx> #include <svx/svdmodel.hxx> #include <svx/svdoutl.hxx> #include <svx/xtable.hxx> - -#ifndef _DOCSH_HXX #include <docsh.hxx> -#endif #include <doc.hxx> #include <svx/fmmodel.hxx> +#include <drawdoc.hxx> using namespace ::com::sun::star; @@ -56,26 +40,58 @@ using namespace ::com::sun::star; Beschreibung: Document laden --------------------------------------------------------------------*/ - -void SwDocShell::InitDraw() +void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocument) { - SdrModel *pDrDoc = pDoc->GetDrawModel(); - if( pDrDoc ) + if(pSwDrawDocument) { - // Listen, bzw. Tables im ItemSet der DocShell anlegen - PutItem( SvxGradientListItem( pDrDoc->GetGradientListFromSdrModel(), SID_GRADIENT_LIST ) ); - PutItem( SvxHatchListItem( pDrDoc->GetHatchListFromSdrModel(), SID_HATCH_LIST ) ); - PutItem( SvxBitmapListItem( pDrDoc->GetBitmapListFromSdrModel(), SID_BITMAP_LIST ) ); - PutItem( SvxDashListItem( pDrDoc->GetDashListFromSdrModel(), SID_DASH_LIST ) ); - PutItem( SvxLineEndListItem( pDrDoc->GetLineEndListFromSdrModel(), SID_LINEEND_LIST ) ); - - Outliner& rOutliner = pDrDoc->GetDrawOutliner(); - uno::Reference<linguistic2::XHyphenator> xHyphenator( ::GetHyphenator() ); - rOutliner.SetHyphenator( xHyphenator ); + if(pSwDocShell == pSwDrawDocument->GetObjectShell()) + { + // association already done, nothing to do + } + else + { + // set object shell (mainly for FormControl stuff), maybe zero + pSwDrawDocument->SetObjectShell(pSwDocShell); + + // set persist, maybe zero + pSwDrawDocument->SetPersist(pSwDocShell); + + // get and decide on the color table to use + if(pSwDocShell) + { + const SvxColorTableItem* pColItemFromDocShell = static_cast< const SvxColorTableItem* >(pSwDocShell->GetItem(SID_COLOR_TABLE)); + + if(pColItemFromDocShell) + { + // the DocShell has a ColorTable, use it also in DrawingLayer + pSwDrawDocument->SetColorTableAtSdrModel(pColItemFromDocShell->GetColorTable()); + } + else + { + // Use the ColorTable which is used at the DrawingLayer's SdrModel + pSwDocShell->PutItem(SvxColorTableItem(pSwDrawDocument->GetColorTableFromSdrModel(), SID_COLOR_TABLE)); + } + + // add other tables in SfxItemSet of the DocShell + pSwDocShell->PutItem(SvxGradientListItem(pSwDrawDocument->GetGradientListFromSdrModel(), SID_GRADIENT_LIST)); + pSwDocShell->PutItem(SvxHatchListItem(pSwDrawDocument->GetHatchListFromSdrModel(), SID_HATCH_LIST)); + pSwDocShell->PutItem(SvxBitmapListItem(pSwDrawDocument->GetBitmapListFromSdrModel(), SID_BITMAP_LIST)); + pSwDocShell->PutItem(SvxDashListItem(pSwDrawDocument->GetDashListFromSdrModel(), SID_DASH_LIST)); + pSwDocShell->PutItem(SvxLineEndListItem(pSwDrawDocument->GetLineEndListFromSdrModel(), SID_LINEEND_LIST)); + } + + // init hyphenator for DrawingLayer outliner + uno::Reference<linguistic2::XHyphenator> xHyphenator(::GetHyphenator()); + Outliner& rOutliner = pSwDrawDocument->GetDrawOutliner(); + + rOutliner.SetHyphenator(xHyphenator); + } + } + else if(pSwDocShell) + { + // fallback: add the default color list to have one when someone requests it from the DocShell + pSwDocShell->PutItem(SvxColorTableItem(XColorList::GetStdColorList(), SID_COLOR_TABLE)); } - else - PutItem( SvxColorTableItem( XColorList::GetStdColorList(), SID_COLOR_TABLE )); } - - +//eof |