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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Aug 13 12:39:48 UTC 2018


 sw/inc/editsh.hxx                   |    8 +++++---
 sw/source/core/edit/edglss.cxx      |   12 ++++++------
 sw/source/uibase/dochdl/gloshdl.cxx |    2 +-
 sw/source/uibase/docvw/edtwin.cxx   |    6 +++---
 sw/source/uibase/wrtsh/wrtsh1.cxx   |    2 +-
 5 files changed, 16 insertions(+), 14 deletions(-)

New commits:
commit 08a68d853cf0b3c9b1779ac2366cb502b85f9db6
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Aug 13 11:11:21 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Aug 13 14:39:28 2018 +0200

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

diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 07308fa4db3d..72bd50130ff0 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -110,8 +110,10 @@ namespace sw {
     class UndoRedoContext;
 }
 
-#define GETSELTXT_PARABRK_TO_BLANK      0
-#define GETSELTXT_PARABRK_TO_ONLYCR     2
+enum class ParaBreakType {
+    ToBlank = 0,
+    ToOnlyCR = 2
+};
 
  /// For querying the INet-attributes for Navigator.
 struct SwGetINetAttr
@@ -623,7 +625,7 @@ public:
      @returns FALSE, if selected range is too large to be copied
      into string buffer or if other errors occur. */
     bool GetSelectedText( OUString &rBuf,
-                        int nHndlParaBreak = GETSELTXT_PARABRK_TO_BLANK );
+                        ParaBreakType nHndlParaBreak = ParaBreakType::ToBlank );
 
     /** @return graphic, if CurrentCursor->Point() points to a SwGrfNode
      (and mark is not set or points to the same graphic). */
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index b1cb2f712878..8dc8d0a2a226 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -116,7 +116,7 @@ sal_uInt16 SwEditShell::SaveGlossaryDoc( SwTextBlocks& rBlock,
             pCursor->GetPoint()->nContent.Assign( pContentNd, pContentNd->Len() );
 
         OUString sBuf;
-        if( GetSelectedText( sBuf, GETSELTXT_PARABRK_TO_ONLYCR ) && !sBuf.isEmpty() )
+        if( GetSelectedText( sBuf, ParaBreakType::ToOnlyCR ) && !sBuf.isEmpty() )
             nRet = rBlock.PutText( rShortName, rName, sBuf );
     }
     else
@@ -250,18 +250,18 @@ bool SwEditShell::CopySelToDoc( SwDoc* pInsDoc )
  *
  * @return false if the selected area is too big for being copied into the string buffer
  */
-bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk )
+bool SwEditShell::GetSelectedText( OUString &rBuf, ParaBreakType nHndlParaBrk )
 {
     GetCursor();  // creates all cursors if needed
     if( IsSelOnePara() )
     {
         rBuf = GetSelText();
-        if( GETSELTXT_PARABRK_TO_BLANK == nHndlParaBrk )
+        if( ParaBreakType::ToBlank == nHndlParaBrk )
         {
             rBuf = rBuf.replaceAll("\x0a", " ");
         }
         else if( IsSelFullPara() &&
-            GETSELTXT_PARABRK_TO_ONLYCR != nHndlParaBrk )
+            ParaBreakType::ToOnlyCR != nHndlParaBrk )
         {
 #ifdef _WIN32
                 rBuf += "\015\012";
@@ -288,12 +288,12 @@ bool SwEditShell::GetSelectedText( OUString &rBuf, int nHndlParaBrk )
 
             switch( nHndlParaBrk )
             {
-            case GETSELTXT_PARABRK_TO_BLANK:
+            case ParaBreakType::ToBlank:
                 xWrt->m_bASCII_ParaAsBlank = true;
                 xWrt->m_bASCII_NoLastLineEnd = true;
                 break;
 
-            case GETSELTXT_PARABRK_TO_ONLYCR:
+            case ParaBreakType::ToOnlyCR:
                 xWrt->m_bASCII_ParaAsCR = true;
                 xWrt->m_bASCII_NoLastLineEnd = true;
                 break;
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 3896c3cbddeb..c58f3f0d27b9 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -309,7 +309,7 @@ bool SwGlossaryHdl::NewGlossary(const OUString& rName, const OUString& rShortNam
     OUString* pOnlyText = nullptr;
     if( bNoAttr )
     {
-        if( !pWrtShell->GetSelectedText( sOnlyText, GETSELTXT_PARABRK_TO_ONLYCR ))
+        if( !pWrtShell->GetSelectedText( sOnlyText, ParaBreakType::ToOnlyCR ))
             return false;
         pOnlyText = &sOnlyText;
     }
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index 4edc16a3f1e5..93d922967bd7 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -6200,7 +6200,7 @@ OUString SwEditWin::GetSurroundingText() const
     OUString sReturn;
     SwWrtShell& rSh = m_rView.GetWrtShell();
     if( rSh.HasSelection() && !rSh.IsMultiSelection() && rSh.IsSelOnePara() )
-        rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
+        rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR  );
     else if( !rSh.HasSelection() )
     {
         SwPosition *pPos = rSh.GetCursor()->GetPoint();
@@ -6211,7 +6211,7 @@ OUString SwEditWin::GetSurroundingText() const
         rSh.GoStartSentence();
         rSh.SetMark();
         rSh.GoEndSentence();
-        rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
+        rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR  );
 
         pPos->nContent = nPos;
         rSh.ClearMark();
@@ -6227,7 +6227,7 @@ Selection SwEditWin::GetSurroundingTextSelection() const
     if( rSh.HasSelection() )
     {
         OUString sReturn;
-        rSh.GetSelectedText( sReturn, GETSELTXT_PARABRK_TO_ONLYCR  );
+        rSh.GetSelectedText( sReturn, ParaBreakType::ToOnlyCR  );
         return Selection( 0, sReturn.getLength() );
     }
     else
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index ae67738ba15e..364527fb3b0c 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -469,7 +469,7 @@ bool SwWrtShell::InsertOleObject( const svt::EmbeddedObjectRef& xRef, SwFlyFrame
         if( bStarMath )
         {
             OUString aMathData;
-            GetSelectedText( aMathData, GETSELTXT_PARABRK_TO_ONLYCR );
+            GetSelectedText( aMathData, ParaBreakType::ToOnlyCR );
 
             if( !aMathData.isEmpty() && svt::EmbeddedObjectRef::TryRunningState( xRef.GetObject() ) )
             {


More information about the Libreoffice-commits mailing list