Kaydet (Commit) 2923cb0b authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Move the need for several ugly const_casts deeper down to just one place

Change-Id: I2cdd66b9819f070548c2a0af7388d9bfbd3689c1
Reviewed-on: https://gerrit.libreoffice.org/45144Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarTor Lillqvist <tml@collabora.com>
üst 3f289fef
......@@ -139,7 +139,7 @@ public:
void SetPattern( SCROW nRow, const ScPatternAttr* pPattern, bool bPutToPool = false );
void SetPatternArea( SCROW nStartRow, SCROW nEndRow, const ScPatternAttr* pPattern,
bool bPutToPool = false, ScEditDataArray* pDataArray = nullptr );
void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle );
void ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle );
void ApplyCacheArea( SCROW nStartRow, SCROW nEndRow, SfxItemPoolCache* pCache,
ScEditDataArray* pDataArray = nullptr, bool* const pIsChanged = nullptr );
void SetAttrEntries(std::vector<ScAttrEntry> && vNewData);
......
......@@ -605,7 +605,7 @@ void ScAttrArray::SetPatternArea(SCROW nStartRow, SCROW nEndRow, const ScPattern
#endif
}
void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet* pStyle )
void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
{
if (ValidRow(nStartRow) && ValidRow(nEndRow))
{
......@@ -625,7 +625,7 @@ void ScAttrArray::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, ScStyleSheet*
{
const ScPatternAttr* pOldPattern = mvData[nPos].pPattern;
std::unique_ptr<ScPatternAttr> pNewPattern(new ScPatternAttr(*pOldPattern));
pNewPattern->SetStyleSheet(pStyle);
pNewPattern->SetStyleSheet(const_cast<ScStyleSheet*>(&rStyle));
SCROW nY1 = nStart;
SCROW nY2 = mvData[nPos].nEndRow;
nStart = mvData[nPos].nEndRow + 1;
......
......@@ -567,7 +567,7 @@ void ScColumn::ApplyStyle( SCROW nRow, const ScStyleSheet* rStyle )
void ScColumn::ApplyStyleArea( SCROW nStartRow, SCROW nEndRow, const ScStyleSheet& rStyle )
{
pAttrArray->ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>(&rStyle));
pAttrArray->ApplyStyleArea(nStartRow, nEndRow, rStyle);
}
void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData& rMark)
......@@ -579,7 +579,7 @@ void ScColumn::ApplySelectionStyle(const ScStyleSheet& rStyle, const ScMarkData&
{
ScMultiSelIter aMultiIter( rMark.GetMultiSelData(), nCol );
while (aMultiIter.Next( nTop, nBottom ))
pAttrArray->ApplyStyleArea(nTop, nBottom, const_cast<ScStyleSheet*>(&rStyle));
pAttrArray->ApplyStyleArea(nTop, nBottom, rStyle);
}
}
......
......@@ -2569,12 +2569,12 @@ void ScTable::ApplyStyleArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, S
nEndCol = aCol.size() - 1;
for (SCCOL i = nStartCol; i <= nEndCol; i++)
aCol[i].ApplyStyleArea(nStartRow, nEndRow, rStyle);
aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, rStyle );
}
else
{
CreateColumnIfNotExists( nStartCol - 1 );
aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, const_cast<ScStyleSheet*>( &rStyle ) );
aDefaultColAttrArray.ApplyStyleArea(nStartRow, nEndRow, rStyle );
}
}
else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment