[Libreoffice-commits] .: 3 commits - sc/inc sc/source xmloff/inc xmloff/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Thu May 24 03:40:44 PDT 2012


 sc/inc/colorscale.hxx                     |    1 
 sc/inc/document.hxx                       |   19 +---
 sc/inc/fmtuno.hxx                         |    2 
 sc/inc/table.hxx                          |   17 +++
 sc/source/core/data/attarray.cxx          |   12 +-
 sc/source/core/data/colorscale.cxx        |    5 +
 sc/source/core/data/conditio.cxx          |    2 
 sc/source/core/data/documen2.cxx          |   26 ------
 sc/source/core/data/documen3.cxx          |    4 
 sc/source/core/data/documen4.cxx          |   82 ++++++++-----------
 sc/source/core/data/documen7.cxx          |  101 +++++++++++++++--------
 sc/source/core/data/document.cxx          |   23 -----
 sc/source/core/data/fillinfo.cxx          |    6 -
 sc/source/core/data/patattr.cxx           |   34 -------
 sc/source/core/data/table1.cxx            |   79 ++++++++++++++++++
 sc/source/core/data/table2.cxx            |   24 +++--
 sc/source/filter/excel/xecontent.cxx      |   14 +--
 sc/source/filter/excel/xestyle.cxx        |  128 +++++++++++++++---------------
 sc/source/filter/excel/xicontent.cxx      |    2 
 sc/source/filter/oox/condformatbuffer.cxx |    4 
 sc/source/filter/xml/xmlexprt.cxx         |  117 +++++++++++++++++++++++++++
 sc/source/filter/xml/xmlexprt.hxx         |    3 
 sc/source/ui/docshell/docsh4.cxx          |    9 +-
 sc/source/ui/inc/refundo.hxx              |    2 
 sc/source/ui/undo/refundo.cxx             |   14 ---
 sc/source/ui/unoobj/cellsuno.cxx          |    6 -
 sc/source/ui/unoobj/fmtuno.cxx            |    4 
 sc/source/ui/view/viewfun2.cxx            |    2 
 xmloff/inc/xmloff/xmlnmspe.hxx            |    3 
 xmloff/inc/xmloff/xmltoken.hxx            |   11 ++
 xmloff/source/core/xmlexp.cxx             |    3 
 xmloff/source/core/xmltoken.cxx           |   11 ++
 32 files changed, 474 insertions(+), 296 deletions(-)

New commits:
commit f18a242966d3fd25ec0832c09ce7164bdae7ba2d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Thu May 24 12:37:39 2012 +0200

    use correct namespace for calc odf extensions
    
    Change-Id: I6e0feab7e1d649fbf4dafb9f06d57f68e9a4b934

diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index a572a08..9c1b3bd 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -3820,17 +3820,17 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
     ScColorFormatList* pColorFormatList = pDoc->GetColorScaleList(nTab);
     if(pCondFormatList || pColorFormatList)
     {
-        SvXMLElementExport aElementCondFormats(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMATS, true, true);
+        SvXMLElementExport aElementCondFormats(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, true, true);
 
         if(pCondFormatList)
         {
             for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin();
                     itr != pCondFormatList->end(); ++itr)
             {
-                SvXMLElementExport aElementCondFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true);
+                SvXMLElementExport aElementCondFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true);
                 rtl::OUString sRangeList;
                 //ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList, pDoc, FormulaGrammar::CONV_OOO );
-                AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
+                AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
             }
         }
 
@@ -3842,43 +3842,64 @@ void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
                 rtl::OUString sRangeList;
                 const ScRangeList& rRangeList = itr->GetRange();
                 ScRangeStringConverter::GetStringFromRangeList( sRangeList, &rRangeList, pDoc, FormulaGrammar::CONV_OOO );
-                AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
-                SvXMLElementExport aElementColFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true);
+                AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
+                SvXMLElementExport aElementColFormat(*this, XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, true, true);
 
                 if(itr->GetType() == COLORSCALE)
                 {
-                    SvXMLElementExport aElementColorScale(*this, XML_NP_TABLE_EXT, XML_COLOR_SCALE, true, true);
+                    SvXMLElementExport aElementColorScale(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, true, true);
+                    const ScColorScaleFormat& mrColorScale = static_cast<const ScColorScaleFormat&>(*itr);
+                    for(ScColorScaleFormat::const_iterator it = mrColorScale.begin();
+                            it != mrColorScale.end(); ++it)
+                    {
+                        if(it->GetFormula())
+                        {
+                            rtl::OUString sFormula;
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula);
+                        }
+                        else
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(it->GetValue()));
 
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*it));
+                        rtl::OUStringBuffer aBuffer;
+                        ::sax::Converter::convertColor(aBuffer, it->GetColor().GetColor());
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_COLOR, aBuffer.makeStringAndClear());
+                        SvXMLElementExport aElementColorScaleEntry(*this, XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, true, true);
+                    }
                 }
                 else if(itr->GetType() == DATABAR)
                 {
                     const ScDataBarFormatData* pFormatData = static_cast<const ScDataBarFormat&>(*itr).GetDataBarData();
                     if(!pFormatData->mbGradient)
-                        AddAttribute(XML_NP_TABLE_EXT, XML_GRADIENT, XML_FALSE);
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_FALSE);
                     rtl::OUStringBuffer aBuffer;
                     ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor.GetColor());
-                    AddAttribute(XML_NP_TABLE_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear());
-                    SvXMLElementExport aElementDataBar(*this, XML_NP_TABLE_EXT, XML_DATA_BAR, true, true);
+                    AddAttribute(XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear());
+                    SvXMLElementExport aElementDataBar(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, true, true);
 
-                    if(pFormatData->mpLowerLimit->GetFormula())
                     {
-                        rtl::OUString sFormula;
-                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula);
+                        if(pFormatData->mpLowerLimit->GetFormula())
+                        {
+                            rtl::OUString sFormula;
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula);
+                        }
+                        else
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue()));
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit));
+                        SvXMLElementExport aElementDataBarEntryLower(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true);
                     }
-                    else
-                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue()));
-                    AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit));
-                    SvXMLElementExport aElementDataBarEntryLower(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true);
 
-                    if(pFormatData->mpUpperLimit->GetFormula())
                     {
-                        rtl::OUString sFormula;
-                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula);
+                        if(pFormatData->mpUpperLimit->GetFormula())
+                        {
+                            rtl::OUString sFormula;
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, sFormula);
+                        }
+                        else
+                            AddAttribute(XML_NAMESPACE_CALC_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue()));
+                        AddAttribute(XML_NAMESPACE_CALC_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit));
+                        SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, true, true);
                     }
-                    else
-                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue()));
-                    AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit));
-                    SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true);
                 }
             }
         }
diff --git a/xmloff/inc/xmloff/xmlnmspe.hxx b/xmloff/inc/xmloff/xmlnmspe.hxx
index 2f4615d..0d222da 100644
--- a/xmloff/inc/xmloff/xmlnmspe.hxx
+++ b/xmloff/inc/xmloff/xmlnmspe.hxx
@@ -90,8 +90,9 @@ XML_NAMESPACE_EXT( OFFICE,      37U )
 XML_NAMESPACE_EXT( TABLE,       38U )
 XML_NAMESPACE_EXT( CHART,       39U )
 XML_NAMESPACE_EXT( DRAW,        40U )
+XML_NAMESPACE_EXT( CALC,        41U )
 
-#define _XML_OLD_NAMESPACE_BASE 41U
+#define _XML_OLD_NAMESPACE_BASE 42U
 
 // namespaces used in the technical preview (SO 5.2)
 XML_OLD_NAMESPACE( FO,      0U )
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index dd0529b..d47a93b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -160,6 +160,10 @@ namespace xmloff { namespace token {
         XML_NP_CSS3TEXT,
         XML_N_CSS3TEXT,
 
+        // calc extensions
+        XML_NP_CALC_EXT,
+        XML_N_CALC_EXT,
+
         // units
         XML_UNIT_MM,
         XML_UNIT_M,
@@ -426,6 +430,7 @@ namespace xmloff { namespace token {
         XML_COLOR_INVERSION,
         XML_COLOR_MODE,
         XML_COLOR_SCALE,
+        XML_COLOR_SCALE_ENTRY,
         XML_COLUMN,
         XML_COLUMN_COUNT,
         XML_COLUMN_GAP,
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index e70a24c..e9f80bb 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -374,6 +374,9 @@ void SvXMLExport::_InitCtor()
         {
             mpNamespaceMap->Add(
                 GetXMLToken(XML_NP_TABLE_EXT), GetXMLToken(XML_N_TABLE_EXT), XML_NAMESPACE_TABLE_EXT);
+            mpNamespaceMap->Add(
+                GetXMLToken(XML_NP_CALC_EXT), GetXMLToken(XML_N_CALC_EXT), XML_NAMESPACE_CALC_EXT);
+
         }
     }
     if( (getExportFlags() & (EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index d4e21b2..759926a 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -164,6 +164,10 @@ namespace xmloff { namespace token {
         TOKEN( "css3t",                        XML_NP_CSS3TEXT ),
         TOKEN( "http://www.w3.org/TR/css3-text/", XML_N_CSS3TEXT ),
 
+        // extension namespace for calc extensions
+        TOKEN( "calcext",                         XML_NP_CALC_EXT ),
+        TOKEN( "urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0", XML_N_CALC_EXT ),
+
         // units
         TOKEN( "mm",                              XML_UNIT_MM ),
         TOKEN( "m",                               XML_UNIT_M ),
@@ -430,6 +434,7 @@ namespace xmloff { namespace token {
         TOKEN( "color-inversion",                 XML_COLOR_INVERSION ),
         TOKEN( "color-mode",                      XML_COLOR_MODE ),
         TOKEN( "color-scale",                     XML_COLOR_SCALE ),
+        TOKEN( "color-scale-entry",               XML_COLOR_SCALE_ENTRY ),
         TOKEN( "column",                          XML_COLUMN ),
         TOKEN( "column-count",                    XML_COLUMN_COUNT ),
         TOKEN( "column-gap",                      XML_COLUMN_GAP ),
commit 655d61042f5b6130643d2dde3cd46e4e4d3bbb2b
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed May 23 01:14:47 2012 +0200

    make color formats and conditional formats a sheet property
    
    TODO:
    - UNO needs some love to accept this change
      - we need a new uno interface for conditional formats in 4.0
    - copy/paste
    - undo/redo
    
    Change-Id: I2c8a233888a95c7298dfb151d1c12b6a6a58520d

diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index ed8eb3b..20b47ab 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -245,8 +245,6 @@ private:
     VirtualDevice*      pVirtualDevice_100th_mm;
     ScDrawLayer*        pDrawLayer;                     // SdrModel
     rtl::Reference<XColorList> pColorList;
-    ScConditionalFormatList* pCondFormList;             // conditional formats
-    boost::scoped_ptr<ScColorFormatList> mpColorScaleList; //color scales
     ScValidationDataList* pValidationList;              // validity
     SvNumberFormatterIndexTable*    pFormatExchangeList;    // for application of number formats
     TableContainer maTabs;
@@ -1198,22 +1196,21 @@ public:
     void            ClearSelectionItems( const sal_uInt16* pWhich, const ScMarkData& rMark );
     void            ChangeSelectionIndent( bool bIncrement, const ScMarkData& rMark );
 
-    SC_DLLPUBLIC sal_uLong          AddCondFormat( const ScConditionalFormat& rNew );
-    SC_DLLPUBLIC sal_uLong          AddColorFormat( ScColorFormat* pNew );
-    SC_DLLPUBLIC void           FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges );
+    SC_DLLPUBLIC sal_uLong          AddCondFormat( const ScConditionalFormat& rNew, SCTAB nTab );
+    SC_DLLPUBLIC sal_uLong          AddColorFormat( ScColorFormat* pNew, SCTAB nTab );
+    SC_DLLPUBLIC void           FindConditionalFormat( sal_uLong nKey, SCTAB nTab, ScRangeList& rRanges );
     SC_DLLPUBLIC void           FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges, SCTAB nTab );
-    void            ConditionalChanged( sal_uLong nKey );
+    void            ConditionalChanged( sal_uLong nKey, SCTAB nTab );
 
     SC_DLLPUBLIC sal_uLong          AddValidationEntry( const ScValidationData& rNew );
 
     SC_DLLPUBLIC const ScValidationData*    GetValidationEntry( sal_uLong nIndex ) const;
 
-    ScConditionalFormatList* GetCondFormList() const        // Ref-Undo
-                    { return pCondFormList; }
-    void            SetCondFormList(ScConditionalFormatList* pNew);
+    SC_DLLPUBLIC ScConditionalFormatList* GetCondFormList( SCTAB nTab ) const;
+    void            SetCondFormList(ScConditionalFormatList* pNew, SCTAB nTab);
 
-    SC_DLLPUBLIC const ScColorFormatList* GetColorScaleList() const;
-    SC_DLLPUBLIC ScColorFormatList* GetColorScaleList();
+    SC_DLLPUBLIC const ScColorFormatList* GetColorScaleList(SCTAB nTab) const;
+    SC_DLLPUBLIC ScColorFormatList* GetColorScaleList(SCTAB nTab);
 
     ScValidationDataList* GetValidationList() const
                     { return pValidationList; }
diff --git a/sc/inc/fmtuno.hxx b/sc/inc/fmtuno.hxx
index 6632ce2..003806a 100644
--- a/sc/inc/fmtuno.hxx
+++ b/sc/inc/fmtuno.hxx
@@ -94,7 +94,7 @@ private:
     ScTableConditionalFormat(); // disable
 public:
                             ScTableConditionalFormat(ScDocument* pDoc, sal_uLong nKey,
-                                formula::FormulaGrammar::Grammar eGrammar);
+                                    SCTAB nTab, formula::FormulaGrammar::Grammar eGrammar);
     virtual                 ~ScTableConditionalFormat();
 
     void                    FillFormat( ScConditionalFormat& rFormat, ScDocument* pDoc,
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index d684c8f..397da57 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -73,6 +73,10 @@ class ScProgress;
 class ScRangeList;
 class ScSheetEvents;
 class ScSortInfoArray;
+class ScColorFormatList;
+class ScColorFormat;
+class ScConditionalFormat;
+class ScConditionalFormatList;
 class ScStyleSheet;
 class ScTableLink;
 class ScTableProtection;
@@ -169,6 +173,9 @@ private:
     ScDBData*       pDBDataNoName;
     mutable ScRangeName* mpRangeName;
 
+    boost::scoped_ptr<ScConditionalFormatList> mpCondFormatList;
+    boost::scoped_ptr<ScColorFormatList> mpColorFormatList;
+
     ScNotes         maNotes;
 
     bool            bScenario:1;
@@ -792,6 +799,16 @@ public:
     ScRangeName* GetRangeName() const;
     void        UpdateMoveTab(SCTAB nOldPos,SCTAB nNewPos);
 
+    ScConditionalFormatList* GetCondFormList();
+    const ScConditionalFormatList* GetCondFormList() const;
+    void SetCondFormList(ScConditionalFormatList* pNew);
+
+    sal_uLong          AddCondFormat( const ScConditionalFormat& rNew );
+    sal_uLong          AddColorFormat( ScColorFormat* pNew );
+    ScColorFormatList* GetColorFormatList();
+    const ScColorFormatList* GetColorFormatList() const;
+
+
 private:
     void        FillSeries( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2,
                                 sal_uLong nFillCount, FillDir eFillDir, FillCmd eFillCmd,
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index f201e5d..0a594dd 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -151,9 +151,9 @@ void ScAttrArray::Reset( const ScPatternAttr* pPattern, bool bAlloc )
             if ( &pPattern->GetItem(ATTR_CONDITIONAL) != &pOldPattern->GetItem(ATTR_CONDITIONAL) )
             {
                 pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                pOldPattern->GetItem(ATTR_CONDITIONAL)).GetValue() );
+                                pOldPattern->GetItem(ATTR_CONDITIONAL)).GetValue(), nTab );
                 pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                pPattern->GetItem(ATTR_CONDITIONAL)).GetValue() );
+                                pPattern->GetItem(ATTR_CONDITIONAL)).GetValue(), nTab );
             }
             pDocPool->Remove(*pOldPattern);
         }
@@ -376,9 +376,9 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
                 if ( &rNewSet.Get(ATTR_CONDITIONAL) != &rOldSet.Get(ATTR_CONDITIONAL) )
                 {
                     pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                    rOldSet.Get(ATTR_CONDITIONAL)).GetValue() );
+                                    rOldSet.Get(ATTR_CONDITIONAL)).GetValue(), nTab );
                     pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                    rNewSet.Get(ATTR_CONDITIONAL)).GetValue() );
+                                    rNewSet.Get(ATTR_CONDITIONAL)).GetValue(), nTab );
                 }
                 ns = pData[nx].nRow + 1;
                 nx++;
@@ -781,9 +781,9 @@ void ScAttrArray::ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCac
                     if ( &rNewSet.Get(ATTR_CONDITIONAL) != &rOldSet.Get(ATTR_CONDITIONAL) )
                     {
                         pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                        rOldSet.Get(ATTR_CONDITIONAL)).GetValue() );
+                                        rOldSet.Get(ATTR_CONDITIONAL)).GetValue(), nTab );
                         pDocument->ConditionalChanged( ((const SfxUInt32Item&)
-                                        rNewSet.Get(ATTR_CONDITIONAL)).GetValue() );
+                                        rNewSet.Get(ATTR_CONDITIONAL)).GetValue(), nTab );
                     }
 
                     pDocument->GetPool()->Remove(*pData[nPos].pPattern);
diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx
index 5c13b90..bbf3beb 100644
--- a/sc/source/core/data/conditio.cxx
+++ b/sc/source/core/data/conditio.cxx
@@ -1446,7 +1446,7 @@ void ScConditionalFormat::DoRepaint( const ScRange* pModified )
         if (!pAreas)        //  RangeList ggf. holen
         {
             pAreas = new ScRangeList;
-            pDoc->FindConditionalFormat( nKey, *pAreas );
+            pDoc->FindConditionalFormat( nKey, pRanges->front()->aStart.Tab(), *pAreas );
         }
         for (size_t i = 0, nCount = pAreas->size(); i < nCount; i++ )
         {
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 0135892..158c731 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -135,7 +135,6 @@ ScDocument::ScDocument( ScDocumentMode  eMode,
         pPrinter( NULL ),
         pVirtualDevice_100th_mm( NULL ),
         pDrawLayer( NULL ),
-        pCondFormList( NULL ),
         pValidationList( NULL ),
         pFormatExchangeList( NULL ),
         pRangeName(NULL),
@@ -409,10 +408,6 @@ ScDocument::~ScDocument()
 
     Clear( true );              // true = from destructor (needed for SdrModel::ClearModel)
 
-    if (pCondFormList)
-    {
-        DELETEZ(pCondFormList);
-    }
     if (pValidationList)
     {
         pValidationList->DeleteAndDestroy( 0, pValidationList->Count() );
@@ -456,10 +451,6 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
 {
     OSL_ENSURE(bIsClip, "InitClipPtrs und nicht bIsClip");
 
-    if (pCondFormList)
-    {
-        DELETEZ(pCondFormList);
-    }
     if (pValidationList)
     {
         pValidationList->DeleteAndDestroy( 0, pValidationList->Count() );
@@ -472,14 +463,6 @@ void ScDocument::InitClipPtrs( ScDocument* pSourceDoc )
 
     //  bedingte Formate / Gueltigkeiten
     //! Vorlagen kopieren?
-    const ScConditionalFormatList* pSourceCond = pSourceDoc->pCondFormList;
-    if ( pSourceCond )
-        pCondFormList = new ScConditionalFormatList(this, *pSourceCond);
-
-    const ScColorFormatList* pSourceColorScaleList = pSourceDoc->mpColorScaleList.get();
-    if ( pSourceColorScaleList )
-        mpColorScaleList.reset(new ScColorFormatList(this, *pSourceColorScaleList));
-
     const ScValidationDataList* pSourceValid = pSourceDoc->pValidationList;
     if ( pSourceValid )
         pValidationList = new ScValidationDataList(this, *pSourceValid);
@@ -756,10 +739,6 @@ bool ScDocument::MoveTab( SCTAB nOldPos, SCTAB nNewPos, ScProgress* pProgress )
                 UpdateChartRef( URM_REORDER,
                                     0,0,nOldPos, MAXCOL,MAXROW,nOldPos, 0,0,nDz );
                 UpdateRefAreaLinks( URM_REORDER, aSourceRange, 0,0,nDz );
-                if ( pCondFormList )
-                    pCondFormList->UpdateMoveTab( nOldPos, nNewPos );
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateMoveTab( nOldPos, nNewPos );
                 if ( pValidationList )
                     pValidationList->UpdateMoveTab( nOldPos, nNewPos );
                 if ( pUnoBroadcaster )
@@ -868,11 +847,6 @@ bool ScDocument::CopyTab( SCTAB nOldPos, SCTAB nNewPos, const ScMarkData* pOnlyM
                     if (*it && it != maTabs.begin()+nOldPos && it != maTabs.begin()+nNewPos)
                         (*it)->StartAllListeners();
 
-                //  update conditional formats after table is inserted
-                if ( pCondFormList )
-                    pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
                 if ( pValidationList )
                     pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
                 // sheet names of references may not be valid until sheet is copied
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index f1bce7b..3a0aeb5 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1007,10 +1007,6 @@ void ScDocument::UpdateReference( UpdateRefMode eUpdateRefMode,
                 pDPCollection->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
             UpdateChartRef( eUpdateRefMode, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2, nDx, nDy, nDz );
             UpdateRefAreaLinks( eUpdateRefMode, aRange, nDx, nDy, nDz );
-            if ( mpColorScaleList )
-                mpColorScaleList->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
-            if ( pCondFormList )
-                pCondFormList->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
             if ( pValidationList )
                 pValidationList->UpdateReference( eUpdateRefMode, aRange, nDx, nDy, nDz );
             if ( pDetOpList )
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 6ec09a3..c18b993 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -433,9 +433,6 @@ void ScDocument::CompileDBFormula( bool bCreateFormulaString )
 
 void ScDocument::CompileNameFormula( bool bCreateFormulaString )
 {
-    if ( pCondFormList )
-        pCondFormList->CompileAll();    // nach ScNameDlg noetig
-
     TableContainer::iterator it = maTabs.begin();
     for (;it != maTabs.end(); ++it)
     {
@@ -600,57 +597,44 @@ double ScDocument::RoundValueAsShown( double fVal, sal_uLong nFormat )
 //          bedingte Formate und Gueltigkeitsbereiche
 //
 
-sal_uLong ScDocument::AddCondFormat( const ScConditionalFormat& rNew )
+sal_uLong ScDocument::AddCondFormat( const ScConditionalFormat& rNew, SCTAB nTab )
 {
     if (rNew.IsEmpty())
         return 0;                   // leer ist immer 0
 
-    if (!pCondFormList)
-        pCondFormList = new ScConditionalFormatList;
-
-    sal_uLong nMax = 0;
-    for (ScConditionalFormatList::const_iterator itr = pCondFormList->begin();
-            itr != pCondFormList->end(); ++itr)
-    {
-        sal_uLong nKey = itr->GetKey();
-        if ( itr->EqualEntries( rNew ) )
-            return nKey;
-        if ( nKey > nMax )
-            nMax = nKey;
-    }
-
-    // Der Aufruf kann aus ScPatternAttr::PutInPool kommen, darum Clone (echte Kopie)
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        return maTabs[nTab]->AddCondFormat( rNew );
 
-    sal_uLong nNewKey = nMax + 1;
-    ScConditionalFormat* pInsert = rNew.Clone(this);
-    pInsert->SetKey( nNewKey );
-    pCondFormList->InsertNew( pInsert );
-    return nNewKey;
+    return 0;
 }
 
-const ScColorFormatList* ScDocument::GetColorScaleList() const
+const ScColorFormatList* ScDocument::GetColorScaleList(SCTAB nTab) const
 {
-    return mpColorScaleList.get();
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        return maTabs[nTab]->GetColorFormatList();
+
+    return NULL;
 }
 
-ScColorFormatList* ScDocument::GetColorScaleList()
+ScColorFormatList* ScDocument::GetColorScaleList( SCTAB nTab )
 {
-    return mpColorScaleList.get();
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        return maTabs[nTab]->GetColorFormatList();
+
+    return NULL;
 }
 
 //takes ownership
 // returns a 1-based index, 0 is reserved for no entry
-sal_uLong ScDocument::AddColorFormat( ScColorFormat* pNew )
+sal_uLong ScDocument::AddColorFormat( ScColorFormat* pNew, SCTAB nTab )
 {
     if(!pNew)
         return 0;
 
-    if(!mpColorScaleList)
-        mpColorScaleList.reset(new ScColorFormatList());
-
-    mpColorScaleList->AddFormat( pNew );
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        return maTabs[nTab]->AddColorFormat(pNew);
 
-    return mpColorScaleList->size();
+    return 0;
 }
 
 sal_uLong ScDocument::AddValidationEntry( const ScValidationData& rNew )
@@ -693,6 +677,7 @@ const SfxPoolItem* ScDocument::GetEffItem(
         if ( rSet.GetItemState( ATTR_CONDITIONAL, true, &pItem ) == SFX_ITEM_SET )
         {
             sal_uLong nIndex = ((const SfxUInt32Item*)pItem)->GetValue();
+            ScConditionalFormatList* pCondFormList = GetCondFormList( nTab );
             if (nIndex && pCondFormList)
             {
                 const ScConditionalFormat* pForm = pCondFormList->GetFormat( nIndex );
@@ -741,6 +726,7 @@ const ScConditionalFormat* ScDocument::GetCondFormat(
     sal_uLong nIndex = ((const SfxUInt32Item*)GetAttr(nCol,nRow,nTab,ATTR_CONDITIONAL))->GetValue();
     if (nIndex)
     {
+        ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
         if (pCondFormList)
             return pCondFormList->GetFormat( nIndex );
         else
@@ -752,6 +738,15 @@ const ScConditionalFormat* ScDocument::GetCondFormat(
     return NULL;
 }
 
+ScConditionalFormatList* ScDocument::GetCondFormList(SCTAB nTab) const
+{
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        return maTabs[nTab]->GetCondFormList();
+
+    return NULL;
+}
+
+
 const ScValidationData* ScDocument::GetValidationEntry( sal_uLong nIndex ) const
 {
     if ( pValidationList )
@@ -760,10 +755,10 @@ const ScValidationData* ScDocument::GetValidationEntry( sal_uLong nIndex ) const
         return NULL;
 }
 
-void ScDocument::FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges )
+void ScDocument::FindConditionalFormat( sal_uLong nKey, SCTAB nTab, ScRangeList& rRanges )
 {
-    for (SCTAB i=0; i< static_cast<SCTAB>(maTabs.size()) && maTabs[i]; i++)
-        maTabs[i]->FindConditionalFormat( nKey, rRanges );
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        maTabs[nTab]->FindConditionalFormat( nKey, rRanges );
 }
 
 void ScDocument::FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges, SCTAB nTab )
@@ -772,8 +767,9 @@ void ScDocument::FindConditionalFormat( sal_uLong nKey, ScRangeList& rRanges, SC
         maTabs[nTab]->FindConditionalFormat( nKey, rRanges );
 }
 
-void ScDocument::ConditionalChanged( sal_uLong nKey )
+void ScDocument::ConditionalChanged( sal_uLong nKey, SCTAB nTab )
 {
+    ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
     if ( nKey && pCondFormList && !bIsClip && !bIsUndo )        // nKey==0 -> noop
     {
         ScConditionalFormat* pForm = pCondFormList->GetFormat( nKey );
@@ -782,14 +778,10 @@ void ScDocument::ConditionalChanged( sal_uLong nKey )
     }
 }
 
-void ScDocument::SetCondFormList(ScConditionalFormatList* pNew)
+void ScDocument::SetCondFormList(ScConditionalFormatList* pNew, SCTAB nTab)
 {
-    if (pCondFormList)
-    {
-        delete pCondFormList;
-    }
-
-    pCondFormList = pNew;
+    if(VALIDTAB(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab])
+        maTabs[nTab]->SetCondFormList(pNew);
 }
 
 //------------------------------------------------------------------------
diff --git a/sc/source/core/data/documen7.cxx b/sc/source/core/data/documen7.cxx
index 3d28152..ab9b95b 100644
--- a/sc/source/core/data/documen7.cxx
+++ b/sc/source/core/data/documen7.cxx
@@ -109,11 +109,19 @@ void ScDocument::Broadcast( const ScHint& rHint )
     }
 
     //  Repaint fuer bedingte Formate mit relativen Referenzen:
-    if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
-        pCondFormList->SourceChanged( rHint.GetAddress() );
+    for(SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabs.size()); ++nTab)
+    {
+        if(!maTabs[nTab])
+            continue;
+
+        ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
+        if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
+            pCondFormList->SourceChanged( rHint.GetAddress() );
 
-    if( mpColorScaleList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
-        mpColorScaleList->DataChanged( rHint.GetAddress() );
+        ScColorFormatList* pColorFormatList = GetColorScaleList(nTab);
+        if( pColorFormatList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
+            pColorFormatList->DataChanged( rHint.GetAddress() );
+    }
 
     if ( rHint.GetAddress() != BCA_BRDCST_ALWAYS )
     {
@@ -135,12 +143,19 @@ void ScDocument::AreaBroadcast( const ScHint& rHint )
             TrackFormulas( rHint.GetId() );
     }
 
-    //  Repaint fuer bedingte Formate mit relativen Referenzen:
-    if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
-        pCondFormList->SourceChanged( rHint.GetAddress() );
+    for(SCTAB nTab = 0; nTab < static_cast<SCTAB>(maTabs.size()); ++nTab)
+    {
+        if(!maTabs[nTab])
+            continue;
 
-    if( mpColorScaleList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
-        mpColorScaleList->DataChanged( rHint.GetAddress() );
+        ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
+        if ( pCondFormList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
+            pCondFormList->SourceChanged( rHint.GetAddress() );
+
+        ScColorFormatList* pColorFormatList = GetColorScaleList(nTab);
+        if( pColorFormatList && rHint.GetAddress() != BCA_BRDCST_ALWAYS )
+            pColorFormatList->DataChanged( rHint.GetAddress() );
+    }
 }
 
 
@@ -157,37 +172,44 @@ void ScDocument::AreaBroadcastInRange( const ScRange& rRange, const ScHint& rHin
 
     // Repaint for conditional formats containing relative references.
     //! This is _THE_ bottle neck!
-    if ( pCondFormList )
+    TableContainer::iterator itr = maTabs.begin();
+    for(; itr != maTabs.end(); ++itr)
     {
-        SCCOL nCol;
-        SCROW nRow;
-        SCTAB nTab;
-        SCCOL nCol1;
-        SCROW nRow1;
-        SCTAB nTab1;
-        SCCOL nCol2;
-        SCROW nRow2;
-        SCTAB nTab2;
-        rRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
-        ScAddress aAddress( rRange.aStart );
-        for ( nTab = nTab1; nTab <= nTab2; ++nTab )
+        if(!*itr)
+            continue;
+
+        ScConditionalFormatList* pCondFormList = (*itr)->GetCondFormList();
+
+        if ( pCondFormList )
         {
-            aAddress.SetTab( nTab );
-            for ( nCol = nCol1; nCol <= nCol2; ++nCol )
+            SCCOL nCol1;
+            SCROW nRow1;
+            SCTAB nTab1;
+            SCCOL nCol2;
+            SCROW nRow2;
+            SCTAB nTab2;
+            rRange.GetVars( nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 );
+            ScAddress aAddress( rRange.aStart );
+            for ( SCTAB nTab = nTab1; nTab <= nTab2; ++nTab )
             {
-                aAddress.SetCol( nCol );
-                for ( nRow = nRow1; nRow <= nRow2; ++nRow )
+                aAddress.SetTab( nTab );
+                for ( SCCOL nCol = nCol1; nCol <= nCol2; ++nCol )
                 {
-                    aAddress.SetRow( nRow );
-                    pCondFormList->SourceChanged( aAddress );
+                    aAddress.SetCol( nCol );
+                    for ( SCROW nRow = nRow1; nRow <= nRow2; ++nRow )
+                    {
+                        aAddress.SetRow( nRow );
+                        pCondFormList->SourceChanged( aAddress );
+                    }
                 }
             }
         }
-    }
 
-    if(mpColorScaleList)
-    {
-        mpColorScaleList->DataChanged(rRange);
+        ScColorFormatList* pColorFormatList = (*itr)->GetColorFormatList();
+        if(pColorFormatList)
+        {
+            pColorFormatList->DataChanged(rRange);
+        }
     }
 }
 
@@ -464,8 +486,19 @@ void ScDocument::TrackFormulas( sal_uLong nHintId )
                 pBC->Broadcast( aHint );
             pBASM->AreaBroadcast( aHint );
             //  Repaint fuer bedingte Formate mit relativen Referenzen:
-            if ( pCondFormList )
-                pCondFormList->SourceChanged( pTrack->aPos );
+            TableContainer::iterator itr = maTabs.begin();
+            for(; itr != maTabs.end(); ++itr)
+            {
+                if(!*itr)
+                    continue;
+                ScConditionalFormatList* pCondFormList = (*itr)->GetCondFormList();
+                if ( pCondFormList )
+                    pCondFormList->SourceChanged( pTrack->aPos );
+
+                ScColorFormatList* pColorFormatList = (*itr)->GetColorFormatList();
+                if( pColorFormatList )
+                    pColorFormatList->DataChanged( pTrack->aPos );
+            }
             // for "calculate" event, keep track of which sheets are affected by tracked formulas
             if ( bCalcEvent )
                 SetCalcNotification( pTrack->aPos.Tab() );
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d24cb7f..bf783ad 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -475,11 +475,6 @@ bool ScDocument::InsertTab( SCTAB nPos, const rtl::OUString& rName,
                     if ( *it )
                         (*it)->StartAllListeners();
 
-                //  update conditional formats after table is inserted
-                if ( pCondFormList )
-                    pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
                 if ( pValidationList )
                     pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,1 );
                 // sheet names of references are not valid until sheet is inserted
@@ -565,11 +560,6 @@ bool ScDocument::InsertTabs( SCTAB nPos, const std::vector<rtl::OUString>& rName
                     if ( *it )
                         (*it)->StartAllListeners();
 
-                //    update conditional formats after table is inserted
-                if ( pCondFormList )
-                    pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets);
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets);
                 if ( pValidationList )
                     pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,nNewSheets );
                 // sheet names of references are not valid until sheet is inserted
@@ -632,10 +622,6 @@ bool ScDocument::DeleteTab( SCTAB nTab, ScDocument* pRefUndoDoc )
                     pDetOpList->UpdateReference( this, URM_INSDEL, aRange, 0,0,-1 );
                 UpdateChartRef( URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1 );
                 UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1 );
-                if ( pCondFormList )
-                    pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 );
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 );
                 if ( pValidationList )
                     pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,-1 );
                 if ( pUnoBroadcaster )
@@ -723,10 +709,6 @@ bool ScDocument::DeleteTabs( SCTAB nTab, SCTAB nSheets, ScDocument* pRefUndoDoc
                     pDetOpList->UpdateReference( this, URM_INSDEL, aRange, 0,0,-1*nSheets );
                 UpdateChartRef( URM_INSDEL, 0,0,nTab, MAXCOL,MAXROW,MAXTAB, 0,0,-1*nSheets );
                 UpdateRefAreaLinks( URM_INSDEL, aRange, 0,0,-1*nSheets );
-                if ( pCondFormList )
-                    pCondFormList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets );
-                if ( mpColorScaleList )
-                    mpColorScaleList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets );
                 if ( pValidationList )
                     pValidationList->UpdateReference( URM_INSDEL, aRange, 0,0,-1*nSheets );
                 if ( pUnoBroadcaster )
@@ -3399,9 +3381,6 @@ void ScDocument::CalcAll()
 
 void ScDocument::CompileAll()
 {
-    if ( pCondFormList )
-        pCondFormList->CompileAll();
-
     TableContainer::iterator it = maTabs.begin();
     for (; it != maTabs.end(); ++it)
         if (*it)
@@ -3431,8 +3410,6 @@ void ScDocument::CompileXML()
 
     DELETEZ( pAutoNameCache );  // valid only during CompileXML, where cell contents don't change
 
-    if ( pCondFormList )
-        pCondFormList->CompileXML();
     if ( pValidationList )
         pValidationList->CompileXML();
 
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 7e5c050..8148726 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -483,15 +483,17 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
                         sal_uLong nColorScale = ((const SfxUInt32Item&)pPattern->
                                                 GetItem(ATTR_COLORSCALE)).GetValue();
 
+                        ScConditionalFormatList* pCondFormList = GetCondFormList(nTab);
                         const ScConditionalFormat* pCondForm = NULL;
                         if ( nConditional && pCondFormList )
                             pCondForm = pCondFormList->GetFormat( nConditional );
 
+                        ScColorFormatList* pColorFormatList = GetColorScaleList(nTab);
                         const ScColorScaleFormat* pColorScale = NULL;
                         const ScDataBarFormat* pDataBar = NULL;
-                        if ( nColorScale && mpColorScaleList )
+                        if ( nColorScale && pColorFormatList )
                         {
-                            ScColorFormat* pFormat = mpColorScaleList->GetFormat( nColorScale );
+                            ScColorFormat* pFormat = pColorFormatList->GetFormat( nColorScale );
                             if(pFormat->GetType() == COLORSCALE)
                                 pColorScale = static_cast<ScColorScaleFormat*>(pFormat);
                             else if(pFormat->GetType() == DATABAR)
diff --git a/sc/source/core/data/patattr.cxx b/sc/source/core/data/patattr.cxx
index 5dfa7be..ce626fe 100644
--- a/sc/source/core/data/patattr.cxx
+++ b/sc/source/core/data/patattr.cxx
@@ -1026,39 +1026,7 @@ ScPatternAttr* ScPatternAttr::PutInPool( ScDocument* pDestDoc, ScDocument* pSrcD
         {
             SfxPoolItem* pNewItem = NULL;
 
-            if ( nAttrId == ATTR_CONDITIONAL )
-            {
-                //  Bedingte Formate ins neue Dokument kopieren
-
-                sal_uLong nNewIndex = 0;
-                ScConditionalFormatList* pSrcList = pSrcDoc->GetCondFormList();
-                if ( pSrcList )
-                {
-                    sal_uLong nOldIndex = ((const SfxUInt32Item*)pSrcItem)->GetValue();
-                    const ScConditionalFormat* pOldData = pSrcList->GetFormat( nOldIndex );
-                    if ( pOldData )
-                    {
-                        nNewIndex = pDestDoc->AddCondFormat( *pOldData );
-
-                        //  zugehoerige Styles auch mitkopieren
-                        //! nur wenn Format bei Add neu angelegt
-
-                        ScStyleSheetPool* pSrcSPool = pSrcDoc->GetStyleSheetPool();
-                        ScStyleSheetPool* pDestSPool = pDestDoc->GetStyleSheetPool();
-                        const SvNumberFormatterIndexTable* pFormatExchangeList = pDestDoc->GetFormatExchangeList();
-                        sal_uInt16 nStlCnt = pOldData->Count();
-                        for (sal_uInt16 i=0; i<nStlCnt; i++)
-                        {
-                            String aName = pOldData->GetEntry(i)->GetStyle();
-                            SfxStyleSheetBase* pSrcStl =
-                                pSrcDoc->GetStyleSheetPool()->Find(aName, SFX_STYLE_FAMILY_PARA);
-                            lcl_CopyStyleToPool( pSrcStl, pSrcSPool, pDestSPool, pFormatExchangeList );
-                        }
-                    }
-                }
-                pNewItem = new SfxUInt32Item( ATTR_CONDITIONAL, nNewIndex );
-            }
-            else if ( nAttrId == ATTR_VALIDDATA )
+            if ( nAttrId == ATTR_VALIDDATA )
             {
                 //  Gueltigkeit ins neue Dokument kopieren
 
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 40cc82c..14eaa87 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -54,6 +54,8 @@
 #include "sheetevents.hxx"
 #include "segmenttree.hxx"
 #include "dbdata.hxx"
+#include "colorscale.hxx"
+#include "conditio.hxx"
 
 #include <vector>
 
@@ -267,6 +269,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const rtl::OUString& rNewName
     nScenarioFlags( 0 ),
     pDBDataNoName(NULL),
     mpRangeName(NULL),
+    mpCondFormatList( new ScConditionalFormatList() ),
     maNotes(pDoc),
     bScenario(false),
     bLayoutRTL(false),
@@ -1466,6 +1469,9 @@ void ScTable::UpdateReference( UpdateRefMode eUpdateRefMode, SCCOL nCol1, SCROW
 
     if (bUpdated && IsStreamValid())
         SetStreamValid(false);
+
+    if(mpCondFormatList)
+        mpCondFormatList->UpdateReference( eUpdateRefMode, ScRange(nCol1, nRow1, nTab1, nCol2, nRow2, nTab2), nDx, nDy, nDz);
 }
 
 void ScTable::UpdateTranspose( const ScRange& rSource, const ScAddress& rDest,
@@ -1499,6 +1505,11 @@ void ScTable::UpdateInsertTab(SCTAB nTable, SCTAB nNewSheets)
 
     if (IsStreamValid())
         SetStreamValid(false);
+
+    if(mpCondFormatList)
+        mpCondFormatList->UpdateReference( URM_INSDEL, ScRange(0,0, nTable, MAXCOL, MAXROW, nTable+nNewSheets-1),0,0, nNewSheets);
+    if(mpColorFormatList)
+        mpColorFormatList->UpdateReference( URM_INSDEL, ScRange(0,0, nTable, MAXCOL, MAXROW, nTable+nNewSheets-1),0,0, nNewSheets);
 }
 
 void ScTable::UpdateDeleteTab( SCTAB nTable, bool bIsMove, ScTable* pRefUndo, SCTAB nSheets )
@@ -1531,6 +1542,11 @@ void ScTable::UpdateDeleteTab( SCTAB nTable, bool bIsMove, ScTable* pRefUndo, SC
 
     if (IsStreamValid())
         SetStreamValid(false);
+
+    if(mpCondFormatList)
+        mpCondFormatList->UpdateReference( URM_INSDEL, ScRange(0,0, nTable, MAXCOL, MAXROW, nTable+nSheets-1),0,0, -1*nSheets);
+    if(mpColorFormatList)
+        mpColorFormatList->UpdateReference( URM_INSDEL, ScRange(0,0, nTable, MAXCOL, MAXROW, nTable+nSheets-1),0,0, -1*nSheets);
 }
 
 void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
@@ -1551,6 +1567,11 @@ void ScTable::UpdateMoveTab( SCTAB nOldPos, SCTAB nNewPos, SCTAB nTabNo,
         SetStreamValid(false);
    if (pDBDataNoName)
         pDBDataNoName->UpdateMoveTab(nOldPos, nNewPos);
+
+    if(mpCondFormatList)
+        mpCondFormatList->UpdateMoveTab(nOldPos, nNewPos);
+    if(mpColorFormatList)
+        mpColorFormatList->UpdateMoveTab(nOldPos, nNewPos);
 }
 
 void ScTable::UpdateCompile( bool bForceIfNameInUse )
@@ -1984,4 +2005,62 @@ ScDBData* ScTable::GetAnonymousDBData()
     return pDBDataNoName;
 }
 
+sal_uLong ScTable::AddCondFormat( const ScConditionalFormat& rNew )
+{
+    if(!mpCondFormatList)
+        mpCondFormatList.reset(new ScConditionalFormatList());
+
+    sal_uLong nMax = 0;
+    for(ScConditionalFormatList::const_iterator itr = mpCondFormatList->begin();
+            itr != mpCondFormatList->end(); ++itr)
+    {
+        sal_uLong nKey = itr->GetKey();
+        if(nKey > nMax)
+            nMax = nKey;
+    }
+
+    ScConditionalFormat* pNewFormat = rNew.Clone(pDocument);
+    pNewFormat->SetKey(nMax+1);
+    mpCondFormatList->InsertNew(pNewFormat);
+
+    return nMax + 1;
+}
+
+ScColorFormatList* ScTable::GetColorFormatList()
+{
+    return mpColorFormatList.get();
+}
+
+const ScColorFormatList* ScTable::GetColorFormatList() const
+{
+    return mpColorFormatList.get();
+}
+
+void ScTable::SetCondFormList( ScConditionalFormatList* pNew )
+{
+    mpCondFormatList.reset( pNew );
+}
+
+ScConditionalFormatList* ScTable::GetCondFormList()
+{
+    if(!mpCondFormatList)
+        mpCondFormatList.reset( new ScConditionalFormatList() );
+
+    return mpCondFormatList.get();
+}
+
+const ScConditionalFormatList* ScTable::GetCondFormList() const
+{
+    return mpCondFormatList.get();
+}
+
+sal_uLong ScTable::AddColorFormat( ScColorFormat* pNew )
+{
+    if(!mpColorFormatList)
+        mpColorFormatList.reset(new ScColorFormatList());
+
+    mpColorFormatList->AddFormat( pNew );
+    return mpColorFormatList->size();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 09a171f..c16426f 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -653,8 +653,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
     std::map<sal_Int32, sal_Int32> aOldIdToNewId;
     std::map<sal_Int32, ScRangeList> aIdToRange;
 
-    ScConditionalFormatList* pCondFormatList = pDocument->GetCondFormList();
-    ScConditionalFormatList* pOldCondFormatList = pTable->pDocument->GetCondFormList();
+    ScConditionalFormatList* pOldCondFormatList = pTable->mpCondFormatList.get();
     for(SCCOL i = nCol1; i <= nCol2; ++i)
     {
         ScAttrIterator* pIter = aCol[i-nDx].CreateAttrIterator( nRow1-nDy, nRow2-nDy );
@@ -667,9 +666,9 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
             {
                 ScConditionalFormat* pFormat = pOldCondFormatList->GetFormat(nId);
                 ScConditionalFormat* pNewFormat = pFormat->Clone(pDocument);
-                pNewFormat->SetKey(pCondFormatList->size()+1);
+                pNewFormat->SetKey(mpCondFormatList->size()+1);
                 //not in list => create entries in both maps and new format
-                pCondFormatList->InsertNew(pNewFormat);
+                mpCondFormatList->InsertNew(pNewFormat);
                 sal_Int32 nNewId = pNewFormat->GetKey();
                 aOldIdToNewId.insert( std::pair<sal_Int32, sal_Int32>( nId, nNewId ) );
                 aIdToRange.insert( std::pair<sal_Int32, ScRangeList>( nId, ScRangeList() ) );
@@ -683,7 +682,7 @@ void ScTable::CopyConditionalFormat( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCRO
             itr != aIdToRange.end(); ++itr)
     {
         sal_uInt32 nNewKey = aOldIdToNewId.find(itr->first)->second;
-        ScConditionalFormat* pFormat = pCondFormatList->GetFormat( nNewKey );
+        ScConditionalFormat* pFormat = mpCondFormatList->GetFormat( nNewKey );
         pFormat->UpdateReference(URM_MOVE, ScRange(nCol1 - nDx, nRow1 - nDy, pTable->nTab, nCol2 - nDx, nRow2 - nDy, pTable->nTab),
                 nDx, nDy, pTable->nTab - nTab);
         pFormat->AddRangeInfo(new ScRangeList(itr->second));
@@ -702,8 +701,8 @@ void ScTable::CopyColorScales( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow
     std::map<sal_Int32, sal_Int32> aOldIdToNewId;
     std::map<sal_Int32, ScRangeList> aIdToRange;
 
-    ScColorFormatList* pColorScaleList = pDocument->GetColorScaleList();
-    ScColorFormatList* pOldColorScaleList = pTable->pDocument->GetColorScaleList();
+    ScColorFormatList* pColorScaleList = mpColorFormatList.get();
+    ScColorFormatList* pOldColorScaleList = pTable->mpColorFormatList.get();
     for(SCCOL i = nCol1; i <= nCol2; ++i)
     {
         ScAttrIterator* pIter = aCol[i-nDx].CreateAttrIterator( nRow1-nDy, nRow2-nDy );
@@ -1542,6 +1541,9 @@ void ScTable::CalcAll()
 void ScTable::CompileAll()
 {
     for (SCCOL i=0; i <= MAXCOL; i++) aCol[i].CompileAll();
+
+    if(mpCondFormatList)
+        mpCondFormatList->CompileAll();
 }
 
 
@@ -1554,6 +1556,9 @@ void ScTable::CompileXML( ScProgress& rProgress )
     {
         aCol[i].CompileXML( rProgress );
     }
+
+    if(mpCondFormatList)
+        mpCondFormatList->CompileXML();
 }
 
 void ScTable::CalcAfterLoad()
@@ -1785,11 +1790,10 @@ void ScTable::FindMaxRotCol( RowInfo* pRowInfo, SCSIZE nArrCount, SCCOL nX1, SCC
                     //  angeschaut werden muessen
 
                     sal_uLong nIndex = ((const SfxUInt32Item*)pCondItem)->GetValue();
-                    ScConditionalFormatList* pList = pDocument->GetCondFormList();
                     ScStyleSheetPool* pStylePool = pDocument->GetStyleSheetPool();
-                    if (pList && pStylePool && nIndex)
+                    if (mpCondFormatList && pStylePool && nIndex)
                     {
-                        const ScConditionalFormat* pFormat = pList->GetFormat(nIndex);
+                        const ScConditionalFormat* pFormat = mpCondFormatList->GetFormat(nIndex);
                         if ( pFormat )
                         {
                             sal_uInt16 nEntryCount = pFormat->Count();
diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx
index 87b1d25..7c8a346 100644
--- a/sc/source/filter/excel/xecontent.cxx
+++ b/sc/source/filter/excel/xecontent.cxx
@@ -1073,7 +1073,7 @@ void XclExpColorScale::SaveXml( XclExpXmlStream& rStrm )
 XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot ) :
     XclExpRoot( rRoot )
 {
-    if( const ScConditionalFormatList* pCondFmtList = GetDoc().GetCondFormList() )
+    if( const ScConditionalFormatList* pCondFmtList = GetDoc().GetCondFormList(GetCurrScTab()) )
     {
         for( ScConditionalFormatList::const_iterator itr = pCondFmtList->begin();
                         itr != pCondFmtList->end(); ++itr)
@@ -1083,19 +1083,15 @@ XclExpCondFormatBuffer::XclExpCondFormatBuffer( const XclExpRoot& rRoot ) :
                 maCondfmtList.AppendRecord( xCondfmtRec );
         }
     }
-    if( const ScColorFormatList* pColorScaleList = GetDoc().GetColorScaleList() )
+    if( const ScColorFormatList* pColorScaleList = GetDoc().GetColorScaleList(GetCurrScTab()) )
     {
         for( ScColorFormatList::const_iterator itr = pColorScaleList->begin();
                 itr != pColorScaleList->end(); ++itr)
         {
-            const ScRangeList& rList = itr->GetRange();
-            if (rList.front()->aStart.Tab() == GetCurrScTab())
+            if(itr->GetType() == COLORSCALE)
             {
-                if(itr->GetType() == COLORSCALE)
-                {
-                    XclExpColorScaleList::RecordRefType xColorScaleRec( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*itr) ) );
-                    maColorScaleList.AppendRecord( xColorScaleRec );
-                }
+                XclExpColorScaleList::RecordRefType xColorScaleRec( new XclExpColorScale( GetRoot(), static_cast<const ScColorScaleFormat&>(*itr) ) );
+                maColorScaleList.AppendRecord( xColorScaleRec );
             }
         }
     }
diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx
index aaed2c9..77d9dee 100644
--- a/sc/source/filter/excel/xestyle.cxx
+++ b/sc/source/filter/excel/xestyle.cxx
@@ -2851,77 +2851,81 @@ XclExpDxfs::XclExpDxfs( const XclExpRoot& rRoot )
     (*mpKeywordTable)[ NF_KEY_THAI_T ] = String( RTL_CONSTASCII_USTRINGPARAM( "T" ) );
     sal_Int32 nNumFmtIndex = 0;
 
-    ScConditionalFormatList* pList = rRoot.GetDoc().GetCondFormList();
-    if (pList)
+    SCTAB nTables = rRoot.GetDoc().GetTableCount();
+    for(SCTAB nTab = 0; nTab < nTables; ++nTab)
     {
-        sal_Int32 nIndex = 0;
-        for (ScConditionalFormatList::const_iterator itr = pList->begin();
-                                itr != pList->end(); ++itr)
+        ScConditionalFormatList* pList = rRoot.GetDoc().GetCondFormList(nTab);
+        if (pList)
         {
-            sal_Int32 nEntryCount = itr->Count();
-            for (sal_Int32 nFormatEntry = 0; nFormatEntry < nEntryCount; ++nFormatEntry)
+            sal_Int32 nIndex = 0;
+            for (ScConditionalFormatList::const_iterator itr = pList->begin();
+                    itr != pList->end(); ++itr)
             {
-                const ScCondFormatEntry* pEntry = itr->GetEntry(nFormatEntry);
-                if (!pEntry)
-                    continue;
-
-                rtl::OUString aStyleName = pEntry->GetStyle();
-                if (maStyleNameToDxfId.find(aStyleName) == maStyleNameToDxfId.end())
+                sal_Int32 nEntryCount = itr->Count();
+                for (sal_Int32 nFormatEntry = 0; nFormatEntry < nEntryCount; ++nFormatEntry)
                 {
-                    maStyleNameToDxfId.insert(std::pair<rtl::OUString, sal_Int32>(aStyleName, nIndex));
-
-                    SfxItemSet& rSet = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName)->GetItemSet();
-
-                    XclExpCellBorder* pBorder = new XclExpCellBorder;
-                    if (!pBorder->FillFromItemSet( rSet, GetPalette(), GetBiff()) )
-                    {
-                        delete pBorder;
-                        pBorder = NULL;
-                    }
-
-                    XclExpCellAlign* pAlign = new XclExpCellAlign;
-                    if (!pAlign->FillFromItemSet( rSet, false, GetBiff()))
-                    {
-                        delete pAlign;
-                        pAlign = NULL;
-                    }
-
-                    XclExpCellProt* pCellProt = new XclExpCellProt;
-                    if (!pCellProt->FillFromItemSet( rSet ))
-                    {
-                        delete pCellProt;
-                        pCellProt = NULL;
-                    }
-
-                    XclExpCellArea* pCellArea = new XclExpCellArea;
-                    if(!pCellArea->FillFromItemSet( rSet, GetPalette(), GetBiff() ))
-                    {
-                        delete pCellArea;
-                        pCellArea = NULL;
-                    }
+                    const ScCondFormatEntry* pEntry = itr->GetEntry(nFormatEntry);
+                    if (!pEntry)
+                        continue;
 
-                    XclExpFont* pFont = NULL;
-                    // check if non default font is set and only export then
-                    if (rSet.GetItemState(rSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ))>SFX_ITEM_DEFAULT )
+                    rtl::OUString aStyleName = pEntry->GetStyle();
+                    if (maStyleNameToDxfId.find(aStyleName) == maStyleNameToDxfId.end())
                     {
-                        Font aFont = XclExpFontHelper::GetFontFromItemSet( GetRoot(), rSet, com::sun::star::i18n::ScriptType::WEAK );
-                        pFont = new XclExpFont( GetRoot(), XclFontData( aFont ), EXC_COLOR_CELLTEXT );
+                        maStyleNameToDxfId.insert(std::pair<rtl::OUString, sal_Int32>(aStyleName, nIndex));
+
+                        SfxItemSet& rSet = rRoot.GetDoc().GetStyleSheetPool()->Find(aStyleName)->GetItemSet();
+
+                        XclExpCellBorder* pBorder = new XclExpCellBorder;
+                        if (!pBorder->FillFromItemSet( rSet, GetPalette(), GetBiff()) )
+                        {
+                            delete pBorder;
+                            pBorder = NULL;
+                        }
+
+                        XclExpCellAlign* pAlign = new XclExpCellAlign;
+                        if (!pAlign->FillFromItemSet( rSet, false, GetBiff()))
+                        {
+                            delete pAlign;
+                            pAlign = NULL;
+                        }
+
+                        XclExpCellProt* pCellProt = new XclExpCellProt;
+                        if (!pCellProt->FillFromItemSet( rSet ))
+                        {
+                            delete pCellProt;
+                            pCellProt = NULL;
+                        }
+
+                        XclExpCellArea* pCellArea = new XclExpCellArea;
+                        if(!pCellArea->FillFromItemSet( rSet, GetPalette(), GetBiff() ))
+                        {
+                            delete pCellArea;
+                            pCellArea = NULL;
+                        }
+
+                        XclExpFont* pFont = NULL;
+                        // check if non default font is set and only export then
+                        if (rSet.GetItemState(rSet.GetPool()->GetWhich( SID_ATTR_CHAR_FONT ))>SFX_ITEM_DEFAULT )
+                        {
+                            Font aFont = XclExpFontHelper::GetFontFromItemSet( GetRoot(), rSet, com::sun::star::i18n::ScriptType::WEAK );
+                            pFont = new XclExpFont( GetRoot(), XclFontData( aFont ), EXC_COLOR_CELLTEXT );
+                        }
+
+                        XclExpNumFmt* pNumFormat = NULL;
+                        const SfxPoolItem *pPoolItem = NULL;
+                        if( rSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
+                        {
+                            sal_uLong nScNumFmt = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
+                            sal_uInt16 nXclNumFmt = static_cast< sal_uInt16 >( EXC_FORMAT_OFFSET8 + nIndex );
+                            pNumFormat = new XclExpNumFmt( nScNumFmt, nXclNumFmt, GetNumberFormatCode( *this, nScNumFmt, mxFormatter.get(), mpKeywordTable.get() ));
+                            ++nNumFmtIndex;
+                        }
+
+                        maDxf.push_back(new XclExpDxf( rRoot, pAlign, pBorder, pFont, pNumFormat, pCellProt, pCellArea ));
+                        ++nIndex;
                     }
 
-                    XclExpNumFmt* pNumFormat = NULL;
-                    const SfxPoolItem *pPoolItem = NULL;
-                    if( rSet.GetItemState( SID_ATTR_NUMBERFORMAT_VALUE, sal_True, &pPoolItem ) == SFX_ITEM_SET )
-                    {
-                        sal_uLong nScNumFmt = static_cast< sal_uInt32 >( static_cast< const SfxInt32Item* >(pPoolItem)->GetValue());
-                        sal_uInt16 nXclNumFmt = static_cast< sal_uInt16 >( EXC_FORMAT_OFFSET8 + nIndex );
-                        pNumFormat = new XclExpNumFmt( nScNumFmt, nXclNumFmt, GetNumberFormatCode( *this, nScNumFmt, mxFormatter.get(), mpKeywordTable.get() ));
-                        ++nNumFmtIndex;
-                    }
-
-                    maDxf.push_back(new XclExpDxf( rRoot, pAlign, pBorder, pFont, pNumFormat, pCellProt, pCellArea ));
-                    ++nIndex;
                 }
-
             }
         }
     }
diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx
index 50b72e8..f8d0ab3 100644
--- a/sc/source/filter/excel/xicontent.cxx
+++ b/sc/source/filter/excel/xicontent.cxx
@@ -648,7 +648,7 @@ void XclImpCondFormat::Apply()
     {
         ScDocument& rDoc = GetDoc();
 
-        sal_uLong nKey = rDoc.AddCondFormat( *mxScCondFmt );
+        sal_uLong nKey = rDoc.AddCondFormat( *mxScCondFmt, maRanges.front()->aStart.Tab() );
         ScPatternAttr aPattern( rDoc.GetPool() );
         aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nKey ) );
 
diff --git a/sc/source/filter/oox/condformatbuffer.cxx b/sc/source/filter/oox/condformatbuffer.cxx
index 3471e11..2c30424 100644
--- a/sc/source/filter/oox/condformatbuffer.cxx
+++ b/sc/source/filter/oox/condformatbuffer.cxx
@@ -809,7 +809,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
         ScDocument& rDoc = getScDocument();
         ScColorScaleFormat* pFormat = new ScColorScaleFormat(&rDoc);
 
-        sal_Int32 nIndex = rDoc.AddColorFormat(pFormat);
+        sal_Int32 nIndex = rDoc.AddColorFormat(pFormat, getSheetIndex());
 
         ScRangeList aList;
         // apply attributes to cells
@@ -840,7 +840,7 @@ void CondFormatRule::finalizeImport( const Reference< XSheetConditionalEntries >
         ScDocument& rDoc = getScDocument();
         ScDataBarFormat* pFormat = new ScDataBarFormat(&rDoc);
 
-        sal_Int32 nIndex = rDoc.AddColorFormat(pFormat);
+        sal_Int32 nIndex = rDoc.AddColorFormat(pFormat, getSheetIndex());
 
         // apply attributes to cells
         //
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index aa4495c..a572a08 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -2852,7 +2852,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
         }
 
         //export new conditional format information
-        ExportConditionalFormat();
+        ExportConditionalFormat(nTable);
 
     }
 }
@@ -3814,10 +3814,10 @@ rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry)
 
 }
 
-void ScXMLExport::ExportConditionalFormat()
+void ScXMLExport::ExportConditionalFormat(SCTAB nTab)
 {
-    ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList();
-    ScColorFormatList* pColorFormatList = pDoc->GetColorScaleList();
+    ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList(nTab);
+    ScColorFormatList* pColorFormatList = pDoc->GetColorScaleList(nTab);
     if(pCondFormatList || pColorFormatList)
     {
         SvXMLElementExport aElementCondFormats(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMATS, true, true);
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 158e818..032bb18 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -36,6 +36,8 @@
 #include <com/sun/star/drawing/XShapes.hpp>
 #include <com/sun/star/table/XCellRange.hpp>
 
+#include "address.hxx"
+
 namespace com { namespace sun { namespace star {
     namespace beans { class XPropertySet; }
 } } }
@@ -205,7 +207,7 @@ class ScXMLExport : public SvXMLExport
     void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, bool bColumn );
     void WriteNamedExpressions();
     void WriteNamedRange(ScRangeName* pRangeName);
-    void ExportConditionalFormat();
+    void ExportConditionalFormat(SCTAB nTab);
     void WriteExternalRefCaches();
     void WriteConsolidation();  // core implementation
 
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 2543d23..9524e6b 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1363,9 +1363,12 @@ void ScDocShell::NotifyStyle( const SfxStyleSheetHint& rHint )
                 aOldName = ((SfxStyleSheetHintExtended&)rHint).GetOldName();
             if ( aNewName != aOldName )
             {
-                ScConditionalFormatList* pList = aDocument.GetCondFormList();
-                if (pList)
-                    pList->RenameCellStyle( aOldName,aNewName );
+                for(SCTAB i = 0; i < aDocument.GetTableCount(); ++i)
+                {
+                    ScConditionalFormatList* pList = aDocument.GetCondFormList(i);
+                    if (pList)
+                        pList->RenameCellStyle( aOldName,aNewName );
+                }
             }
         }
     }
diff --git a/sc/source/ui/inc/refundo.hxx b/sc/source/ui/inc/refundo.hxx
index 25de386..eaa77e1 100644
--- a/sc/source/ui/inc/refundo.hxx
+++ b/sc/source/ui/inc/refundo.hxx
@@ -37,7 +37,6 @@ class ScRangeName;
 class ScPrintRangeSaver;
 class ScDPCollection;
 class ScChartCollection;
-class ScConditionalFormatList;
 class ScDetOpList;
 class ScChartListenerCollection;
 class ScAreaLinkSaveCollection;
@@ -50,7 +49,6 @@ private:
     ScRangeName*                pRangeName;
     ScPrintRangeSaver*          pPrintRanges;
     ScDPCollection*             pDPCollection;
-    ScConditionalFormatList*    pCondFormList;
     ScDetOpList*                pDetOpList;
     ScChartListenerCollection*  pChartListenerCollection;
     ScAreaLinkSaveCollection*   pAreaLinks;
diff --git a/sc/source/ui/undo/refundo.cxx b/sc/source/ui/undo/refundo.cxx
index 1d2d2bc..2b55c32 100644
--- a/sc/source/ui/undo/refundo.cxx
+++ b/sc/source/ui/undo/refundo.cxx
@@ -41,7 +41,6 @@
 #include "pivot.hxx"
 #include "chartarr.hxx"
 #include "stlpool.hxx"
-#include "conditio.hxx"
 #include "detdata.hxx"
 #include "prnsave.hxx"
 #include "chartlis.hxx"
@@ -67,9 +66,6 @@ ScRefUndoData::ScRefUndoData( const ScDocument* pDoc ) :
     ScDPCollection* pOldDP = ((ScDocument*)pDoc)->GetDPCollection();        //! const
     pDPCollection = pOldDP ? new ScDPCollection(*pOldDP) : NULL;
 
-    ScConditionalFormatList* pOldCond = pDoc->GetCondFormList();
-    pCondFormList = pOldCond ? new ScConditionalFormatList(*pOldCond) : NULL;
-
     ScDetOpList* pOldDetOp = pDoc->GetDetOpList();
     pDetOpList = pOldDetOp ? new ScDetOpList(*pOldDetOp) : 0;
 
@@ -89,7 +85,6 @@ ScRefUndoData::~ScRefUndoData()
     delete pRangeName;
     delete pPrintRanges;
     delete pDPCollection;
-    delete pCondFormList;
     delete pDetOpList;
     delete pChartListenerCollection;
     delete pAreaLinks;
@@ -126,13 +121,6 @@ void ScRefUndoData::DeleteUnchanged( const ScDocument* pDoc )
             DELETEZ(pDPCollection);
     }
 
-    if (pCondFormList)
-    {
-        ScConditionalFormatList* pNewCond = pDoc->GetCondFormList();
-        if ( pNewCond && *pCondFormList == *pNewCond )
-            DELETEZ(pCondFormList);
-    }
-
     if (pDetOpList)
     {
         ScDetOpList* pNewDetOp = pDoc->GetDetOpList();
@@ -182,8 +170,6 @@ void ScRefUndoData::DoUndo( ScDocument* pDoc, sal_Bool bUndoRefFirst )
             pDPCollection->WriteRefsTo( *pDocDP );
     }
 
-    if (pCondFormList)
-        pDoc->SetCondFormList( new ScConditionalFormatList(*pCondFormList) );
     if (pDetOpList)
         pDoc->SetDetOpList( new ScDetOpList(*pDetOpList) );
 
diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx
index 7fc9093..6a50811 100644
--- a/sc/source/ui/unoobj/cellsuno.cxx
+++ b/sc/source/ui/unoobj/cellsuno.cxx
@@ -2116,7 +2116,7 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const rtl::OUString& aPr
                                    formula::FormulaGrammar::mapAPItoGrammar( bEnglish, bXML));
 
                             aAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
-                                    new ScTableConditionalFormat( pDoc, 0, eGrammar ));
+                                    new ScTableConditionalFormat( pDoc, 0, aRanges[0]->aStart.Tab(), eGrammar ));
                         }
                         break;
                     case SC_WID_UNO_VALIDAT:
@@ -2418,7 +2418,7 @@ void ScCellRangesBase::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                                 pFormat->FillFormat( aNew, pDoc, eGrammar );
                                 ScRangeListRef pRanges = new ScRangeList( aRanges );
                                 aNew.AddRangeInfo( pRanges );
-                                sal_uLong nIndex = pDoc->AddCondFormat( aNew );
+                                sal_uLong nIndex = pDoc->AddCondFormat( aNew, aRanges.front()->aStart.Tab() );
 
                                 ScPatternAttr aPattern( pDoc->GetPool() );
                                 aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
@@ -2581,7 +2581,7 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE
                             sal_uLong nIndex = ((const SfxUInt32Item&)
                                     pPattern->GetItem(ATTR_CONDITIONAL)).GetValue();
                             rAny <<= uno::Reference<sheet::XSheetConditionalEntries>(
-                                    new ScTableConditionalFormat( pDoc, nIndex, eGrammar ));
+                                    new ScTableConditionalFormat( pDoc, nIndex, aRanges.front()->aStart.Tab(), eGrammar ));
                         }
                     }
                     break;
diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx
index a2b135b..0cc06a3 100644
--- a/sc/source/ui/unoobj/fmtuno.cxx
+++ b/sc/source/ui/unoobj/fmtuno.cxx
@@ -181,13 +181,13 @@ ScCondFormatEntryItem::ScCondFormatEntryItem() :
 //------------------------------------------------------------------------
 
 ScTableConditionalFormat::ScTableConditionalFormat(
-        ScDocument* pDoc, sal_uLong nKey, FormulaGrammar::Grammar eGrammar)
+        ScDocument* pDoc, sal_uLong nKey, SCTAB nTab, FormulaGrammar::Grammar eGrammar)
 {
     //  Eintrag aus dem Dokument lesen...
 
     if ( pDoc && nKey )
     {
-        ScConditionalFormatList* pList = pDoc->GetCondFormList();
+        ScConditionalFormatList* pList = pDoc->GetCondFormList(nTab);
         if (pList)
         {
             const ScConditionalFormat* pFormat = pList->GetFormat( nKey );
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index cdb42db..e879794 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -3080,7 +3080,7 @@ void ScViewFunc::SetSelectionFrameLines( const SvxBorderLine* pLine,
 void ScViewFunc::SetConditionalFormat( const ScConditionalFormat& rNew )
 {
     ScDocument* pDoc = GetViewData()->GetDocument();
-    sal_uLong nIndex = pDoc->AddCondFormat(rNew);           // for it there is no Undo
+    sal_uLong nIndex = pDoc->AddCondFormat(rNew, GetViewData()->GetTabNo());           // for it there is no Undo
     SfxUInt32Item aItem( ATTR_CONDITIONAL, nIndex );
 
     ApplyAttr( aItem );         // with Paint and Undo...
commit 99f61e9b635a7c30f28192c01a534acb1e2a6ca3
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue May 22 21:57:50 2012 +0200

    first part for databar export
    
     # Changes to be committed:
    
    Change-Id: Iffe020d60982c2872c1a451f9d0e4e1d4f5e349f

diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx
index 24248fe..3187f84 100644
--- a/sc/inc/colorscale.hxx
+++ b/sc/inc/colorscale.hxx
@@ -216,6 +216,7 @@ public:
     ScDataBarInfo* GetDataBarInfo(const ScAddress& rAddr) const;
 
     void SetDataBarData( ScDataBarFormatData* pData );
+    const ScDataBarFormatData* GetDataBarData() const;
 
     virtual void DataChanged(const ScRange& rRange);
     virtual void UpdateMoveTab(SCTAB nOldTab, SCTAB nNewTab);
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 9636365..c5db859 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -644,6 +644,11 @@ void ScDataBarFormat::SetDataBarData( ScDataBarFormatData* pData )
     mpFormatData.reset(pData);
 }
 
+const ScDataBarFormatData* ScDataBarFormat::GetDataBarData() const
+{
+    return mpFormatData.get();
+}
+
 ScColorFormat* ScDataBarFormat::Clone(ScDocument* pDoc) const
 {
     return new ScDataBarFormat(pDoc, *this);
diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx
index 1fb9c0c..aa4495c 100644
--- a/sc/source/filter/xml/xmlexprt.cxx
+++ b/sc/source/filter/xml/xmlexprt.cxx
@@ -68,6 +68,8 @@
 #include "editutil.hxx"
 #include "tabprotection.hxx"
 #include "cachedattraccess.hxx"
+#include "colorscale.hxx"
+#include "conditio.hxx"
 
 #include <xmloff/xmltoken.hxx>
 #include <xmloff/xmlnmspe.hxx>
@@ -2849,6 +2851,9 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const Reference<sheet::XSpreadshe
             WriteNamedRange(pRangeName);
         }
 
+        //export new conditional format information
+        ExportConditionalFormat();
+
     }
 }
 
@@ -3789,6 +3794,97 @@ void ScXMLExport::WriteNamedRange(ScRangeName* pRangeName)
     }
 }
 
+namespace {
+
+rtl::OUString getCondFormatEntryType(const ScColorScaleEntry& rEntry)
+{
+    if(rEntry.GetMin())
+        return rtl::OUString("minimum");
+    else if(rEntry.GetMax())
+        return rtl::OUString("maximum");
+    else if(rEntry.GetPercent())
+        return rtl::OUString("percent");
+    else if(rEntry.GetPercentile())
+        return rtl::OUString("percentile");
+    else if(rEntry.GetFormula())
+        return rtl::OUString("formula");
+    else
+        return rtl::OUString("number");
+}
+
+}
+
+void ScXMLExport::ExportConditionalFormat()
+{
+    ScConditionalFormatList* pCondFormatList = pDoc->GetCondFormList();
+    ScColorFormatList* pColorFormatList = pDoc->GetColorScaleList();
+    if(pCondFormatList || pColorFormatList)
+    {
+        SvXMLElementExport aElementCondFormats(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMATS, true, true);
+
+        if(pCondFormatList)
+        {
+            for(ScConditionalFormatList::const_iterator itr = pCondFormatList->begin();
+                    itr != pCondFormatList->end(); ++itr)
+            {
+                SvXMLElementExport aElementCondFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true);
+                rtl::OUString sRangeList;
+                //ScRangeStringConverter::GetStringFromRangeList( sRanges, rRangeList, pDoc, FormulaGrammar::CONV_OOO );
+                AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
+            }
+        }
+
+        if(pColorFormatList)
+        {
+            for(ScColorFormatList::const_iterator itr = pColorFormatList->begin();
+                    itr != pColorFormatList->end(); ++itr)
+            {
+                rtl::OUString sRangeList;
+                const ScRangeList& rRangeList = itr->GetRange();
+                ScRangeStringConverter::GetStringFromRangeList( sRangeList, &rRangeList, pDoc, FormulaGrammar::CONV_OOO );
+                AddAttribute(XML_NP_TABLE_EXT, XML_TARGET_RANGE_ADDRESS, sRangeList);
+                SvXMLElementExport aElementColFormat(*this, XML_NP_TABLE_EXT, XML_CONDITIONAL_FORMAT, true, true);
+
+                if(itr->GetType() == COLORSCALE)
+                {
+                    SvXMLElementExport aElementColorScale(*this, XML_NP_TABLE_EXT, XML_COLOR_SCALE, true, true);
+
+                }
+                else if(itr->GetType() == DATABAR)
+                {
+                    const ScDataBarFormatData* pFormatData = static_cast<const ScDataBarFormat&>(*itr).GetDataBarData();
+                    if(!pFormatData->mbGradient)
+                        AddAttribute(XML_NP_TABLE_EXT, XML_GRADIENT, XML_FALSE);
+                    rtl::OUStringBuffer aBuffer;
+                    ::sax::Converter::convertColor(aBuffer, pFormatData->maPositiveColor.GetColor());
+                    AddAttribute(XML_NP_TABLE_EXT, XML_POSITIVE_COLOR, aBuffer.makeStringAndClear());
+                    SvXMLElementExport aElementDataBar(*this, XML_NP_TABLE_EXT, XML_DATA_BAR, true, true);
+
+                    if(pFormatData->mpLowerLimit->GetFormula())
+                    {
+                        rtl::OUString sFormula;
+                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula);
+                    }
+                    else
+                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpLowerLimit->GetValue()));
+                    AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpLowerLimit));
+                    SvXMLElementExport aElementDataBarEntryLower(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true);
+
+                    if(pFormatData->mpUpperLimit->GetFormula())
+                    {
+                        rtl::OUString sFormula;
+                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, sFormula);
+                    }
+                    else
+                        AddAttribute(XML_NP_TABLE_EXT, XML_VALUE, rtl::OUString::valueOf(pFormatData->mpUpperLimit->GetValue()));
+                    AddAttribute(XML_NP_TABLE_EXT, XML_TYPE, getCondFormatEntryType(*pFormatData->mpUpperLimit));
+                    SvXMLElementExport aElementDataBarEntryUpper(*this, XML_NP_TABLE_EXT, XML_DATA_BAR_ENTRY, true, true);
+                }
+            }
+        }
+    }
+}
+
 void ScXMLExport::WriteExternalRefCaches()
 {
     if (!pDoc)
diff --git a/sc/source/filter/xml/xmlexprt.hxx b/sc/source/filter/xml/xmlexprt.hxx
index 5e65953..158e818 100644
--- a/sc/source/filter/xml/xmlexprt.hxx
+++ b/sc/source/filter/xml/xmlexprt.hxx
@@ -205,6 +205,7 @@ class ScXMLExport : public SvXMLExport
     void WriteLabelRanges( const com::sun::star::uno::Reference< com::sun::star::container::XIndexAccess >& xRangesIAccess, bool bColumn );
     void WriteNamedExpressions();
     void WriteNamedRange(ScRangeName* pRangeName);
+    void ExportConditionalFormat();
     void WriteExternalRefCaches();
     void WriteConsolidation();  // core implementation
 
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index f241023..dd0529b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -425,6 +425,7 @@ namespace xmloff { namespace token {
         XML_COLOR,
         XML_COLOR_INVERSION,
         XML_COLOR_MODE,
+        XML_COLOR_SCALE,
         XML_COLUMN,
         XML_COLUMN_COUNT,
         XML_COLUMN_GAP,
@@ -446,6 +447,8 @@ namespace xmloff { namespace token {
         XML_CONDITION_SOURCE,
         XML_CONDITION_SOURCE_RANGE_ADDRESS,
         XML_CONDITIONAL_TEXT,
+        XML_CONDITIONAL_FORMAT,
+        XML_CONDITIONAL_FORMATS,
         XML_CONE,
         XML_CONFERENCE,
         XML_CONFIG_ITEM,
@@ -528,6 +531,8 @@ namespace xmloff { namespace token {
         XML_DASH,
         XML_DASHED,
         XML_DATA,
+        XML_DATA_BAR,
+        XML_DATA_BAR_ENTRY,
         XML_DATA_CELL_RANGE_ADDRESS,
         XML_DATA_LABEL_NUMBER,
         XML_DATA_LABEL_SYMBOL,
@@ -1381,6 +1386,7 @@ namespace xmloff { namespace token {
         XML_POSITION_LEFT,
         XML_POSITION_RIGHT,
         XML_POSITION_TOP,
+        XML_POSITIVE_COLOR,
         XML_POSTURE_ITALIC,
         XML_POSTURE_NORMAL,
         XML_POSTURE_OBLIQUE,
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7c56037..d4e21b2 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -429,6 +429,7 @@ namespace xmloff { namespace token {
         TOKEN( "color",                           XML_COLOR ),
         TOKEN( "color-inversion",                 XML_COLOR_INVERSION ),
         TOKEN( "color-mode",                      XML_COLOR_MODE ),
+        TOKEN( "color-scale",                     XML_COLOR_SCALE ),
         TOKEN( "column",                          XML_COLUMN ),
         TOKEN( "column-count",                    XML_COLUMN_COUNT ),
         TOKEN( "column-gap",                      XML_COLUMN_GAP ),
@@ -450,6 +451,8 @@ namespace xmloff { namespace token {
         TOKEN( "condition-source",                XML_CONDITION_SOURCE ),
         TOKEN( "condition-source-range-address",      XML_CONDITION_SOURCE_RANGE_ADDRESS ),
         TOKEN( "conditional-text",                XML_CONDITIONAL_TEXT ),
+        TOKEN( "conditional-format",              XML_CONDITIONAL_FORMAT ),
+        TOKEN( "conditional-formats",             XML_CONDITIONAL_FORMATS ),
         TOKEN( "cone",                            XML_CONE ),
         TOKEN( "conference",                      XML_CONFERENCE ),
         TOKEN( "config-item",                     XML_CONFIG_ITEM ),
@@ -532,6 +535,8 @@ namespace xmloff { namespace token {
         TOKEN( "dash",                            XML_DASH ),
         TOKEN( "dashed",                          XML_DASHED ),
         TOKEN( "data",                            XML_DATA ),
+        TOKEN( "data-bar",                        XML_DATA_BAR ),
+        TOKEN( "data-bar-entry",                  XML_DATA_BAR_ENTRY ),
         TOKEN( "data-cell-range-address",         XML_DATA_CELL_RANGE_ADDRESS ),
         TOKEN( "data-label-number",               XML_DATA_LABEL_NUMBER ),
         TOKEN( "data-label-symbol",               XML_DATA_LABEL_SYMBOL ),
@@ -1386,6 +1391,7 @@ namespace xmloff { namespace token {
         TOKEN( "position-left",                   XML_POSITION_LEFT ),
         TOKEN( "position-right",                  XML_POSITION_RIGHT ),
         TOKEN( "position-top",                    XML_POSITION_TOP ),
+        TOKEN( "positive-color",                  XML_POSITIVE_COLOR ),
         TOKEN( "italic",                          XML_POSTURE_ITALIC ),
         TOKEN( "normal",                          XML_POSTURE_NORMAL ),
         TOKEN( "oblique",                         XML_POSTURE_OBLIQUE ),


More information about the Libreoffice-commits mailing list