summaryrefslogtreecommitdiff
path: root/sw/source/uibase/app/docshdrw.cxx
diff options
context:
space:
mode:
authorArmin Le Grand <alg@apache.org>2014-06-05 08:44:38 +0000
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-07-01 13:30:10 +0200
commit378dc6ef20ffd0e657d78dbf6646d48059be4045 (patch)
treed4e50dfd3b492b8433f04da848fe0f7fd2f75859 /sw/source/uibase/app/docshdrw.cxx
parentc3f70303cf3725cfd64d3b07c0e7e895f8ac629d (diff)
Related: #i124638# Corrected relationship between DrawModel and...
DocShell in Writer, made SwDrawModel and handling more known (includes suspicious removal of setting SID_ATTR_LINEEND_WIDTH_DEFAULT) (cherry picked from commit a7ccadbf3b1ac378ca15d3630d48f48734700e5c) Conflicts: sw/inc/IDocumentDrawModelAccess.hxx sw/inc/doc.hxx sw/inc/docsh.hxx sw/inc/dpage.hxx sw/inc/drawdoc.hxx sw/source/core/access/accmap.cxx sw/source/core/doc/doc.cxx sw/source/core/doc/docdesc.cxx sw/source/core/doc/docdraw.cxx sw/source/core/doc/docfly.cxx sw/source/core/doc/doclay.cxx sw/source/core/doc/docnew.cxx sw/source/core/draw/dcontact.cxx sw/source/core/draw/dpage.cxx sw/source/core/draw/drawdoc.cxx sw/source/core/frmedt/feshview.cxx sw/source/core/layout/fly.cxx sw/source/core/layout/frmtool.cxx sw/source/core/layout/newfrm.cxx sw/source/core/layout/paintfrm.cxx sw/source/core/undo/docundo.cxx sw/source/core/undo/unattr.cxx sw/source/core/unocore/unodraw.cxx sw/source/core/unocore/unoframe.cxx sw/source/core/view/vdraw.cxx sw/source/core/view/viewimp.cxx sw/source/core/view/viewsh.cxx sw/source/filter/html/htmldrawreader.cxx sw/source/filter/rtf/rtffly.cxx sw/source/filter/rtf/swparrtf.cxx sw/source/filter/ww8/docxattributeoutput.cxx sw/source/filter/ww8/rtfattributeoutput.cxx sw/source/filter/ww8/wrtw8esh.cxx sw/source/filter/ww8/wrtww8.cxx sw/source/filter/ww8/ww8graf.cxx sw/source/filter/xml/swxml.cxx sw/source/filter/xml/xmlexp.cxx sw/source/filter/xml/xmlimp.cxx sw/source/ui/app/docshdrw.cxx sw/source/ui/uiview/view.cxx sw/source/ui/uno/unodefaults.cxx sw/source/uibase/app/docst.cxx sw/source/uibase/app/docstyle.cxx sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx sw/source/uibase/lingu/sdrhhcwrap.cxx sw/source/uibase/shells/drwbassh.cxx sw/source/uibase/shells/frmsh.cxx sw/source/uibase/shells/grfsh.cxx sw/source/uibase/shells/textsh1.cxx sw/source/uibase/uno/unotxdoc.cxx sw/source/uibase/utlui/content.cxx Conflicts: sw/source/uibase/app/docshdrw.cxx Change-Id: Icb99eaa7bfb1eb8922a9fd928b5e4149821130dd
Diffstat (limited to 'sw/source/uibase/app/docshdrw.cxx')
-rw-r--r--sw/source/uibase/app/docshdrw.cxx66
1 files changed, 50 insertions, 16 deletions
diff --git a/sw/source/uibase/app/docshdrw.cxx b/sw/source/uibase/app/docshdrw.cxx
index f24a98dc63b1..2fcfac178864 100644
--- a/sw/source/uibase/app/docshdrw.cxx
+++ b/sw/source/uibase/app/docshdrw.cxx
@@ -33,25 +33,59 @@
using namespace ::com::sun::star;
// Load Document
-void SwDocShell::InitDraw()
+void InitDrawModelAndDocShell(SwDocShell* pSwDocShell, SwDrawModel* pSwDrawDocument)
{
- SdrModel *pDrDoc = mpDoc->getIDocumentDrawModelAccess().GetDrawModel();
- if( pDrDoc )
+ if(pSwDrawDocument)
{
- // create Lists and Tables DocShell's ItemSet
- PutItem( SvxGradientListItem( pDrDoc->GetGradientList(), SID_GRADIENT_LIST ) );
- PutItem( SvxHatchListItem( pDrDoc->GetHatchList(), SID_HATCH_LIST ) );
- PutItem( SvxBitmapListItem( pDrDoc->GetBitmapList(), SID_BITMAP_LIST ) );
- PutItem( SvxDashListItem( pDrDoc->GetDashList(), SID_DASH_LIST ) );
- PutItem( SvxLineEndListItem( pDrDoc->GetLineEndList(), SID_LINEEND_LIST ) );
- PutItem( SvxColorListItem( pDrDoc->GetColorList(), SID_COLOR_TABLE ));
-
- 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 SvxColorListItem* pColItemFromDocShell = static_cast< const SvxColorListItem* >(pSwDocShell->GetItem(SID_COLOR_TABLE));
+
+ if(pColItemFromDocShell)
+ {
+ // the DocShell has a ColorTable, use it also in DrawingLayer
+ XColorListRef xCol(pColItemFromDocShell->GetColorList());
+ pSwDrawDocument->SetPropertyList(static_cast<XPropertyList*>(xCol.get()));
+ }
+ else
+ {
+ // Use the ColorTable which is used at the DrawingLayer's SdrModel
+ pSwDocShell->PutItem(SvxColorListItem(pSwDrawDocument->GetColorList(), SID_COLOR_TABLE));
+ }
+
+ // add other tables in SfxItemSet of the DocShell
+ pSwDocShell->PutItem(SvxGradientListItem(pSwDrawDocument->GetGradientList(), SID_GRADIENT_LIST));
+ pSwDocShell->PutItem(SvxHatchListItem(pSwDrawDocument->GetHatchList(), SID_HATCH_LIST));
+ pSwDocShell->PutItem(SvxBitmapListItem(pSwDrawDocument->GetBitmapList(), SID_BITMAP_LIST));
+ pSwDocShell->PutItem(SvxDashListItem(pSwDrawDocument->GetDashList(), SID_DASH_LIST));
+ pSwDocShell->PutItem(SvxLineEndListItem(pSwDrawDocument->GetLineEndList(), 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(SvxColorListItem(XColorList::GetStdColorList(), SID_COLOR_TABLE));
}
- else
- PutItem( SvxColorListItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ));
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */