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

List:       kde-commits
Subject:    =?utf-8?q?=5Bcalligra/stage-outline-bport-artaud=5D_kpresenter/p?=
From:       Jean-Nicolas Artaud <jeannicolasartaud () gmail ! com>
Date:       2011-03-26 13:22:13
Message-ID: 20110326132213.79D49A609B () git ! kde ! org
[Download RAW message or body]

Git commit ecbc0e97cc489a1f434cc491f074eb575474cf52 by Jean-Nicolas Artaud.
Committed on 26/03/2011 at 14:20.
Pushed by artaud into branch 'stage-outline-bport-artaud'.

Add the properties to the outline blocks (page number and outline type).
Add some charFormat.

M  +48   -4    kpresenter/part/KPrViewModeOutline.cpp     

http://commits.kde.org/calligra/ecbc0e97cc489a1f434cc491f074eb575474cf52

diff --git a/kpresenter/part/KPrViewModeOutline.cpp \
b/kpresenter/part/KPrViewModeOutline.cpp index 662b643..3703b79 100644
--- a/kpresenter/part/KPrViewModeOutline.cpp
+++ b/kpresenter/part/KPrViewModeOutline.cpp
@@ -30,6 +30,7 @@
 #include "KPrOutlineEditor.h"
 
 #include <KDebug>
+#include <QtGui/qtextformat.h>
 
 KPrViewModeOutline::KPrViewModeOutline(KoPAView *view, KoPACanvas *canvas)
     : KoPAViewMode( view, canvas )
@@ -123,16 +124,59 @@ void KPrViewModeOutline::populate()
     int recordPosition = m_outlineEditor->textCursor().position();
     m_outlineEditor->clear();
     QTextCursor currentCursor = m_outlineEditor->textCursor();
-
+    int cpt = 0;
+    
     // For each slides
     foreach (KoPAPageBase * pageBase, m_view->kopaDocument()->pages()) {
         if (KPrPage * page = dynamic_cast<KPrPage *>(pageBase)) {
+            cpt++;
             
             // Copy relevant content of the title of the page in the frame
             foreach (OutlinePair pair, page->placeholders().outlineData()) {
-                currentCursor.insertBlock();
-                currentCursor.insertText(pair.second->document()->toPlainText());
-                kDebug() << pair.second->document()->toPlainText();
+                if (pair.first == Title) {
+                    
+                    QTextBlockFormat blockFormat;
+                    \
blockFormat.setBackground((cpt%2)?QBrush(Qt::white):QBrush(Qt::gray)); +              \
// set the page property +                    blockFormat.setProperty(0, cpt);
+                    // set the type property
+                    blockFormat.setProperty(1, Title);
+                    
+                    currentCursor.insertBlock(blockFormat, \
pair.second->document()->firstBlock().charFormat()); +                    \
currentCursor.insertText(pair.second->document()->toPlainText()); +                }
+            }
+
+            // Copy relevant content of the outline of the page in the frame
+            foreach (OutlinePair pair, page->placeholders().outlineData()) {
+                if (pair.first == Subtitle) {
+
+                    QTextBlockFormat blockFormat;
+                    \
blockFormat.setBackground((cpt%2)?QBrush(Qt::white):QBrush(Qt::gray)); +              \
// set the page property +                    blockFormat.setProperty(0, cpt);
+                    // set the type property
+                    blockFormat.setProperty(1, Subtitle);
+                    
+                    currentCursor.insertBlock(blockFormat, \
pair.second->document()->firstBlock().charFormat()); +                    \
currentCursor.insertText(pair.second->document()->toPlainText()); +                }
+            }
+            
+            // Copy relevant content of the outline of the page in the frame
+            foreach (OutlinePair pair, page->placeholders().outlineData()) {
+                if (pair.first == Outline) {
+
+                    QTextBlockFormat blockFormat;
+                    \
blockFormat.setBackground((cpt%2)?QBrush(Qt::white):QBrush(Qt::gray)); +              \
// set the page property +                    blockFormat.setProperty(0, cpt);
+                    // set the type property
+                    blockFormat.setProperty(1, Outline);
+                    
+                    currentCursor.insertBlock(blockFormat, \
pair.second->document()->firstBlock().charFormat()); +                    \
currentCursor.insertText(pair.second->document()->toPlainText()); +                }
             }
         }
     }


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

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