[Libreoffice-commits] core.git: sw/inc sw/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Wed Dec 11 08:09:45 UTC 2019


 sw/inc/sortopt.hxx                |    4 ++--
 sw/source/core/doc/docsort.cxx    |   10 +++++-----
 sw/source/core/doc/sortopt.cxx    |    2 +-
 sw/source/core/unocore/unoobj.cxx |    6 +++---
 sw/source/ui/misc/srtdlg.cxx      |    2 +-
 5 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit c3d5da852584154b5efbce564006e06acbc5f604
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Dec 10 11:51:27 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Dec 11 09:08:31 2019 +0100

    convert SwSortDirection to scoped enum
    
    Change-Id: I20eea9b1addf0f7483d1b48a3d74eb342b479d04
    Reviewed-on: https://gerrit.libreoffice.org/84854
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/inc/sortopt.hxx b/sw/inc/sortopt.hxx
index 959080b3247e..b29460f1f647 100644
--- a/sw/inc/sortopt.hxx
+++ b/sw/inc/sortopt.hxx
@@ -25,8 +25,8 @@
 #include <memory>
 #include <vector>
 
-enum class SwSortOrder  { Ascending, Descending };
-enum SwSortDirection    { SRT_COLUMNS, SRT_ROWS         };
+enum class SwSortOrder     { Ascending, Descending };
+enum class SwSortDirection { Columns, Rows };
 
 struct SW_DLLPUBLIC SwSortKey
 {
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 0565878c36e9..75e432a701c0 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -236,7 +236,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const
     const FndBox_* pFndBox;
     sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
 
-    if( SRT_ROWS == pOptions->eDirection )
+    if( SwSortDirection::Rows == pOptions->eDirection )
         pFndBox = pBox->GetBox(nCol, nRow);         // Sort rows
     else
         pFndBox = pBox->GetBox(nRow, nCol);         // Sort columns
@@ -265,7 +265,7 @@ double SwSortBoxElement::GetValue( sal_uInt16 nKey ) const
     const FndBox_* pFndBox;
     sal_uInt16 nCol = pOptions->aKeys[nKey]->nColumnId-1;
 
-    if( SRT_ROWS == pOptions->eDirection )
+    if( SwSortDirection::Rows == pOptions->eDirection )
         pFndBox = pBox->GetBox(nCol, nRow);         // Sort rows
     else
         pFndBox = pBox->GetBox(nRow, nCol);         // Sort columns
@@ -491,7 +491,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
         getIDocumentRedlineAccess().DeleteRedline( *pTableNd, true, RedlineType::Any );
 
     FndLines_t::size_type nStart = 0;
-    if( pTableNd->GetTable().GetRowsToRepeat() > 0 && rOpt.eDirection == SRT_ROWS )
+    if( pTableNd->GetTable().GetRowsToRepeat() > 0 && rOpt.eDirection == SwSortDirection::Rows )
     {
         // Uppermost selected Cell
         FndLines_t& rLines = aFndBox.GetLines();
@@ -547,7 +547,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
     ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
 
     // Insert KeyElements
-    sal_uInt16 nCount = (rOpt.eDirection == SRT_ROWS) ?
+    sal_uInt16 nCount = (rOpt.eDirection == SwSortDirection::Rows) ?
                     aFlatBox.GetRows() : aFlatBox.GetCols();
 
     // Sort SortList by Key
@@ -565,7 +565,7 @@ bool SwDoc::SortTable(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
     sal_uInt16 i = 0;
     for (const auto& rElem : aSortList)
     {
-        if(rOpt.eDirection == SRT_ROWS)
+        if(rOpt.eDirection == SwSortDirection::Rows)
         {
             MoveRow(this, aFlatBox, rElem.nRow, i+nStart, aMovedList, pUndoSort);
         }
diff --git a/sw/source/core/doc/sortopt.cxx b/sw/source/core/doc/sortopt.cxx
index 585a50f818f4..06ac058568af 100644
--- a/sw/source/core/doc/sortopt.cxx
+++ b/sw/source/core/doc/sortopt.cxx
@@ -36,7 +36,7 @@ SwSortKey::SwSortKey(sal_uInt16 nId, const OUString& rSrtType, SwSortOrder eOrde
 }
 
 SwSortOptions::SwSortOptions()
-    : eDirection( SRT_ROWS ),
+    : eDirection( SwSortDirection::Rows ),
     cDeli( 9 ),
     nLanguage( LANGUAGE_SYSTEM ),
     bTable( false ),
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index e1200d0e10dd..612adeb01e90 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -2580,7 +2580,7 @@ bool SwUnoCursorHelper::ConvertSortProperties(
 
     rSortOpt.bTable = false;
     rSortOpt.cDeli = ' ';
-    rSortOpt.eDirection = SRT_COLUMNS;  //!! UI text may be contrary though !!
+    rSortOpt.eDirection = SwSortDirection::Columns;  //!! UI text may be contrary though !!
 
     std::unique_ptr<SwSortKey> pKey1(new SwSortKey);
     pKey1->nColumnId = USHRT_MAX;
@@ -2644,7 +2644,7 @@ bool SwUnoCursorHelper::ConvertSortProperties(
             bool bTemp(false);
             if (aValue >>= bTemp)
             {
-                rSortOpt.eDirection = bTemp ? SRT_COLUMNS : SRT_ROWS;
+                rSortOpt.eDirection = bTemp ? SwSortDirection::Columns : SwSortDirection::Rows;
             }
             else
             {
@@ -2757,7 +2757,7 @@ bool SwUnoCursorHelper::ConvertSortProperties(
             bNewSortdescriptor = true;
             if (auto bTemp = o3tl::tryAccess<bool>(aValue))
             {
-                rSortOpt.eDirection = *bTemp ? SRT_COLUMNS : SRT_ROWS;
+                rSortOpt.eDirection = *bTemp ? SwSortDirection::Columns : SwSortDirection::Rows;
             }
             else
             {
diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx
index 6b5c898e20c5..b94922e93845 100644
--- a/sw/source/ui/misc/srtdlg.cxx
+++ b/sw/source/ui/misc/srtdlg.cxx
@@ -298,7 +298,7 @@ void SwSortDlg::Apply()
                                     bAsc3 ? SwSortOrder::Ascending : SwSortOrder::Descending ));
     }
 
-    aOptions.eDirection =  bCol ? SRT_COLUMNS : SRT_ROWS;
+    aOptions.eDirection =  bCol ? SwSortDirection::Columns : SwSortDirection::Rows;
     aOptions.cDeli = cDeli;
     aOptions.nLanguage = nLang;
     aOptions.bTable = rSh.IsTableMode();


More information about the Libreoffice-commits mailing list