[Libreoffice-commits] core.git: sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Thu Apr 13 06:50:12 UTC 2017
sw/inc/doc.hxx | 3 +--
sw/inc/fesh.hxx | 3 +--
sw/inc/tblenum.hxx | 8 ++++----
sw/inc/tblsel.hxx | 4 ++--
sw/source/core/docnode/ndtbl.cxx | 14 +++++++-------
sw/source/core/frmedt/fetab.cxx | 4 ++--
sw/source/core/frmedt/tblsel.cxx | 12 ++++++------
sw/source/core/unocore/unotbl.cxx | 2 +-
sw/source/uibase/shells/tabsh.cxx | 6 +++---
9 files changed, 27 insertions(+), 29 deletions(-)
New commits:
commit 518cf484c7aed6cd09c7db4a19d16fbf72d25e3b
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Wed Apr 12 14:35:52 2017 +0200
convert TableMergeErr to scoped enum
Change-Id: Ie3d15845e47c514411baadecff92025f3e0c4e21
Reviewed-on: https://gerrit.libreoffice.org/36476
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a285846cd63a..f75ed2775890 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1206,8 +1206,7 @@ public:
bool SplitTable( const SwSelBoxes& rBoxes, bool bVert,
sal_uInt16 nCnt, bool bSameHeight = false );
- // @return enum TableMergeErr.
- sal_uInt16 MergeTable( SwPaM& rPam );
+ TableMergeErr MergeTable( SwPaM& rPam );
OUString GetUniqueTableName() const;
bool IsInsTableFormatNum() const;
bool IsInsTableChangeNumFormat() const;
diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx
index 9b8a6d4304e3..3932c5af033b 100644
--- a/sw/inc/fesh.hxx
+++ b/sw/inc/fesh.hxx
@@ -638,8 +638,7 @@ public:
bool DeleteTableSel(); ///< Current selection, may be whole table.
- sal_uInt16 MergeTab(); /**< Merge selected parts of table.
- @return error via enum. */
+ TableMergeErr MergeTab(); /**< Merge selected parts of table */
/// Split cell vertically or horizontally.
bool SplitTab( bool bVert, sal_uInt16 nCnt, bool bSameHeight = false );
diff --git a/sw/inc/tblenum.hxx b/sw/inc/tblenum.hxx
index b5590a6ebc01..fbef062307c8 100644
--- a/sw/inc/tblenum.hxx
+++ b/sw/inc/tblenum.hxx
@@ -64,11 +64,11 @@ enum class SplitTable_HeadlineOption
BoxAttrAllCopy // Copy box attributes and paragraph styles of 1st line.
};
-enum TableMergeErr
+enum class TableMergeErr
{
- TBLMERGE_OK,
- TBLMERGE_NOSELECTION,
- TBLMERGE_TOOCOMPLEX
+ Ok,
+ NoSelection,
+ TooComplex
};
#endif
diff --git a/sw/inc/tblsel.hxx b/sw/inc/tblsel.hxx
index 295cd2da21c1..72057211e3f5 100644
--- a/sw/inc/tblsel.hxx
+++ b/sw/inc/tblsel.hxx
@@ -109,8 +109,8 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
SwTableBox** ppMergeBox, SwUndoTableMerge* pUndo );
// Check if selected boxes allow for a valid merge.
-sal_uInt16 CheckMergeSel( const SwPaM& rPam );
-sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes );
+TableMergeErr CheckMergeSel( const SwPaM& rPam );
+TableMergeErr CheckMergeSel( const SwSelBoxes& rBoxes );
bool IsEmptyBox( const SwTableBox& rBox, SwPaM& rPam );
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index e3e14cefa74d..44d932947a2a 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -2247,22 +2247,22 @@ bool SwDoc::SplitTable( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt,
return bRet;
}
-sal_uInt16 SwDoc::MergeTable( SwPaM& rPam )
+TableMergeErr SwDoc::MergeTable( SwPaM& rPam )
{
// Check if the current cursor's Point/Mark are inside a Table
SwTableNode* pTableNd = rPam.GetNode().FindTableNode();
if( !pTableNd )
- return TBLMERGE_NOSELECTION;
+ return TableMergeErr::NoSelection;
SwTable& rTable = pTableNd->GetTable();
if( dynamic_cast<const SwDDETable*>( &rTable) != nullptr )
- return TBLMERGE_NOSELECTION;
- sal_uInt16 nRet = TBLMERGE_NOSELECTION;
+ return TableMergeErr::NoSelection;
+ TableMergeErr nRet = TableMergeErr::NoSelection;
if( !rTable.IsNewModel() )
{
nRet =::CheckMergeSel( rPam );
- if( TBLMERGE_OK != nRet )
+ if( TableMergeErr::Ok != nRet )
return nRet;
- nRet = TBLMERGE_NOSELECTION;
+ nRet = TableMergeErr::NoSelection;
}
// #i33394#
@@ -2331,7 +2331,7 @@ sal_uInt16 SwDoc::MergeTable( SwPaM& rPam )
if( pTableNd->GetTable().Merge( this, aBoxes, aMerged, pMergeBox, pUndo ))
{
- nRet = TBLMERGE_OK;
+ nRet = TableMergeErr::Ok;
getIDocumentState().SetModified();
getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 );
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index ca1318aed10f..2aa57473d920 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -444,10 +444,10 @@ bool SwFEShell::DeleteRow(bool bCompleteTable)
return bRet;
}
-sal_uInt16 SwFEShell::MergeTab()
+TableMergeErr SwFEShell::MergeTab()
{
// check if Point/Mark of current cursor are in a table
- sal_uInt16 nRet = TBLMERGE_NOSELECTION;
+ TableMergeErr nRet = TableMergeErr::NoSelection;
if( IsTableMode() )
{
SwShellTableCursor* pTableCursor = GetTableCursor();
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 45d48751ca4e..5055c0740328 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -1417,7 +1417,7 @@ static bool lcl_CheckCol( FndBox_ const& rFndBox, bool* pPara )
return *pPara;
}
-sal_uInt16 CheckMergeSel( const SwPaM& rPam )
+TableMergeErr CheckMergeSel( const SwPaM& rPam )
{
SwSelBoxes aBoxes;
//JP 24.09.96: Merge with repeating TableHeadLines does not work properly.
@@ -1435,12 +1435,12 @@ sal_uInt16 CheckMergeSel( const SwPaM& rPam )
return CheckMergeSel( aBoxes );
}
-sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes )
+TableMergeErr CheckMergeSel( const SwSelBoxes& rBoxes )
{
- sal_uInt16 eRet = TBLMERGE_NOSELECTION;
+ TableMergeErr eRet = TableMergeErr::NoSelection;
if( !rBoxes.empty() )
{
- eRet = TBLMERGE_OK;
+ eRet = TableMergeErr::Ok;
FndBox_ aFndBox( nullptr, nullptr );
FndPara aPara( rBoxes, &aFndBox );
@@ -1474,10 +1474,10 @@ sal_uInt16 CheckMergeSel( const SwSelBoxes& rBoxes )
}
}
if( !bMergeSelOk )
- eRet = TBLMERGE_TOOCOMPLEX;
+ eRet = TableMergeErr::TooComplex;
}
else
- eRet = TBLMERGE_NOSELECTION;
+ eRet = TableMergeErr::NoSelection;
}
return eRet;
}
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index 9267ed93ffc5..d040c02e7101 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -1620,7 +1620,7 @@ sal_Bool SwXTextTableCursor::mergeRange()
bool bResult;
{
UnoActionContext aContext(rUnoCursor.GetDoc());
- bResult = TBLMERGE_OK == rTableCursor.GetDoc()->MergeTable(rTableCursor);
+ bResult = TableMergeErr::Ok == rTableCursor.GetDoc()->MergeTable(rTableCursor);
}
if(bResult)
{
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index 5cd874fe3832..34da5761ddcf 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -753,12 +753,12 @@ void SwTableShell::Execute(SfxRequest &rReq)
if ( rSh.IsTableMode() )
switch ( rSh.MergeTab() )
{
- case TBLMERGE_OK:
+ case TableMergeErr::Ok:
bCallDone = true;
SAL_FALLTHROUGH;
- case TBLMERGE_NOSELECTION:
+ case TableMergeErr::NoSelection:
break;
- case TBLMERGE_TOOCOMPLEX:
+ case TableMergeErr::TooComplex:
{
ScopedVclPtrInstance<MessageDialog> aInfoBox( GetView().GetWindow(),
SW_RES( STR_ERR_TABLE_MERGE ), VclMessageType::Info );
More information about the Libreoffice-commits
mailing list