diff options
author | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-28 23:56:12 -0500 |
---|---|---|
committer | Kohei Yoshida <kohei.yoshida@gmail.com> | 2013-01-29 09:27:47 -0500 |
commit | 0532733965f78f71a41983815d4e0525c07f9019 (patch) | |
tree | af2caa6e50bf7289e8a35612bc6b7ba544ee97eb /sc | |
parent | 80f5a837f2d42cc2bc972dcfe88e5f39aa514d9c (diff) |
Bool cleanup with ScEditableTester.
Change-Id: If4ae85bec451897f5c22397f4301200d1d3c77ac
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/ui/docshell/editable.cxx | 48 | ||||
-rw-r--r-- | sc/source/ui/inc/editable.hxx | 11 |
2 files changed, 27 insertions, 32 deletions
diff --git a/sc/source/ui/docshell/editable.cxx b/sc/source/ui/docshell/editable.cxx index fce1978b5f83..2664e9e2ae34 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 6213e487cf31..2760c04c8e4c 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; }; |