From b97726f4b66aa85db8cb2ab27b8413066930cf4f Mon Sep 17 00:00:00 2001 From: Christian Lippka ORACLE Date: Tue, 6 Dec 2011 03:27:48 +0100 Subject: impress210: #i117133# put new drawing layer fill and stroke styles in pool only for newly created documents # HG changeset patch # User Christian Lippka ORACLE # Date 1299763312 -3600 # Node ID 6b1140cdac81a77836e5be80033f328a0956c94a # Parent 8edc33ef50a3b6ebbc4e88d574b6b1ba57b1dbaa impress210: #i117133# put new drawing layer fill and stroke styles in pool only for newly created documents --- sc/source/core/data/documen9.cxx | 1 + sd/source/ui/docshell/docshel4.cxx | 1 + svx/inc/svx/svdmodel.hxx | 1 + svx/source/svdraw/svdmodel.cxx | 15 +++++++++++++++ svx/source/xoutdev/xpool.cxx | 4 ++-- sw/inc/doc.hxx | 9 +++++++++ sw/source/core/doc/docdraw.cxx | 15 +++++++++++++++ sw/source/core/doc/docnew.cxx | 3 ++- sw/source/ui/app/docshini.cxx | 2 ++ 9 files changed, 48 insertions(+), 3 deletions(-) diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx index bb374343d7ff..b8cca4c9f52e 100644 --- a/sc/source/core/data/documen9.cxx +++ b/sc/source/core/data/documen9.cxx @@ -198,6 +198,7 @@ void ScDocument::UpdateDrawDefaults() { SfxItemPool& rDrawPool = pDrawLayer->GetItemPool(); rDrawPool.SetPoolDefaultItem( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) ); + pDrawLayer->SetDrawingLayerPoolDefaults(); } } diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx index a63a72848feb..a486f56244fa 100644 --- a/sd/source/ui/docshell/docshel4.cxx +++ b/sd/source/ui/docshell/docshel4.cxx @@ -269,6 +269,7 @@ sal_Bool DrawDocShell::InitNew( const ::com::sun::star::uno::Reference< ::com::s if (bRet) { + mpDoc->SetDrawingLayerPoolDefaults(); if( !mbSdDataObj ) mpDoc->NewOrLoadCompleted(NEW_DOC); // otherwise calling // NewOrLoadCompleted(NEW_LOADED) in diff --git a/svx/inc/svx/svdmodel.hxx b/svx/inc/svx/svdmodel.hxx index 567c821e5f4e..2b74913f2d99 100644 --- a/svx/inc/svx/svdmodel.hxx +++ b/svx/inc/svx/svdmodel.hxx @@ -693,6 +693,7 @@ public: also during the runtime of the Undo() and Redo() methods. */ bool IsUndoEnabled() const; + void SetDrawingLayerPoolDefaults(); }; typedef tools::WeakReference< SdrModel > SdrModelWeakRef; diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 20f19d5427be..b387f4c14a69 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -74,6 +74,9 @@ #include "svx/svdstr.hrc" // object's name #include "svdoutlinercache.hxx" +#include "svx/xflclit.hxx" +#include "svx/xflhtit.hxx" +#include "svx/xlnclit.hxx" #include #include "editeng/fontitem.hxx" @@ -2054,6 +2057,18 @@ const ::com::sun::star::uno::Sequence< sal_Int8 >& SdrModel::getUnoTunnelImpleme return theSdrModelUnoTunnelImplementationId::get().getSeq(); } +void SdrModel::SetDrawingLayerPoolDefaults() +{ + const String aNullStr; + const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); + const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); + const XHatch aNullHatch(aNullLineCol); + + pItemPool->SetPoolDefaultItem( XFillColorItem(aNullStr,aNullFillCol) ); + pItemPool->SetPoolDefaultItem( XFillHatchItem(pItemPool,aNullHatch) ); + pItemPool->SetPoolDefaultItem( XLineColorItem(aNullStr,aNullLineCol) ); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// TYPEINIT1(SdrHint,SfxHint); diff --git a/svx/source/xoutdev/xpool.cxx b/svx/source/xoutdev/xpool.cxx index 25a04473b4c2..343408302313 100644 --- a/svx/source/xoutdev/xpool.cxx +++ b/svx/source/xoutdev/xpool.cxx @@ -51,8 +51,8 @@ XOutdevItemPool::XOutdevItemPool( const XubString aNullStr; const Bitmap aNullBmp; const basegfx::B2DPolyPolygon aNullPol; - const Color aNullLineCol(RGB_Color(COL_DEFAULT_SHAPE_STROKE)); - const Color aNullFillCol(RGB_Color(COL_DEFAULT_SHAPE_FILLING)); + const Color aNullLineCol(RGB_Color(COL_BLACK)); + const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 )); const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY)); const XDash aNullDash; const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE)); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 7bd5e2dd9abe..b891b4ec85d1 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -591,6 +591,8 @@ private: sal_Bool mbStartIdleTimer; // idle timer mode start/stop + bool mbSetDrawDefaults; // set draw pool defaults for freshly created documents + static SwAutoCompleteWord *pACmpltWords; // List of all words for AutoComplete //---------------- private methods ------------------------------ @@ -2043,6 +2045,13 @@ public: */ void dumpAsXml( xmlTextWriterPtr writer = NULL ); #endif + + /// must be called only in SwDocShell::InitNew, causes UpdateDrawDefaults to be called when drawing layer is created + void SetDrawDefaults(); + +private: + /// method to set new graphics pool defaults, must only be called by SetDrawDefaults! + void UpdateDrawDefaults(); }; // This method is called in Dtor of SwDoc and deletes cache of ContourObjects. diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 75c90adf81e9..2d5671c41f73 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -658,6 +658,8 @@ void SwDoc::InitDrawModel() pViewSh = (ViewShell*)pViewSh->GetNext(); }while( pViewSh != pCurrentView ); } + + UpdateDrawDefaults(); } /** method to notify drawing page view about the invisible layers */ @@ -1034,4 +1036,17 @@ namespace docfunc } } +void SwDoc::SetDrawDefaults() +{ + mbSetDrawDefaults = true; + UpdateDrawDefaults(); +} + +void SwDoc::UpdateDrawDefaults() +{ + // drawing layer defaults that are set for new documents (if InitNew was called) + if ( pDrawModel && mbSetDrawDefaults ) + pDrawModel->SetDrawingLayerPoolDefaults(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 9587561953ad..cba769405977 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -279,7 +279,8 @@ SwDoc::SwDoc() mbLastBrowseMode( false ), n32DummyCompatabilityOptions1(0), n32DummyCompatabilityOptions2(0), - mbStartIdleTimer(sal_False) + mbStartIdleTimer(sal_False), + mbSetDrawDefaults(false) { RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722", "SwDoc::SwDoc" ); diff --git a/sw/source/ui/app/docshini.cxx b/sw/source/ui/app/docshini.cxx index 98eb84865095..8321abd82adc 100644 --- a/sw/source/ui/app/docshini.cxx +++ b/sw/source/ui/app/docshini.cxx @@ -339,6 +339,8 @@ sal_Bool SwDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) //#i16874# AutoKerning as default for new documents pDoc->SetDefault( SvxAutoKernItem( sal_True, RES_CHRATR_AUTOKERN ) ); + pDoc->SetDrawDefaults(); + // #i42080# - Due to the several calls of method // at the document instance, the document is modified. Thus, reset this // status here. Note: In method this is also done. -- cgit