summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-02-10 12:37:10 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-02-13 08:17:42 +0200
commit21b5c88398972bb535aecad72ef02dbb7e0d2b22 (patch)
treee0888860e4fc16cfce537c7fa90b9533bb0de7e6 /sw
parent62232e60bf2e87b216abd8cd22d5f5acc4338c57 (diff)
convert SectionSort to scoped enum
and drop read-only SORTSECT_NAME enumerator Change-Id: Ibb192b0857161560a666e6ffdc2125bc6fc552c5
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/section.hxx4
-rw-r--r--sw/source/core/doc/doctxm.cxx2
-rw-r--r--sw/source/core/docnode/section.cxx14
-rw-r--r--sw/source/core/unocore/unoidx.cxx2
-rw-r--r--sw/source/core/unocore/unosect.cxx2
-rw-r--r--sw/source/ui/dialog/uiregionsw.cxx4
6 files changed, 9 insertions, 19 deletions
diff --git a/sw/inc/section.hxx b/sw/inc/section.hxx
index 1824460a5b0f..8c4ee8eee2f7 100644
--- a/sw/inc/section.hxx
+++ b/sw/inc/section.hxx
@@ -265,7 +265,7 @@ class SwSectionFrameMoveAndDeleteHint : public SfxHint
const bool mbSaveContent;
};
-enum SectionSort { SORTSECT_NOT, SORTSECT_NAME, SORTSECT_POS };
+enum class SectionSort { Not, Pos };
class SW_DLLPUBLIC SwSectionFormat
: public SwFrameFormat
@@ -305,7 +305,7 @@ public:
// - sorted according to name or position or unsorted
// - all of them or only those that are in the normal Nodes-array.
void GetChildSections( SwSections& rArr,
- SectionSort eSort = SORTSECT_NOT,
+ SectionSort eSort = SectionSort::Not,
bool bAllSections = true ) const;
// Query whether section is in Nodes-array or in UndoNodes-array.
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 4b7418e08e4e..7be07955410f 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -550,7 +550,7 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes )
if( !bDelNodes )
{
SwSections aArr( 0 );
- pFormat->GetChildSections( aArr, SORTSECT_NOT, false );
+ pFormat->GetChildSections( aArr, SectionSort::Not, false );
for( const auto pSect : aArr )
{
if( TOX_HEADER_SECTION == pSect->GetType() )
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 35d4158a00fa..0791f37309a9 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -882,12 +882,6 @@ static bool lcl_SectionCmpPos( const SwSection *pFirst, const SwSection *pSecond
pSSectFormat->GetContent(false).GetContentIdx()->GetIndex();
}
-static bool lcl_SectionCmpNm( const SwSection *pFSect, const SwSection *pSSect)
-{
- OSL_ENSURE( pFSect && pSSect, "Invalid Sections" );
- return pFSect->GetSectionName() < pSSect->GetSectionName();
-}
-
// get all Sections that have been derived from this one
void SwSectionFormat::GetChildSections( SwSections& rArr,
SectionSort eSort,
@@ -912,14 +906,10 @@ void SwSectionFormat::GetChildSections( SwSections& rArr,
if( 1 < rArr.size() )
switch( eSort )
{
- case SORTSECT_NAME:
- std::sort( rArr.begin(), rArr.end(), lcl_SectionCmpNm );
- break;
-
- case SORTSECT_POS:
+ case SectionSort::Pos:
std::sort( rArr.begin(), rArr.end(), lcl_SectionCmpPos );
break;
- case SORTSECT_NOT: break;
+ case SectionSort::Not: break;
}
}
}
diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx
index b075fa7d4455..9253c31ec499 100644
--- a/sw/source/core/unocore/unoidx.cxx
+++ b/sw/source/core/unocore/unoidx.cxx
@@ -919,7 +919,7 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName)
{
SwSections aSectArr;
pSectionFormat->GetChildSections(aSectArr,
- SORTSECT_NOT, false);
+ SectionSort::Not, false);
for(SwSection* pSect : aSectArr)
{
if(pSect->GetType() == TOX_HEADER_SECTION)
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 2ede1776ea6d..55e636f58ca2 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -254,7 +254,7 @@ SwXTextSection::getChildSections()
SwSectionFormat & rSectionFormat( m_pImpl->GetSectionFormatOrThrow() );
SwSections aChildren;
- rSectionFormat.GetChildSections(aChildren, SORTSECT_NOT, false);
+ rSectionFormat.GetChildSections(aChildren, SectionSort::Not, false);
uno::Sequence<uno::Reference<text::XTextSection> > aSeq(aChildren.size());
uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
for (size_t i = 0; i < aChildren.size(); ++i)
diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx
index 6f0d69bc9d15..f1f88422ec91 100644
--- a/sw/source/ui/dialog/uiregionsw.cxx
+++ b/sw/source/ui/dialog/uiregionsw.cxx
@@ -105,7 +105,7 @@ static void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAva
else
{
SwSections aTmpArr;
- pNewFormat->GetChildSections(aTmpArr, SORTSECT_POS);
+ pNewFormat->GetChildSections(aTmpArr, SectionSort::Pos);
if( !aTmpArr.empty() )
{
SectionType eTmpType;
@@ -473,7 +473,7 @@ void SwEditRegionDlg::RecurseList( const SwSectionFormat* pFormat, SvTreeListEnt
{
SwSections aTmpArr;
SvTreeListEntry* pNEntry;
- pFormat->GetChildSections(aTmpArr, SORTSECT_POS);
+ pFormat->GetChildSections(aTmpArr, SectionSort::Pos);
if( !aTmpArr.empty() )
{
for( const auto pSect : aTmpArr )