[Libreoffice-commits] core.git: 4 commits - sw/source
Bjoern Michaelsen
bjoern.michaelsen at canonical.com
Thu Feb 26 05:07:04 PST 2015
sw/source/core/frmedt/fetab.cxx | 34 +++++++++++++++-------------------
1 file changed, 15 insertions(+), 19 deletions(-)
New commits:
commit 530d3c92bd79f3c0e8d646e48a2eff1dae2921da
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Feb 26 13:05:53 2015 +0100
make arbitrary number a constant and add comment on fishiness
Change-Id: I65baf9e4583c78ca3128352112fdeeffce3b3225
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index f38502c..3d94e39 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -84,8 +84,10 @@ const SwFrm *pRowCacheLastCellFrm = 0;
class TblWait
{
const ::std::unique_ptr<SwWait> m_pWait;
+ // this seems really fishy: do some locking, if an arbitrary number of lines is exceeded
+ static const size_t our_kLineLimit = 20;
bool ShouldWait(size_t nCnt, SwFrm *pFrm, size_t nCnt2)
- { return 20 < nCnt || 20 < nCnt2 || (pFrm && 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size()); }
+ { return our_kLineLimit < nCnt || our_kLineLimit < nCnt2 || (pFrm && our_kLineLimit < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size()); }
public:
TblWait(size_t nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t nCnt2 = 0)
: m_pWait( ShouldWait(nCnt, pFrm, nCnt2) ? ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true )) : nullptr )
commit 6ee7900b587d4cba6f6a07548f96adcc42f64eaf
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Feb 26 13:00:57 2015 +0100
more constness
Change-Id: I5bbddaebb6cf820afced89e634814f485ec38859
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 73d0862..f38502c 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -83,20 +83,15 @@ const SwFrm *pRowCacheLastCellFrm = 0;
class TblWait
{
- ::std::unique_ptr<SwWait> m_pWait;
+ const ::std::unique_ptr<SwWait> m_pWait;
+ bool ShouldWait(size_t nCnt, SwFrm *pFrm, size_t nCnt2)
+ { return 20 < nCnt || 20 < nCnt2 || (pFrm && 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size()); }
public:
- TblWait(size_t nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t nCnt2 = 0);
+ TblWait(size_t nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t nCnt2 = 0)
+ : m_pWait( ShouldWait(nCnt, pFrm, nCnt2) ? ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true )) : nullptr )
+ { }
};
-TblWait::TblWait(size_t const nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t const nCnt2):
- m_pWait( nullptr )
-{
- const bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm &&
- 20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size());
- if( bWait )
- m_pWait = ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true ));
-}
-
void SwFEShell::ParkCursorInTab()
{
SwCursor * pSwCrsr = GetSwCrsr();
commit 6ce7808d586bcfb442160d58f4ce5b55d53067b2
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Feb 26 12:47:05 2015 +0100
unique_ptr, constness, naming conventions
Change-Id: I37cbfbcc887ec82e750ba1bc614f4eda77be933b
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 729de30..73d0862 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -83,19 +83,18 @@ const SwFrm *pRowCacheLastCellFrm = 0;
class TblWait
{
- SwWait *pWait;
+ ::std::unique_ptr<SwWait> m_pWait;
public:
TblWait(size_t nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t nCnt2 = 0);
- ~TblWait() { delete pWait; }
};
TblWait::TblWait(size_t const nCnt, SwFrm *pFrm, SwDocShell &rDocShell, size_t const nCnt2):
- pWait( 0 )
+ m_pWait( nullptr )
{
- bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm &&
+ const bool bWait = 20 < nCnt || 20 < nCnt2 || (pFrm &&
20 < pFrm->ImplFindTabFrm()->GetTable()->GetTabLines().size());
if( bWait )
- pWait = new SwWait( rDocShell, true );
+ m_pWait = ::std::unique_ptr<SwWait>(new SwWait( rDocShell, true ));
}
void SwFEShell::ParkCursorInTab()
commit 7deb4c93a804b2f17d102f2f24448a5c638a96ea
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date: Thu Feb 26 12:34:34 2015 +0100
cppcheck: assuming these to be intended to actually have a scope
Change-Id: Id1af6eb4064a524b12113b5b52b15f2ea4d6ada4
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index cef2cee..729de30 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -211,7 +211,7 @@ bool SwFEShell::InsertRow( sal_uInt16 nCnt, bool bBehind )
}
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_ROW );
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait aWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
bool bRet = false;
if ( aBoxes.size() )
@@ -249,7 +249,7 @@ bool SwFEShell::InsertCol( sal_uInt16 nCnt, bool bBehind )
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait aWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
bool bRet = false;
if( !aBoxes.empty() )
@@ -299,7 +299,7 @@ bool SwFEShell::DeleteCol()
GetTblSel( *this, aBoxes, nsSwTblSearchType::TBLSEARCH_COL );
if ( !aBoxes.empty() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait aWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
// remove crsr from the deletion area.
// Put them behind/on the table; via the
@@ -351,7 +351,7 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
if( !aBoxes.empty() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait aWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
// Delete cursors from the deletion area.
// Then the cursor is:
@@ -463,7 +463,7 @@ sal_uInt16 SwFEShell::MergeTab()
SET_CURR_SHELL( this );
StartAllAction();
- TblWait(pTableCrsr->GetSelectedBoxesCount(), 0,
+ TblWait aWait(pTableCrsr->GetSelectedBoxesCount(), 0,
*GetDoc()->GetDocShell(),
pTblNd->GetTable().GetTabLines().size() );
@@ -506,7 +506,7 @@ bool SwFEShell::SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight )
GetTblSel( *this, aBoxes );
if( !aBoxes.empty() )
{
- TblWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
+ TblWait aWait( nCnt, pFrm, *GetDoc()->GetDocShell(), aBoxes.size() );
// now delete the columns
bRet = GetDoc()->SplitTbl( aBoxes, bVert, nCnt, bSameHeight );
@@ -1262,7 +1262,7 @@ bool SwFEShell::DeleteTblSel()
GetTblSelCrs( *this, aBoxes );
if( !aBoxes.empty() )
{
- TblWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
+ TblWait aWait( aBoxes.size(), pFrm, *GetDoc()->GetDocShell() );
// cursor should be removed from deletion area.
// Put them behind/on the table; via the document
More information about the Libreoffice-commits
mailing list