[Libreoffice-commits] .: 2 commits - sc/inc sc/qa sc/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Tue Jan 29 06:57:40 PST 2013
sc/inc/document.hxx | 5 ---
sc/qa/unit/ucalc.cxx | 2 -
sc/source/core/data/documen2.cxx | 3 --
sc/source/core/data/document.cxx | 3 --
sc/source/ui/docshell/editable.cxx | 48 +++++++++++++++++--------------------
sc/source/ui/inc/editable.hxx | 11 +++-----
6 files changed, 29 insertions(+), 43 deletions(-)
New commits:
commit f4b3cef45cc8c02ccc7139c644ac4b20079bbc5d
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Tue Jan 29 00:09:59 2013 -0500
We don't need this hack anymore for unit test.
I've addressed the root cause the right way.
Change-Id: I1b3b13d28e4acc9f9ec814c0ad242166aa34a65e
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 3874916..b857cb7 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -403,10 +403,6 @@ private:
::std::set<ScFormulaCell*> maSubTotalCells;
- // quick and ugly hack to fix the ScEditableTester problem in ucalc
- // write a clean fix for this as soon as possible
- bool mbIsInTest;
-
public:
SC_DLLPUBLIC sal_uLong GetCellCount() const; // all cells
SCSIZE GetCellCount(SCTAB nTab, SCCOL nCol) const;
@@ -1102,7 +1098,6 @@ public:
bool bColInfo = false, bool bRowInfo = false );
SC_DLLPUBLIC void InitUndoSelected( ScDocument* pSrcDoc, const ScMarkData& rTabSelection,
bool bColInfo = false, bool bRowInfo = false );
- void SetInTest() { mbIsInTest = true; }
// don't use anymore:
void CopyToDocument(SCCOL nCol1, SCROW nRow1, SCTAB nTab1,
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6a2ac0f..c6778a4 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -5150,7 +5150,6 @@ void Test::testMergedCells()
ScRange aRange(0,2,0,MAXCOL,2,0);
ScMarkData aMark;
aMark.SetMarkArea(aRange);
- m_pDoc->SetInTest();
m_xDocShRef->GetDocFunc().InsertCells(aRange, &aMark, INS_INSROWS, true, true);
m_pDoc->ExtendMerge(1, 1, nEndCol, nEndRow, 0, false);
cout << nEndRow << nEndCol;
@@ -5479,7 +5478,6 @@ void Test::testCopyPasteFormulas()
m_pDoc->SetString(0,4,0, "=$Sheet2.A$1");
// to prevent ScEditableTester in ScDocFunc::MoveBlock
- m_pDoc->SetInTest();
ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,0,0), 1.0);
ASSERT_DOUBLES_EQUAL(m_pDoc->GetValue(0,1,0), 1.0);
ScDocFunc& rDocFunc = m_xDocShRef->GetDocFunc();
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 79f90f4..f182316 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -206,8 +206,7 @@ ScDocument::ScDocument( ScDocumentMode eMode,
mbChangeReadOnlyEnabled( false ),
mbStreamValidLocked( false ),
mbUserInteractionEnabled(true),
- mnNamedRangesLockCount( 0 ),
- mbIsInTest( false )
+ mnNamedRangesLockCount(0)
{
SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index d2ff1ee..7905d6e 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -4743,8 +4743,7 @@ bool ScDocument::IsBlockEditable( SCTAB nTab, SCCOL nStartCol, SCROW nStartRow,
bool* pOnlyNotBecauseOfMatrix /* = NULL */ ) const
{
// import into read-only document is possible
- // TODO: come up with a clean solution for the testing problem
- if ( !bImportingXML && !mbChangeReadOnlyEnabled && pShell && (pShell->IsReadOnly()&&!mbIsInTest) )
+ if (!bImportingXML && !mbChangeReadOnlyEnabled && pShell && pShell->IsReadOnly())
{
if ( pOnlyNotBecauseOfMatrix )
*pOnlyNotBecauseOfMatrix = false;
commit 0532733965f78f71a41983815d4e0525c07f9019
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date: Mon Jan 28 23:56:12 2013 -0500
Bool cleanup with ScEditableTester.
Change-Id: If4ae85bec451897f5c22397f4301200d1d3c77ac
diff --git a/sc/source/ui/docshell/editable.cxx b/sc/source/ui/docshell/editable.cxx
index fce1978..2664e9e 100644
--- a/sc/source/ui/docshell/editable.cxx
+++ b/sc/source/ui/docshell/editable.cxx
@@ -23,18 +23,16 @@
#include "globstr.hrc"
#include "markdata.hxx"
-//------------------------------------------------------------------
-
ScEditableTester::ScEditableTester() :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
}
ScEditableTester::ScEditableTester( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow ) :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
TestBlock( pDoc, nTab, nStartCol, nStartRow, nEndCol, nEndRow );
}
@@ -42,29 +40,29 @@ ScEditableTester::ScEditableTester( ScDocument* pDoc, SCTAB nTab,
ScEditableTester::ScEditableTester( ScDocument* pDoc,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow,
const ScMarkData& rMark ) :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
TestSelectedBlock( pDoc, nStartCol, nStartRow, nEndCol, nEndRow, rMark );
}
ScEditableTester::ScEditableTester( ScDocument* pDoc, const ScRange& rRange ) :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
TestRange( pDoc, rRange );
}
ScEditableTester::ScEditableTester( ScDocument* pDoc, const ScMarkData& rMark ) :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
TestSelection( pDoc, rMark );
}
ScEditableTester::ScEditableTester( ScViewFunc* pView ) :
- bIsEditable( sal_True ),
- bOnlyMatrix( sal_True )
+ mbIsEditable(true),
+ mbOnlyMatrix(true)
{
TestView( pView );
}
@@ -74,14 +72,14 @@ ScEditableTester::ScEditableTester( ScViewFunc* pView ) :
void ScEditableTester::TestBlock( ScDocument* pDoc, SCTAB nTab,
SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow )
{
- if ( bIsEditable || bOnlyMatrix )
+ if (mbIsEditable || mbOnlyMatrix)
{
bool bThisMatrix;
if ( !pDoc->IsBlockEditable( nTab, nStartCol, nStartRow, nEndCol, nEndRow, &bThisMatrix ) )
{
- bIsEditable = false;
+ mbIsEditable = false;
if ( !bThisMatrix )
- bOnlyMatrix = false;
+ mbOnlyMatrix = false;
}
}
}
@@ -110,28 +108,28 @@ void ScEditableTester::TestRange( ScDocument* pDoc, const ScRange& rRange )
void ScEditableTester::TestSelection( ScDocument* pDoc, const ScMarkData& rMark )
{
- if ( bIsEditable || bOnlyMatrix )
+ if (mbIsEditable || mbOnlyMatrix)
{
bool bThisMatrix;
if ( !pDoc->IsSelectionEditable( rMark, &bThisMatrix ) )
{
- bIsEditable = false;
+ mbIsEditable = false;
if ( !bThisMatrix )
- bOnlyMatrix = false;
+ mbOnlyMatrix = false;
}
}
}
void ScEditableTester::TestView( ScViewFunc* pView )
{
- if ( bIsEditable || bOnlyMatrix )
+ if (mbIsEditable || mbOnlyMatrix)
{
bool bThisMatrix;
if ( !pView->SelectionEditable( &bThisMatrix ) )
{
- bIsEditable = false;
+ mbIsEditable = false;
if ( !bThisMatrix )
- bOnlyMatrix = false;
+ mbOnlyMatrix = false;
}
}
}
@@ -140,9 +138,9 @@ void ScEditableTester::TestView( ScViewFunc* pView )
sal_uInt16 ScEditableTester::GetMessageId() const
{
- if (bIsEditable)
+ if (mbIsEditable)
return 0;
- else if (bOnlyMatrix)
+ else if (mbOnlyMatrix)
return STR_MATRIXFRAGMENTERR;
else
return STR_PROTECTIONERR;
diff --git a/sc/source/ui/inc/editable.hxx b/sc/source/ui/inc/editable.hxx
index 6213e48..2760c04 100644
--- a/sc/source/ui/inc/editable.hxx
+++ b/sc/source/ui/inc/editable.hxx
@@ -31,11 +31,10 @@ class ScRange;
class ScEditableTester
{
- sal_Bool bIsEditable;
- sal_Bool bOnlyMatrix;
+ bool mbIsEditable;
+ bool mbOnlyMatrix;
public:
- // no test in ctor
ScEditableTester();
// calls TestBlock
@@ -56,8 +55,6 @@ public:
// calls TestView
ScEditableTester( ScViewFunc* pView );
- ~ScEditableTester() {}
-
// Several calls to the Test... methods check if *all* of the ranges
// are editable. For several independent checks, Reset() has to be used.
void TestBlock( ScDocument* pDoc, SCTAB nTab,
@@ -69,8 +66,8 @@ public:
void TestSelection( ScDocument* pDoc, const ScMarkData& rMark );
void TestView( ScViewFunc* pView );
- sal_Bool IsEditable() const { return bIsEditable; }
- sal_Bool IsFormatEditable() const { return bIsEditable || bOnlyMatrix; }
+ bool IsEditable() const { return mbIsEditable; }
+ bool IsFormatEditable() const { return mbIsEditable || mbOnlyMatrix; }
sal_uInt16 GetMessageId() const;
};
More information about the Libreoffice-commits
mailing list