[Libreoffice-commits] core.git: sc/inc sc/source
Jochen Nitschke
j.nitschke+logerrit at ok.de
Fri Jul 22 10:33:55 UTC 2016
sc/inc/cellvalue.hxx | 2 +-
sc/inc/formulacell.hxx | 2 +-
sc/inc/global.hxx | 18 ++++++++++++------
sc/source/core/data/cellvalue.cxx | 2 +-
sc/source/core/data/colorscale.cxx | 4 ++--
sc/source/core/data/column.cxx | 12 ++----------
sc/source/core/data/documen4.cxx | 4 ++--
sc/source/core/data/formulacell.cxx | 12 ++++++------
sc/source/core/data/table2.cxx | 2 +-
sc/source/ui/undo/undocell.cxx | 4 ++--
10 files changed, 30 insertions(+), 32 deletions(-)
New commits:
commit 2a5a69de7f4696e5bf6e2e1ada414b46c6a4d983
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date: Fri Jul 22 10:22:14 2016 +0200
sc: convert SC_CLONECELL_... to typed_flags
Change-Id: I4ce14eecaa9fbdc007bbb39f0543099c75f2ffcb
Reviewed-on: https://gerrit.libreoffice.org/27428
Reviewed-by: Eike Rathke <erack at redhat.com>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/sc/inc/cellvalue.hxx b/sc/inc/cellvalue.hxx
index 6dcbc8f..ca7dc2e 100644
--- a/sc/inc/cellvalue.hxx
+++ b/sc/inc/cellvalue.hxx
@@ -59,7 +59,7 @@ struct SC_DLLPUBLIC ScCellValue
*/
void assign( const ScDocument& rDoc, const ScAddress& rPos );
- void assign( const ScCellValue& rOther, ScDocument& rDestDoc, int nCloneFlags = SC_CLONECELL_DEFAULT );
+ void assign(const ScCellValue& rOther, ScDocument& rDestDoc, ScCloneFlags nCloneFlags = ScCloneFlags::Default);
/**
* Set cell value at specified position in specified document.
diff --git a/sc/inc/formulacell.hxx b/sc/inc/formulacell.hxx
index 987704f..7aa569b 100644
--- a/sc/inc/formulacell.hxx
+++ b/sc/inc/formulacell.hxx
@@ -190,7 +190,7 @@ public:
const formula::FormulaGrammar::Grammar = formula::FormulaGrammar::GRAM_DEFAULT,
sal_uInt8 cMatInd = MM_NONE );
- ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags = SC_CLONECELL_DEFAULT );
+ ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, ScCloneFlags nCloneFlags = ScCloneFlags::Default);
size_t GetHash() const;
diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 15769bd..51679ea 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -220,27 +220,33 @@ enum class ScEnterMode {
#define SUBTOTAL_IGN_HIDDEN 0x02
#define SUBTOTAL_IGN_FILTERED 0x01
+enum class ScCloneFlags{
/** Default cell clone flags: do not start listening, do not adjust 3D refs to
old position, clone note captions of cell notes. */
-const int SC_CLONECELL_DEFAULT = 0x0000;
+ Default = 0x0000,
/** If set, cloned formula cells will start to listen to the document. */
-const int SC_CLONECELL_STARTLISTENING = 0x0001;
+ StartListening = 0x0001,
/** If set, relative 3D references of cloned formula cells will be adjusted to
old position (used while swapping cells for sorting a cell range). */
-const int SC_CLONECELL_ADJUST3DREL = 0x0002;
+ Adjust3Drel = 0x0002,
/** If set, the caption object of a cell note will not be cloned (used while
copying cells to undo document, where captions are handled in drawing undo). */
-const int SC_CLONECELL_NOCAPTION = 0x0004;
+ NoCaption = 0x0004,
/** If set, absolute refs will not transformed to external references */
-const int SC_CLONECELL_NOMAKEABS_EXTERNAL = 0x0008;
+ NoMakeAbsExternal = 0x0008,
/** If set, global named expressions will be converted to sheet-local named
expressions. */
-const int SC_CLONECELL_NAMES_TO_LOCAL = 0x0010;
+ NamesToLocal = 0x0010
+};
+namespace o3tl
+{
+ template<> struct typed_flags<ScCloneFlags> : is_typed_flags<ScCloneFlags, 0x1f> {};
+}
#ifndef DELETEZ
#define DELETEZ(pPtr) { delete pPtr; pPtr = 0; }
diff --git a/sc/source/core/data/cellvalue.cxx b/sc/source/core/data/cellvalue.cxx
index d6b71f1..25ed7d70 100644
--- a/sc/source/core/data/cellvalue.cxx
+++ b/sc/source/core/data/cellvalue.cxx
@@ -308,7 +308,7 @@ void ScCellValue::assign( const ScDocument& rDoc, const ScAddress& rPos )
}
}
-void ScCellValue::assign( const ScCellValue& rOther, ScDocument& rDestDoc, int nCloneFlags )
+void ScCellValue::assign(const ScCellValue& rOther, ScDocument& rDestDoc, ScCloneFlags nCloneFlags)
{
clear();
diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx
index 72c016c..da7f42e6 100644
--- a/sc/source/core/data/colorscale.cxx
+++ b/sc/source/core/data/colorscale.cxx
@@ -165,7 +165,7 @@ ScColorScaleEntry::ScColorScaleEntry(const ScColorScaleEntry& rEntry):
{
if(rEntry.mpCell)
{
- mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, SC_CLONECELL_NOMAKEABS_EXTERNAL));
+ mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, ScCloneFlags::NoMakeAbsExternal));
mpCell->StartListeningTo( mpCell->GetDocument() );
mpListener.reset(new ScFormulaListener(mpCell.get()));
}
@@ -179,7 +179,7 @@ ScColorScaleEntry::ScColorScaleEntry(ScDocument* pDoc, const ScColorScaleEntry&
{
if(rEntry.mpCell)
{
- mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, SC_CLONECELL_NOMAKEABS_EXTERNAL));
+ mpCell.reset(new ScFormulaCell(*rEntry.mpCell, *rEntry.mpCell->GetDocument(), rEntry.mpCell->aPos, ScCloneFlags::NoMakeAbsExternal));
mpCell->StartListeningTo( pDoc );
mpListener.reset(new ScFormulaListener(mpCell.get()));
}
diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 3bc430a..183327a 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1381,7 +1381,7 @@ class CopyByCloneHandler
InsertDeleteFlags mnCopyFlags;
sc::StartListeningType meListenType;
- int mnFormulaCellCloneFlags;
+ ScCloneFlags mnFormulaCellCloneFlags;
void setDefaultAttrToDest(size_t nRow)
{
@@ -1502,7 +1502,7 @@ public:
mpSharedStringPool(pSharedStringPool),
mnCopyFlags(nCopyFlags),
meListenType(sc::SingleCellListening),
- mnFormulaCellCloneFlags(bGlobalNamesToLocal ? SC_CLONECELL_NAMES_TO_LOCAL : 0)
+ mnFormulaCellCloneFlags(bGlobalNamesToLocal ? ScCloneFlags::NamesToLocal : ScCloneFlags::Default)
{
if (mpDestPos)
maDestPos = *mpDestPos;
@@ -1763,9 +1763,6 @@ void ScColumn::CopyScenarioFrom( const ScColumn& rSrcCol )
UpdateReferenceOnCopy(aRefCxt);
UpdateCompile();
}
-
- //TODO: make CopyToColumn "const" !!! (obsolete comment ?)
-
pPattern = aAttrIter.Next( nStart, nEnd );
}
}
@@ -1784,8 +1781,6 @@ void ScColumn::CopyScenarioTo( ScColumn& rDestCol ) const
sc::CopyToDocContext aCxt(*rDestCol.pDocument);
CopyToColumn(aCxt, nStart, nEnd, InsertDeleteFlags::CONTENTS, false, rDestCol);
- // UpdateUsed not needed, is already done in TestCopyScenario (obsolete comment ?)
-
sc::RefUpdateContext aRefCxt(*pDocument);
aRefCxt.meMode = URM_COPY;
aRefCxt.maRange = ScRange(rDestCol.nCol, nStart, rDestCol.nTab, rDestCol.nCol, nEnd, rDestCol.nTab);
@@ -1793,9 +1788,6 @@ void ScColumn::CopyScenarioTo( ScColumn& rDestCol ) const
rDestCol.UpdateReferenceOnCopy(aRefCxt);
rDestCol.UpdateCompile();
}
-
- //TODO: make CopyToColumn "const" !!! (obsolete comment ?)
-
pPattern = aAttrIter.Next( nStart, nEnd );
}
}
diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx
index 3f91377..d2dcdb2 100644
--- a/sc/source/core/data/documen4.cxx
+++ b/sc/source/core/data/documen4.cxx
@@ -297,7 +297,7 @@ void ScDocument::InsertMatrixFormula(SCCOL nCol1, SCROW nRow1,
maTabs[*itr]->SetFormulaCell(
nCol1, nRow1,
new ScFormulaCell(
- *pCell, *this, ScAddress(nCol1, nRow1, *itr), SC_CLONECELL_STARTLISTENING));
+ *pCell, *this, ScAddress(nCol1, nRow1, *itr), ScCloneFlags::StartListening));
}
ScAddress aBasePos(nCol1, nRow1, nTab1);
@@ -435,7 +435,7 @@ void ScDocument::InsertTableOp(const ScTabOpParam& rParam, // multiple (repeate
for (; itr != itrEnd && *itr < nMax; ++itr)
if( maTabs[*itr] )
maTabs[*itr]->SetFormulaCell(
- j, k, new ScFormulaCell(aRefCell, *this, ScAddress(j, k, *itr), SC_CLONECELL_STARTLISTENING));
+ j, k, new ScFormulaCell(aRefCell, *this, ScAddress(j, k, *itr), ScCloneFlags::StartListening));
}
}
diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx
index 407cd47..25a527f 100644
--- a/sc/source/core/data/formulacell.cxx
+++ b/sc/source/core/data/formulacell.cxx
@@ -804,7 +804,7 @@ ScFormulaCell::ScFormulaCell(
pDocument->AddSubTotalCell(this);
}
-ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, int nCloneFlags ) :
+ScFormulaCell::ScFormulaCell(const ScFormulaCell& rCell, ScDocument& rDoc, const ScAddress& rPos, ScCloneFlags nCloneFlags) :
SvtListener(),
aResult( rCell.aResult ),
eTempGrammar( rCell.eTempGrammar),
@@ -852,7 +852,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
{
if (!pDocument->IsClipboardSource() || aPos.Tab() != rCell.aPos.Tab())
{
- bool bGlobalNamesToLocal = ((nCloneFlags & SC_CLONECELL_NAMES_TO_LOCAL) != 0);
+ bool bGlobalNamesToLocal = ((nCloneFlags & ScCloneFlags::NamesToLocal) != ScCloneFlags::Default);
formula::FormulaToken* pToken = nullptr;
while((pToken = pCode->GetNextName())!= nullptr)
{
@@ -865,7 +865,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
}
bool bCopyBetweenDocs = pDocument->GetPool() != rCell.pDocument->GetPool();
- if (bCopyBetweenDocs && !(nCloneFlags & SC_CLONECELL_NOMAKEABS_EXTERNAL))
+ if (bCopyBetweenDocs && !(nCloneFlags & ScCloneFlags::NoMakeAbsExternal))
{
pCode->ReadjustAbsolute3DReferences( rCell.pDocument, &rDoc, rCell.aPos);
}
@@ -880,7 +880,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
pCode->AdjustReferenceOnCopy( aPos);
}
- if ( nCloneFlags & SC_CLONECELL_ADJUST3DREL )
+ if ( nCloneFlags & ScCloneFlags::Adjust3Drel )
pCode->ReadjustRelative3DReferences( rCell.aPos, aPos );
if( !bCompile )
@@ -930,7 +930,7 @@ ScFormulaCell::ScFormulaCell( const ScFormulaCell& rCell, ScDocument& rDoc, cons
}
}
- if( nCloneFlags & SC_CLONECELL_STARTLISTENING )
+ if( nCloneFlags & ScCloneFlags::StartListening )
StartListeningTo( &rDoc );
if (bSubTotal)
@@ -962,7 +962,7 @@ ScFormulaCell* ScFormulaCell::Clone() const
ScFormulaCell* ScFormulaCell::Clone( const ScAddress& rPos ) const
{
- return new ScFormulaCell(*this, *pDocument, rPos, SC_CLONECELL_DEFAULT);
+ return new ScFormulaCell(*this, *pDocument, rPos, ScCloneFlags::Default);
}
size_t ScFormulaCell::GetHash() const
diff --git a/sc/source/core/data/table2.cxx b/sc/source/core/data/table2.cxx
index 788ce13..1f9ac65 100644
--- a/sc/source/core/data/table2.cxx
+++ b/sc/source/core/data/table2.cxx
@@ -806,7 +806,7 @@ public:
}
ScFormulaCell* pNew = new ScFormulaCell(
- *p, mrClipTab.GetDoc(), getDestPos(nRow), SC_CLONECELL_STARTLISTENING);
+ *p, mrClipTab.GetDoc(), getDestPos(nRow), ScCloneFlags::StartListening);
// rotate reference
// for Cut, the referneces are later adjusted through UpdateTranspose
diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx
index 74711df..8e3c685 100644
--- a/sc/source/ui/undo/undocell.cxx
+++ b/sc/source/ui/undo/undocell.cxx
@@ -230,7 +230,7 @@ void ScUndoEnterData::Undo()
for (Value & rVal : maOldValues)
{
ScCellValue aNewCell;
- aNewCell.assign(rVal.maCell, rDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.assign(rVal.maCell, rDoc, ScCloneFlags::StartListening);
ScAddress aPos = maPos;
aPos.SetTab(rVal.mnTab);
aNewCell.release(rDoc, aPos);
@@ -342,7 +342,7 @@ void ScUndoEnterValue::Undo()
ScDocument& rDoc = pDocShell->GetDocument();
ScCellValue aNewCell;
- aNewCell.assign(maOldCell, rDoc, SC_CLONECELL_STARTLISTENING);
+ aNewCell.assign(maOldCell, rDoc, ScCloneFlags::StartListening);
aNewCell.release(rDoc, aPos);
pDocShell->PostPaintCell( aPos );
More information about the Libreoffice-commits
mailing list