[Libreoffice-commits] core.git: editeng/source include/editeng

Jochen Nitschke j.nitschke+logerrit at ok.de
Fri Aug 26 07:53:54 UTC 2016


 editeng/source/editeng/eertfpar.cxx |   19 +++++++++----------
 editeng/source/editeng/eertfpar.hxx |    5 +----
 include/editeng/svxrtf.hxx          |    2 --
 3 files changed, 10 insertions(+), 16 deletions(-)

New commits:
commit aa67fed597bb375d1180d85db7ac90999f86e1a4
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Thu Aug 25 20:30:31 2016 +0200

    reduce defines to bool
    
    nLastAction could be 0, ACTION_INSERTTEXT or ACTION_INSERTPARABRK
    only later was checked so make this a bool
    
    Change-Id: I49287d48ebd12f2fcb4fe71756fe39cf116f588b
    Reviewed-on: https://gerrit.libreoffice.org/28396
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index cb97fcc..4e6e18d 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -53,14 +53,13 @@ ImportInfo::~ImportInfo()
 EditRTFParser::EditRTFParser(
     SvStream& rIn, EditSelection aSel, SfxItemPool& rAttrPool, EditEngine* pEditEngine) :
     SvxRTFParser(rAttrPool, rIn, nullptr),
+    aCurSel(aSel),
     mpEditEngine(pEditEngine),
-    aRTFMapMode(MAP_TWIP)
+    aRTFMapMode(MAP_TWIP),
+    nDefFont(0),
+    nDefTab(0),
+    bLastActionInsertParaBreak(false)
 {
-    aCurSel         = aSel;
-    nDefFont        = 0;
-    nDefTab         = 0;
-    nLastAction     = 0;
-
     SetInsPos(EditPosition(mpEditEngine, &aCurSel));
 
     // Convert the twips values ...
@@ -106,7 +105,7 @@ SvParserState EditRTFParser::CallParser()
         mpEditEngine->CallImportHandler(aImportInfo);
     }
 
-    if ( nLastAction == ACTION_INSERTPARABRK )
+    if (bLastActionInsertParaBreak)
     {
         ContentNode* pCurNode = aCurSel.Max().GetNode();
         sal_Int32 nPara = mpEditEngine->GetEditDoc().GetPos(pCurNode);
@@ -247,7 +246,7 @@ void EditRTFParser::InsertText()
         mpEditEngine->CallImportHandler(aImportInfo);
     }
     aCurSel = mpEditEngine->InsertText(aCurSel, aText);
-    nLastAction = ACTION_INSERTTEXT;
+    bLastActionInsertParaBreak = false;
 }
 
 void EditRTFParser::InsertPara()
@@ -258,7 +257,7 @@ void EditRTFParser::InsertPara()
         mpEditEngine->CallImportHandler(aImportInfo);
     }
     aCurSel = mpEditEngine->InsertParaBreak(aCurSel);
-    nLastAction = ACTION_INSERTPARABRK;
+    bLastActionInsertParaBreak = true;
 }
 
 void EditRTFParser::MovePos( bool const bForward )
@@ -564,7 +563,7 @@ void EditRTFParser::ReadField()
             SvxFieldItem aField( SvxURLField( aFldInst, aFldRslt, SVXURLFORMAT_REPR ), EE_FEATURE_FIELD  );
             aCurSel = mpEditEngine->InsertField(aCurSel, aField);
             mpEditEngine->UpdateFieldsOnly();
-            nLastAction = ACTION_INSERTTEXT;
+            bLastActionInsertParaBreak = false;
         }
     }
 
diff --git a/editeng/source/editeng/eertfpar.hxx b/editeng/source/editeng/eertfpar.hxx
index d58ccb6..86194a0 100644
--- a/editeng/source/editeng/eertfpar.hxx
+++ b/editeng/source/editeng/eertfpar.hxx
@@ -26,9 +26,6 @@
 
 class EditEngine;
 
-
-#define ACTION_INSERTPARABRK    2
-
 class EditRTFParser : public SvxRTFParser
 {
 private:
@@ -39,7 +36,7 @@ private:
 
     sal_uInt16              nDefFont;
     sal_uInt16              nDefTab;
-    sal_uInt8               nLastAction;
+    bool                bLastActionInsertParaBreak;
 
 protected:
     virtual void        InsertPara() override;
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index ede52eb..00e42c0 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -89,8 +89,6 @@ public:
     EditNodeIdx* MakeNodeIdx() const;
 };
 
-#define ACTION_INSERTTEXT       1
-
 typedef std::map<short, std::unique_ptr<vcl::Font>> SvxRTFFontTbl;
 typedef std::map<sal_uInt16, std::unique_ptr<SvxRTFStyleType>> SvxRTFStyleTbl;
 


More information about the Libreoffice-commits mailing list