[Libreoffice-commits] core.git: Branch 'feature/gsoc14-draw-chained-text-boxes' - editeng/source

matteocam matteo.campanelli at gmail.com
Thu Aug 20 09:34:08 PDT 2015


 editeng/source/outliner/overflowingtxt.cxx |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

New commits:
commit 08c726f26245e5fc0b35552812fc5bb53ef42c83
Author: matteocam <matteo.campanelli at gmail.com>
Date:   Thu Aug 20 18:33:40 2015 +0200

    Don't add empty paras
    
    Change-Id: I9c507fc99f0c482b74ae398d1f44d3db3750f431

diff --git a/editeng/source/outliner/overflowingtxt.cxx b/editeng/source/outliner/overflowingtxt.cxx
index 9b6ae81..bd0f59f 100644
--- a/editeng/source/outliner/overflowingtxt.cxx
+++ b/editeng/source/outliner/overflowingtxt.cxx
@@ -44,6 +44,11 @@ OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
         pOutl->SetText(*pNextPObj);
     }
 
+    // Special case: if only empty text remove it at the end
+    bool bOnlyOneEmptyPara = !pNextPObj ||
+                             (pOutl->GetParagraphCount() == 1 &&
+                              pNextPObj->GetTextObject().GetText(0) == "");
+
     EditEngine &rEditEngine = const_cast<EditEngine &>(pOutl->GetEditEngine());
 
     // XXX: this code should be moved in Outliner directly
@@ -54,8 +59,12 @@ OutlinerParaObject *TextChainingUtils::JuxtaposeParaObject(
                                                     aStartSel.Min(),
                                                     true);
 
-    // Separate Paragraphs
-    rEditEngine.InsertParaBreak(aNewSel);
+    if (!bOnlyOneEmptyPara) {
+        // Separate Paragraphs
+        rEditEngine.InsertParaBreak(aNewSel);
+    }
+
+
 
     return pOutl->CreateParaObject();
 }
@@ -65,7 +74,7 @@ OutlinerParaObject *TextChainingUtils::DeeplyMergeParaObject(
         Outliner *pOutl,
         OutlinerParaObject *pNextPObj)
 {
-     if (!pNextPObj) {
+    if (!pNextPObj) {
         pOutl->SetToEmptyText();
     } else {
         pOutl->SetText(*pNextPObj);


More information about the Libreoffice-commits mailing list