[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/kotext
From:       Thomas Zander <zander () kde ! org>
Date:       2010-11-07 14:17:37
Message-ID: 20101107141737.83DF8AC8A2 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1193897 by zander:

Make inserting a page break work properly again

When inserting a page break at the front (and thus just moving
the parag down) make sure that we keep our style and numbering.
Also fix that re-applying a style removed the page breaking
flag and thus moved the text back up...

BUG:248708

 M  +10 -11    KoTextEditor.cpp  
 M  +0 -1      styles/KoParagraphStyle.cpp  


--- trunk/koffice/libs/kotext/KoTextEditor.cpp #1193896:1193897
@@ -1,6 +1,6 @@
 /* This file is part of the KDE project
  * Copyright (C) 2009 Pierre Stirnweiss <pstirnweiss@googlemail.com>
- * Copyright (C) 2006-2009 Thomas Zander <zander@kde.org>
+ * Copyright (C) 2006-2010 Thomas Zander <zander@kde.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -715,23 +715,22 @@
 }
 
 void KoTextEditor::insertFrameBreak()
-{//TODO split newLine method in two.
+{
     d->updateState(KoTextEditor::Private::KeyPress, i18n("Insert Break"));
     QTextBlock block = d->caret.block();
-    /*
-    if(d->caret->position() == block.position() && block.length() > 0) { // start of \
                parag
-        QTextBlockFormat bf = d->caret->blockFormat();
-        bf.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysAfter);
-        d->caret->setBlockFormat(bf);
-} else { */
+    if (d->caret.position() == block.position() && block.length() > 0) { // start of \
parag  QTextBlockFormat bf = d->caret.blockFormat();
-    //       if(d->caret->position() != block.position() + block.length() -1 ||
-    //               bf.pageBreakPolicy() != QTextFormat::PageBreak_Auto) // end of \
parag or already a pagebreak +        \
bf.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); +        \
d->caret.insertBlock(bf); +        if (block.textList())
+            block.textList()->remove(block);
+    } else {
+        QTextBlockFormat bf = d->caret.blockFormat();
     newLine();
     bf = d->caret.blockFormat();
     bf.setPageBreakPolicy(QTextFormat::PageBreak_AlwaysBefore); // TODO we should \
create an autostyle instead  d->caret.setBlockFormat(bf);
-    //}
+    }
     d->updateState(KoTextEditor::Private::NoOp);
 }
 
--- trunk/koffice/libs/kotext/styles/KoParagraphStyle.cpp #1193896:1193897
@@ -190,7 +190,6 @@
     if (d->parentStyle) {
         d->parentStyle->applyStyle(format);
     }
-    format.clearProperty(QTextFormat::PageBreakPolicy); //this should not be \
inherited according to odf  
     const QMap<int, QVariant> props = d->stylesPrivate.properties();
     QMap<int, QVariant>::const_iterator it = props.begin();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic