Resolves: #i121448# Aligned default fill color/line style for all apps

(cherry picked from commit 81664c037c8d6094b66c1660b6eee9693eadf401)

Conflicts:
	sc/inc/document.hxx
	sc/source/core/data/documen2.cxx
	sc/source/core/data/documen3.cxx
	sc/source/core/data/documen9.cxx
	svx/inc/svx/svdmodel.hxx
	svx/source/svdraw/svdmodel.cxx
	sw/inc/doc.hxx
	sw/source/core/doc/docdraw.cxx
	sw/source/core/doc/docnew.cxx
	sw/source/ui/app/docshini.cxx

Change-Id: Id0f62f0cd5b83794e2dbaee4e8b6afa704a0c23a
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index d57c992..3a078bf 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -679,8 +679,6 @@ public:
        This returns false if undo was disabled using EnableUndo( false ) and
        also during the runtime of the Undo() and Redo() methods. */
    bool IsUndoEnabled() const;

    void SetDrawingLayerPoolDefaults();
};

typedef tools::WeakReference< SdrModel > SdrModelWeakRef;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 2b7490e..11a18e9 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -394,7 +394,6 @@ private:

    sal_uInt8               nAsianCompression;
    sal_uInt8               nAsianKerning;
    bool                bSetDrawDefaults;

    bool                bPastingDrawFromOtherDoc;

@@ -457,8 +456,6 @@ public:
    SC_DLLPUBLIC void       GetLanguage( LanguageType& rLatin, LanguageType& rCjk, LanguageType& rCtl ) const;
    void                    SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageType eCtl );

    void                    SetDrawDefaults();

    void                        SetConsolidateDlgData( const ScConsolidateParam* pData );
    const ScConsolidateParam*   GetConsolidateDlgData() const { return pConsolidateDlgData; }

@@ -2001,7 +1998,6 @@ private: // CLOOK-Impl-methods

    void    UpdateDrawPrinter();
    void    UpdateDrawLanguages();
    void    UpdateDrawDefaults();
    SC_DLLPUBLIC void   InitClipPtrs( ScDocument* pSourceDoc );

    void    LoadDdeLinks(SvStream& rStream);
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 1d63dd9..bc9a5af 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -197,7 +197,6 @@ ScDocument::ScDocument( ScDocumentMode  eMode,
        nVisSpellState( 0 ),
        nAsianCompression(SC_ASIANCOMPRESSION_INVALID),
        nAsianKerning(SC_ASIANKERNING_INVALID),
        bSetDrawDefaults( false ),
        bPastingDrawFromOtherDoc( false ),
        nInDdeLinkUpdate( 0 ),
        bInUnoBroadcast( false ),
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 1b64286..3c20d73 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1889,12 +1889,6 @@ void ScDocument::SetLanguage( LanguageType eLatin, LanguageType eCjk, LanguageTy
    UpdateDrawLanguages();      // set edit engine defaults in drawing layer pool
}

void ScDocument::SetDrawDefaults()
{
    bSetDrawDefaults = true;
    UpdateDrawDefaults();
}

Rectangle ScDocument::GetMMRect( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCTAB nTab, bool bHiddenAsZero ) const
{
    if (!ValidTab(nTab) || nTab >= static_cast<SCTAB>(maTabs.size()) || !maTabs[nTab])
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 50195ae..d081379 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -157,7 +157,11 @@ void ScDocument::InitDrawLayer( SfxObjectShell* pDocShell )
        pDrawLayer->SetDefaultTabulator( GetDocOptions().GetTabDistance() );

        UpdateDrawPrinter();
        UpdateDrawDefaults();

        // set draw defaults directly
        SfxItemPool& rDrawPool = pDrawLayer->GetItemPool();
        rDrawPool.SetPoolDefaultItem( SvxAutoKernItem( sal_True, EE_CHAR_PAIRKERNING ) );

        UpdateDrawLanguages();
        if (bImportingXML)
            pDrawLayer->EnableAdjust(false);
@@ -179,18 +183,6 @@ void ScDocument::UpdateDrawLanguages()
    }
}

void ScDocument::UpdateDrawDefaults()
{
    // drawing layer defaults that are set for new documents (if InitNew was called)

    if ( pDrawLayer && bSetDrawDefaults )
    {
        SfxItemPool& rDrawPool = pDrawLayer->GetItemPool();
        rDrawPool.SetPoolDefaultItem( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) );
        pDrawLayer->SetDrawingLayerPoolDefaults();
    }
}

void ScDocument::UpdateDrawPrinter()
{
    if (pDrawLayer)
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index 7f5ea07..f206a9d 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -53,8 +53,6 @@ sal_Bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor )
        SetVisAreaOrSize( Rectangle( Point(), aSize ), sal_True );
    }

    aDocument.SetDrawDefaults();        // drawing layer defaults that are set only in InitNew

    // InitOptions sets the document languages, must be called before CreateStandardStyles
    InitOptions(false);

diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 9c998a3..d3ee527 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -252,7 +252,6 @@ 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/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index a184de7..f62bd32 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -2072,18 +2072,6 @@ 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 677c2b8..f36ffd6 100644
--- a/svx/source/xoutdev/xpool.cxx
+++ b/svx/source/xoutdev/xpool.cxx
@@ -41,11 +41,11 @@ XOutdevItemPool::XOutdevItemPool(
    const XubString aNullStr;
    const Graphic aNullGraphic;
    const basegfx::B2DPolyPolygon aNullPol;
    const Color aNullLineCol(RGB_Color(COL_BLACK));
    const Color aNullFillCol(RGB_COLORDATA( 153, 204, 255 ));
    const Color aNullLineCol(COL_DEFAULT_SHAPE_STROKE); // #i121448# Use defined default color
    const Color aNullFillCol(COL_DEFAULT_SHAPE_FILLING); // #i121448# Use defined default color
    const Color aNullShadowCol(RGB_Color(COL_LIGHTGRAY));
    const XDash aNullDash;
    const XGradient aNullGrad(aNullLineCol, RGB_Color(COL_WHITE));
    const XGradient aNullGrad(RGB_Color(COL_BLACK), RGB_Color(COL_WHITE));
    const XHatch aNullHatch(aNullLineCol);

    // get master pointer, evtl. add myself to the end of the pools
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index c41615b..ee66745 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -595,8 +595,6 @@ private:

    bool mbStartIdleTimer;                    ///< idle timer mode start/stop

    bool mbSetDrawDefaults;                   ///< set draw pool defaults for freshly created documents

    static SwAutoCompleteWord *mpACmpltWords;  ///< List of all words for AutoComplete

    //---------------- private methods ------------------------------
@@ -2080,12 +2078,7 @@ public:
     */
    void dumpAsXml( xmlTextWriterPtr writer = NULL );

    /// 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();
    /// Copies master header to left / first one, if necessary - used by ChgPageDesc().
    void CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead, SwPageDesc *pDesc, bool bLeft);
    /// Copies master footer to left / first one, if necessary - used by ChgPageDesc().
diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx
index 7419baf..4ee34a6 100644
--- a/sw/source/core/doc/docdraw.cxx
+++ b/sw/source/core/doc/docdraw.cxx
@@ -627,8 +627,6 @@ void SwDoc::InitDrawModel()
            pViewSh = (ViewShell*)pViewSh->GetNext();
        }while( pViewSh != mpCurrentView );
    }

    UpdateDrawDefaults();
}

/** method to notify drawing page view about the invisible layers */
@@ -978,17 +976,4 @@ 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 ( mpDrawModel && mbSetDrawDefaults )
        mpDrawModel->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 9835e6d..88707bb 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -319,8 +319,7 @@ SwDoc::SwDoc()

    // COMPATIBILITY FLAGS END

    mbStartIdleTimer(false),
    mbSetDrawDefaults(false)
    mbStartIdleTimer(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 2dc1dd2..58d77b9 100644
--- a/sw/source/ui/app/docshini.cxx
+++ b/sw/source/ui/app/docshini.cxx
@@ -307,8 +307,6 @@ 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 <SetDefault(..)>
    // at the document instance, the document is modified. Thus, reset this
    // status here. Note: In method <SubInitNew()> this is also done.