[Libreoffice-commits] .: Branch 'feature/cond-format-rework' - 2 commits - sc/inc sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Oct 5 10:12:36 PDT 2012
sc/inc/attarray.hxx | 2
sc/inc/attrib.hxx | 24 ++++++++++
sc/inc/column.hxx | 1
sc/inc/document.hxx | 1
sc/inc/scitems.hxx | 87 ++++++++++++++++++--------------------
sc/inc/table.hxx | 1
sc/source/core/data/attarray.cxx | 49 +++++++++++++++++++++
sc/source/core/data/attrib.cxx | 47 ++++++++++++++++++++
sc/source/core/data/column.cxx | 5 ++
sc/source/core/data/docpool.cxx | 4 -
sc/source/core/data/document.cxx | 11 ++++
sc/source/core/data/fillinfo.cxx | 73 +++++++++++++++++--------------
sc/source/core/data/table2.cxx | 17 +++++++
sc/source/ui/docshell/docfunc.cxx | 18 +------
14 files changed, 245 insertions(+), 95 deletions(-)
New commits:
commit c89de41bdc329186aa3ce9540ca7be8f66fb7860
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Fri Oct 5 19:05:25 2012 +0200
support overlapping conditional formats
Still missing:
*Removing conditional formats
*Handling of Manage Names dialog
*UNO
*Undo/Redo
*Import/export
*Adjusting the dialogs to support this
Change-Id: I72481cfb807fee2c3a1546222fe7e786d515ab44
diff --git a/sc/inc/attarray.hxx b/sc/inc/attarray.hxx
index 1f8d9f2..ded335e 100644
--- a/sc/inc/attarray.hxx
+++ b/sc/inc/attarray.hxx
@@ -138,6 +138,8 @@ public:
void ApplyLineStyleArea( SCROW nStartRow, SCROW nEndRow,
const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
+ void AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
+
void ClearItems( SCROW nStartRow, SCROW nEndRow, const sal_uInt16* pWhich );
void ChangeIndent( SCROW nStartRow, SCROW nEndRow, bool bIncrement );
diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx
index 0418d78..eb051fd 100644
--- a/sc/inc/attrib.hxx
+++ b/sc/inc/attrib.hxx
@@ -393,6 +393,30 @@ private:
sal_uInt16 mnHeight;
};
+class ScCondFormatItem : public SfxPoolItem
+{
+public:
+ TYPEINFO();
+
+ explicit ScCondFormatItem();
+ explicit ScCondFormatItem(sal_uInt32 nIndex);
+ explicit ScCondFormatItem(const std::vector<sal_uInt32>& nIndex);
+
+ virtual ~ScCondFormatItem();
+
+ virtual int operator==(const SfxPoolItem& rCmp ) const;
+ virtual ScCondFormatItem* Clone( SfxItemPool* = 0 ) const;
+
+ const std::vector<sal_uInt32>& GetCondFormatData() const;
+ void AddCondFormatData( sal_uInt32 nIndex );
+ void SetCondFormatData( const std::vector<sal_uInt32>& aIndex );
+ void RemoveCondFormatData( sal_uInt32 nIndex );
+
+private:
+
+ std::vector<sal_uInt32> maIndex;
+};
+
// ============================================================================
#endif
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 34e05cb..388b121 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -317,6 +317,7 @@ public:
void ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark);
void ApplySelectionLineStyle( const ScMarkData& rMark,
const ::editeng::SvxBorderLine* pLine, bool bColorOnly );
+ void AddCondFormat(SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex );
const ScStyleSheet* GetStyle( SCROW nRow ) const;
const ScStyleSheet* GetSelectionStyle( const ScMarkData& rMark, bool& rFound ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index da7b575..684a16a 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -1155,6 +1155,7 @@ public:
SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
const ScPatternAttr* GetSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
ScPatternAttr* CreateSelectionPattern( const ScMarkData& rMark, bool bDeep = true );
+ SC_DLLPUBLIC void AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex );
SC_DLLPUBLIC ScConditionalFormat* GetCondFormat( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
SC_DLLPUBLIC const SfxItemSet* GetCondResult( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx
index 2f219e2..e644854 100644
--- a/sc/inc/scitems.hxx
+++ b/sc/inc/scitems.hxx
@@ -118,51 +118,51 @@
#define ATTR_VALIDDATA 153
#define ATTR_CONDITIONAL 154
-#define ATTR_PATTERN_END 155 // end cell-attribute-pattern
+#define ATTR_PATTERN_END 154 // end cell-attribute-pattern
-#define ATTR_PATTERN 156
+#define ATTR_PATTERN 155
// page attributes
-#define ATTR_LRSPACE 157 // editor: PageDesc-TabPage
-#define ATTR_ULSPACE 158
-#define ATTR_PAGE 159
-#define ATTR_PAGE_PAPERTRAY 160
-#define ATTR_PAGE_PAPERBIN 161
-#define ATTR_PAGE_SIZE 162
-#define ATTR_PAGE_MAXSIZE 163
-#define ATTR_PAGE_HORCENTER 164
-#define ATTR_PAGE_VERCENTER 165
-
-#define ATTR_PAGE_ON 166 // editor: header/footer-page
-#define ATTR_PAGE_DYNAMIC 167
-#define ATTR_PAGE_SHARED 168
-
-#define ATTR_PAGE_NOTES 169 // editor: table
-#define ATTR_PAGE_GRID 170
-#define ATTR_PAGE_HEADERS 171
-#define ATTR_PAGE_CHARTS 172
-#define ATTR_PAGE_OBJECTS 173
-#define ATTR_PAGE_DRAWINGS 174
-#define ATTR_PAGE_TOPDOWN 175
-#define ATTR_PAGE_SCALE 176
-#define ATTR_PAGE_SCALETOPAGES 177
-#define ATTR_PAGE_FIRSTPAGENO 178
-
-#define ATTR_PAGE_PRINTAREA 179 // editor: print areas
-#define ATTR_PAGE_REPEATROW 180
-#define ATTR_PAGE_REPEATCOL 181
-#define ATTR_PAGE_PRINTTABLES 182
-
-#define ATTR_PAGE_HEADERLEFT 183 // contents of header/
-#define ATTR_PAGE_FOOTERLEFT 184 // footer (left)
-#define ATTR_PAGE_HEADERRIGHT 185 // contents of header/
-#define ATTR_PAGE_FOOTERRIGHT 186 // footer (right)
-#define ATTR_PAGE_HEADERSET 187 // the corresponding sets
-#define ATTR_PAGE_FOOTERSET 188
-
-#define ATTR_PAGE_FORMULAS 189
-#define ATTR_PAGE_NULLVALS 190
-
-#define ATTR_PAGE_SCALETO 191 // #i8868# scale printout to width/height
+#define ATTR_LRSPACE 156 // editor: PageDesc-TabPage
+#define ATTR_ULSPACE 157
+#define ATTR_PAGE 158
+#define ATTR_PAGE_PAPERTRAY 159
+#define ATTR_PAGE_PAPERBIN 160
+#define ATTR_PAGE_SIZE 161
+#define ATTR_PAGE_MAXSIZE 162
+#define ATTR_PAGE_HORCENTER 163
+#define ATTR_PAGE_VERCENTER 164
+
+#define ATTR_PAGE_ON 165 // editor: header/footer-page
+#define ATTR_PAGE_DYNAMIC 166
+#define ATTR_PAGE_SHARED 167
+
+#define ATTR_PAGE_NOTES 168 // editor: table
+#define ATTR_PAGE_GRID 169
+#define ATTR_PAGE_HEADERS 170
+#define ATTR_PAGE_CHARTS 171
+#define ATTR_PAGE_OBJECTS 172
+#define ATTR_PAGE_DRAWINGS 173
+#define ATTR_PAGE_TOPDOWN 174
+#define ATTR_PAGE_SCALE 175
+#define ATTR_PAGE_SCALETOPAGES 176
+#define ATTR_PAGE_FIRSTPAGENO 177
+
+#define ATTR_PAGE_PRINTAREA 178 // editor: print areas
+#define ATTR_PAGE_REPEATROW 179
+#define ATTR_PAGE_REPEATCOL 180
+#define ATTR_PAGE_PRINTTABLES 181
+
+#define ATTR_PAGE_HEADERLEFT 182 // contents of header/
+#define ATTR_PAGE_FOOTERLEFT 183 // footer (left)
+#define ATTR_PAGE_HEADERRIGHT 184 // contents of header/
+#define ATTR_PAGE_FOOTERRIGHT 185 // footer (right)
+#define ATTR_PAGE_HEADERSET 186 // the corresponding sets
+#define ATTR_PAGE_FOOTERSET 187
+
+#define ATTR_PAGE_FORMULAS 188
+#define ATTR_PAGE_NULLVALS 189
+
+#define ATTR_PAGE_SCALETO 190 // #i8868# scale printout to width/height
#define ATTR_ENDINDEX ATTR_PAGE_SCALETO // end of pool-range
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 2b205e5..757f357 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -543,6 +543,7 @@ public:
void SetPattern( SCCOL nCol, SCROW nRow, const ScPatternAttr& rAttr, bool bPutToPool = false );
void ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
const ScPatternAttr& rPattern, short nNewType );
+ void AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex );
void ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle );
void ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, const ScStyleSheet& rStyle );
diff --git a/sc/source/core/data/attarray.cxx b/sc/source/core/data/attarray.cxx
index bcba4de..4820cb1 100644
--- a/sc/source/core/data/attarray.cxx
+++ b/sc/source/core/data/attarray.cxx
@@ -273,6 +273,55 @@ const ScPatternAttr* ScAttrArray::GetPatternRange( SCROW& rStartRow,
return NULL;
}
+void ScAttrArray::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
+{
+ if(!VALIDROW(nStartRow) || !VALIDROW(nEndRow))
+ return;
+
+ if(nEndRow < nStartRow)
+ return;
+
+ SCROW nTempStartRow = nStartRow;
+ SCROW nTempEndRow = nEndRow;
+
+ do
+ {
+ const ScPatternAttr* pPattern = GetPattern(nTempStartRow);
+
+ ScPatternAttr aPattern( pDocument->GetPool() );
+ if(pPattern)
+ {
+ SCROW nPatternStartRow;
+ SCROW nPatternEndRow;
+ GetPatternRange( nPatternStartRow, nPatternEndRow, nTempStartRow );
+
+ nTempEndRow = std::min<SCROW>( nPatternEndRow, nEndRow );
+ const SfxPoolItem* pItem = NULL;
+ SfxItemState eState = pPattern->GetItemSet().GetItemState( ATTR_CONDITIONAL, true, &pItem );
+ std::vector< sal_uInt32 > aCondFormatData;
+ if(pItem)
+ aCondFormatData = static_cast<const ScCondFormatItem*>(pItem)->GetCondFormatData();
+ aCondFormatData.push_back(nIndex);
+
+ ScCondFormatItem aItem;
+ aItem.SetCondFormatData( aCondFormatData );
+ aPattern.GetItemSet().Put( aItem );
+ }
+ else
+ {
+ ScCondFormatItem aItem;
+ aItem.AddCondFormatData(nIndex);
+ aPattern.GetItemSet().Put( aItem );
+ nTempEndRow = nEndRow;
+ }
+
+ SetPatternArea( nTempStartRow, nTempEndRow, &aPattern, true );
+ nTempStartRow = nTempEndRow + 1;
+ }
+ while(nTempEndRow < nEndRow);
+
+}
+
//------------------------------------------------------------------------
void ScAttrArray::SetPattern( SCROW nRow, const ScPatternAttr* pPattern, bool bPutToPool )
diff --git a/sc/source/core/data/attrib.cxx b/sc/source/core/data/attrib.cxx
index e2f2c55..3ad9b8b 100644
--- a/sc/source/core/data/attrib.cxx
+++ b/sc/source/core/data/attrib.cxx
@@ -60,6 +60,7 @@ TYPEINIT1(ScPageHFItem, SfxPoolItem);
TYPEINIT1(ScViewObjectModeItem, SfxEnumItem);
TYPEINIT1(ScDoubleItem, SfxPoolItem);
TYPEINIT1(ScPageScaleToItem, SfxPoolItem);
+TYPEINIT1(ScCondFormatItem, SfxPoolItem);
//------------------------------------------------------------------------
@@ -1222,5 +1223,51 @@ bool ScPageScaleToItem::PutValue( const uno::Any& rAny, sal_uInt8 nMemberId )
// ============================================================================
+ScCondFormatItem::ScCondFormatItem():
+ SfxPoolItem( ATTR_CONDITIONAL )
+{
+}
+
+ScCondFormatItem::ScCondFormatItem( sal_uInt32 nIndex ):
+ SfxPoolItem( ATTR_CONDITIONAL )
+{
+ maIndex.push_back(nIndex);
+}
+
+ScCondFormatItem::ScCondFormatItem( const std::vector<sal_uInt32>& rIndex ):
+ SfxPoolItem( ATTR_CONDITIONAL ),
+ maIndex( rIndex )
+{
+}
+
+ScCondFormatItem::~ScCondFormatItem()
+{
+}
+
+int ScCondFormatItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ return maIndex == static_cast<const ScCondFormatItem&>(rCmp).maIndex;
+}
+
+ScCondFormatItem* ScCondFormatItem::Clone(SfxItemPool*) const
+{
+ return new ScCondFormatItem(maIndex);
+}
+
+const std::vector<sal_uInt32>& ScCondFormatItem::GetCondFormatData() const
+{
+ return maIndex;
+}
+
+void ScCondFormatItem::AddCondFormatData( sal_uInt32 nIndex )
+{
+ maIndex.push_back(nIndex);
+}
+
+void ScCondFormatItem::SetCondFormatData( const std::vector<sal_uInt32>& rIndex )
+{
+ maIndex = rIndex;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index db99462..446ddc1 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -498,6 +498,11 @@ void ScColumn::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
}
}
+void ScColumn::AddCondFormat( SCROW nStartRow, SCROW nEndRow, sal_uInt32 nIndex )
+{
+ pAttrArray->AddCondFormat( nStartRow, nEndRow, nIndex );
+}
+
void ScColumn::ApplyStyle( SCROW nRow, const ScStyleSheet& rStyle )
{
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index b0a8d7d..cc8915f 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -287,7 +287,7 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool, sal_Bool bLoadRefCounts )
ppPoolDefaults[ ATTR_BORDER_INNER - ATTR_STARTINDEX ] = pGlobalBorderInnerAttr;
ppPoolDefaults[ ATTR_SHADOW - ATTR_STARTINDEX ] = new SvxShadowItem( ATTR_SHADOW );
ppPoolDefaults[ ATTR_VALIDDATA - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALIDDATA, 0 );
- ppPoolDefaults[ ATTR_CONDITIONAL - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_CONDITIONAL, 0 );
+ ppPoolDefaults[ ATTR_CONDITIONAL - ATTR_STARTINDEX ] = new ScCondFormatItem;
// GetRscString funktioniert erst nach ScGlobal::Init, zu erkennen am EmptyBrushItem
//! zusaetzliche Methode ScGlobal::IsInit() oder so...
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index ade6c8e..5ebd9f5 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4211,6 +4211,17 @@ void ScDocument::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
maTabs[*itr]->ApplyPatternIfNumberformatIncompatible( rRange, rPattern, nNewType );
}
+void ScDocument::AddCondFormatData( const ScRangeList& rRange, SCTAB nTab, sal_uInt32 nIndex )
+{
+ if(!static_cast<SCTAB>(nTab) < maTabs.size())
+ return;
+
+ if(!maTabs[nTab])
+ return;
+
+ maTabs[nTab]->AddCondFormatData(rRange, nIndex);
+}
+
void ScDocument::ApplyStyle( SCCOL nCol, SCROW nRow, SCTAB nTab, const ScStyleSheet& rStyle)
{
diff --git a/sc/source/core/data/fillinfo.cxx b/sc/source/core/data/fillinfo.cxx
index 29fee72..01204d6 100644
--- a/sc/source/core/data/fillinfo.cxx
+++ b/sc/source/core/data/fillinfo.cxx
@@ -477,12 +477,8 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
else
bHidden = bHideFormula = false;
- sal_uLong nConditional = ((const SfxUInt32Item&)pPattern->
- GetItem(ATTR_CONDITIONAL)).GetValue();
-
- const ScConditionalFormat* pCondForm = NULL;
- if ( nConditional && pCondFormList )
- pCondForm = pCondFormList->GetFormat( nConditional );
+ const std::vector<sal_uInt32>& rCondFormats = static_cast<const ScCondFormatItem&>(pPattern->GetItem(ATTR_CONDITIONAL)).GetCondFormatData();
+ bool bContainsCondFormat = !rCondFormats.empty();
do
{
@@ -493,7 +489,7 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
RowInfo* pThisRowInfo = &pRowInfo[nArrY];
if (pBackground != pDefBackground) // Spalten-HG == Standard ?
pThisRowInfo->bEmptyBack = false;
- if (pCondForm)
+ if (bContainsCondFormat)
pThisRowInfo->bEmptyBack = false;
if (bAutoFilter)
pThisRowInfo->bAutoFilter = true;
@@ -529,41 +525,50 @@ void ScDocument::FillInfo( ScTableInfo& rTabInfo, SCCOL nX1, SCROW nY1, SCCOL nX
pThisRowInfo->bEmptyBack = false;
}
- if ( pCondForm )
+ if ( bContainsCondFormat )
{
- ScCondFormatData aData = pCondForm->GetData( pInfo->pCell,
- ScAddress( nX, nCurRow, nTab ) );
- if (!aData.aStyleName.isEmpty())
+ bool bFound = false;
+ for(std::vector<sal_uInt32>::const_iterator itr = rCondFormats.begin();
+ itr != rCondFormats.end() && !bFound; ++itr)
{
- SfxStyleSheetBase* pStyleSheet =
- pStlPool->Find( aData.aStyleName, SFX_STYLE_FAMILY_PARA );
- if ( pStyleSheet )
+ ScConditionalFormat* pCondForm = pCondFormList->GetFormat(*itr);
+ ScCondFormatData aData = pCondForm->GetData( pInfo->pCell,
+ ScAddress( nX, nCurRow, nTab ) );
+ if (!aData.aStyleName.isEmpty())
{
- //! Style-Sets cachen !!!
- pInfo->pConditionSet = &pStyleSheet->GetItemSet();
- bAnyCondition = true;
-
- // we need to check already here for protected cells
- const SfxPoolItem* pItem;
- if ( bTabProtect && pInfo->pConditionSet->GetItemState( ATTR_PROTECTION, true, &pItem ) == SFX_ITEM_SET )
+ SfxStyleSheetBase* pStyleSheet =
+ pStlPool->Find( aData.aStyleName, SFX_STYLE_FAMILY_PARA );
+ if ( pStyleSheet )
{
- const ScProtectionAttr* pProtAttr = static_cast<const ScProtectionAttr*>(pItem);
- bHidden = pProtAttr->GetHideCell();
- bHideFormula = pProtAttr->GetHideFormula();
+ //! Style-Sets cachen !!!
+ pInfo->pConditionSet = &pStyleSheet->GetItemSet();
+ bAnyCondition = true;
- }
+ // we need to check already here for protected cells
+ const SfxPoolItem* pItem;
+ if ( bTabProtect && pInfo->pConditionSet->GetItemState( ATTR_PROTECTION, true, &pItem ) == SFX_ITEM_SET )
+ {
+ const ScProtectionAttr* pProtAttr = static_cast<const ScProtectionAttr*>(pItem);
+ bHidden = pProtAttr->GetHideCell();
+ bHideFormula = pProtAttr->GetHideFormula();
+
+ }
+ bFound = true;
+ }
+ // if style is not there, treat like no condition
+ }
+ if(aData.pColorScale)
+ {
+ pInfo->pColorScale = aData.pColorScale;
+ bFound = true;
}
- // if style is not there, treat like no condition
- }
- if(aData.pColorScale)
- {
- pInfo->pColorScale = aData.pColorScale;
- }
- if(aData.pDataBar)
- {
- pInfo->pDataBar = aData.pDataBar;
+ if(aData.pDataBar)
+ {
+ pInfo->pDataBar = aData.pDataBar;
+ bFound = true;
+ }
}
}
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index eb22ac6..e3d3864 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -2146,6 +2146,23 @@ void ScTable::ApplyPatternIfNumberformatIncompatible( const ScRange& rRange,
}
}
+void ScTable::AddCondFormatData( const ScRangeList& rRange, sal_uInt32 nIndex )
+{
+ size_t n = rRange.size();
+ for(size_t i = 0; i < n; ++i)
+ {
+ const ScRange* pRange = rRange[i];
+ SCCOL nColStart = pRange->aStart.Col();
+ SCCOL nColEnd = pRange->aEnd.Col();
+ SCROW nRowStart = pRange->aStart.Row();
+ SCROW nRowEnd = pRange->aEnd.Row();
+ for(SCCOL nCol = nColStart; nCol <= nColEnd; ++nCol)
+ {
+ aCol[nCol].AddCondFormat(nRowStart, nRowEnd, nIndex);
+ }
+ }
+}
+
void ScTable::ApplyStyle( SCCOL nCol, SCROW nRow, const ScStyleSheet& rStyle )
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 52b5c08..c68b03d 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -5064,21 +5064,11 @@ namespace {
void RemoveCondFormatAttributes(ScDocument* pDoc, const ScConditionalFormat* pFormat)
{
const ScRangeList& rRangeList = pFormat->GetRange();
-
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, 0 ) );
- ScMarkData aMarkData;
- aMarkData.MarkFromRangeList(rRangeList, true);
- pDoc->ApplySelectionPattern( aPattern , aMarkData );
}
-void SetConditionalFormatAttributes(ScDocument* pDoc, const ScRangeList& rRanges, sal_uLong nIndex)
+void SetConditionalFormatAttributes(ScDocument* pDoc, const ScRangeList& rRanges, sal_uLong nIndex, SCTAB nTab)
{
- ScPatternAttr aPattern( pDoc->GetPool() );
- aPattern.GetItemSet().Put( SfxUInt32Item( ATTR_CONDITIONAL, nIndex ) );
- ScMarkData aMarkData;
- aMarkData.MarkFromRangeList(rRanges, true);
- pDoc->ApplySelectionPattern( aPattern , aMarkData );
+ pDoc->AddCondFormatData( rRanges, nTab, nIndex );
}
}
@@ -5112,7 +5102,7 @@ void ScDocFunc::ReplaceConditionalFormat( sal_uLong nOldFormat, ScConditionalFor
sal_uLong nIndex = pDoc->AddCondFormat(pFormat, nTab);
- SetConditionalFormatAttributes(pDoc, rRanges, nIndex);
+ SetConditionalFormatAttributes(pDoc, rRanges, nIndex, nTab);
pDoc->SetStreamValid(nTab, false);
}
@@ -5142,7 +5132,7 @@ void ScDocFunc::SetConditionalFormatList( ScConditionalFormatList* pList, SCTAB
{
sal_uLong nIndex = itr->GetKey();
const ScRangeList& rRange = itr->GetRange();
- SetConditionalFormatAttributes(pDoc, rRange, nIndex);
+ SetConditionalFormatAttributes(pDoc, rRange, nIndex, nTab);
}
pDoc->SetCondFormList(pList, nTab);
commit b2a0762db05871c951e811301c76d39358d676b0
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Thu Oct 4 23:25:19 2012 +0200
remove unused ATTR_COLORSCALE
Change-Id: I8118127b21144962275cb4486881b1e63b06ff0a
diff --git a/sc/inc/scitems.hxx b/sc/inc/scitems.hxx
index 57073f3..2f219e2 100644
--- a/sc/inc/scitems.hxx
+++ b/sc/inc/scitems.hxx
@@ -117,7 +117,6 @@
#define ATTR_SHADOW 152
#define ATTR_VALIDDATA 153
#define ATTR_CONDITIONAL 154
-#define ATTR_COLORSCALE 155
#define ATTR_PATTERN_END 155 // end cell-attribute-pattern
diff --git a/sc/source/core/data/docpool.cxx b/sc/source/core/data/docpool.cxx
index f2c9661..b0a8d7d 100644
--- a/sc/source/core/data/docpool.cxx
+++ b/sc/source/core/data/docpool.cxx
@@ -150,7 +150,6 @@ static SfxItemInfo const aItemInfos[] =
{ SID_ATTR_BORDER_SHADOW, SFX_ITEM_POOLABLE }, // ATTR_SHADOW
{ 0, SFX_ITEM_POOLABLE }, // ATTR_VALIDDATA
{ 0, SFX_ITEM_POOLABLE }, // ATTR_CONDITIONAL
- { 0, SFX_ITEM_POOLABLE }, // ATTR_COLORSCALE
{ 0, SFX_ITEM_POOLABLE }, // ATTR_PATTERN
{ SID_ATTR_LRSPACE, SFX_ITEM_POOLABLE }, // ATTR_LRSPACE
{ SID_ATTR_ULSPACE, SFX_ITEM_POOLABLE }, // ATTR_ULSPACE
@@ -289,7 +288,6 @@ ScDocumentPool::ScDocumentPool( SfxItemPool* pSecPool, sal_Bool bLoadRefCounts )
ppPoolDefaults[ ATTR_SHADOW - ATTR_STARTINDEX ] = new SvxShadowItem( ATTR_SHADOW );
ppPoolDefaults[ ATTR_VALIDDATA - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_VALIDDATA, 0 );
ppPoolDefaults[ ATTR_CONDITIONAL - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_CONDITIONAL, 0 );
- ppPoolDefaults[ ATTR_COLORSCALE - ATTR_STARTINDEX ] = new SfxUInt32Item( ATTR_COLORSCALE, 0 );
// GetRscString funktioniert erst nach ScGlobal::Init, zu erkennen am EmptyBrushItem
//! zusaetzliche Methode ScGlobal::IsInit() oder so...
More information about the Libreoffice-commits
mailing list