[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: Benjamin Port <port.benjamin () gmail ! com>
Date: 2011-03-31 22:00:25
Message-ID: 20110331220025.DD142A60B0 () git ! kde ! org
[Download RAW message or body]
Git commit 2ee42137a89b24ad2cef7b8fec049558dcbf2414 by Benjamin Port.
Committed on 31/03/2011 at 23:54.
Pushed by bport into branch 'stage-outline-bport-artaud'.
Use Block user data, and kept block order
M +23 -11 kpresenter/part/KPrViewModeOutline.cpp
M +21 -0 kpresenter/part/KPrViewModeOutline.h
M +1 -1 kpresenter/part/pagelayout/KPrPlaceholders.cpp
http://commits.kde.org/calligra/2ee42137a89b24ad2cef7b8fec049558dcbf2414
diff --git a/kpresenter/part/KPrViewModeOutline.cpp b/kpresenter/part/KPrViewModeOutline.cpp
index 58e94ba..76ab6f2 100644
--- a/kpresenter/part/KPrViewModeOutline.cpp
+++ b/kpresenter/part/KPrViewModeOutline.cpp
@@ -128,18 +128,30 @@ void KPrViewModeOutline::populate()
foreach (KoPAPageBase * pageBase, m_view->kopaDocument()->pages()) {
if (KPrPage * page = dynamic_cast<KPrPage *>(pageBase)) {
int pageNumber = m_view->kopaDocument()->pages().indexOf(pageBase);
-
- // Copy relevant content of the title of the page in the frame
+ QTextBlockFormat blockFormat;
+ blockFormat.setBackground((pageNumber%2)?QBrush(Qt::gray):QBrush(Qt::white));
+ // Copy relevant content of the "view" block of the page in the "outline" block
+ // Do three iterations in order to kept the correct order i.e. Title, Subtitle, Outline
foreach (OutlinePair pair, page->placeholders().outlineData()) {
- QTextBlockFormat blockFormat;
- blockFormat.setBackground((pageNumber%2)?QBrush(Qt::gray):QBrush(Qt::white));
- // set the page property
- blockFormat.setProperty(0, pageNumber);
- // set the type property
- blockFormat.setProperty(1, pair.first);
-
- currentCursor.insertBlock(blockFormat);
- currentCursor.insertText(pair.second->document()->toPlainText());
+ if (pair.first == Title) {
+ currentCursor.insertBlock(blockFormat);
+ currentCursor.block().setUserData(new SlideUserBlockData(pageNumber, pair));
+ currentCursor.insertText(pair.second->document()->toPlainText());
+ }
+ }
+ foreach (OutlinePair pair, page->placeholders().outlineData()) {
+ if (pair.first == Subtitle) {
+ currentCursor.insertBlock(blockFormat);
+ currentCursor.block().setUserData(new SlideUserBlockData(pageNumber, pair));
+ currentCursor.insertText(pair.second->document()->toPlainText());
+ }
+ }
+ foreach (OutlinePair pair, page->placeholders().outlineData()) {
+ if (pair.first == Outline) {
+ currentCursor.insertBlock(blockFormat);
+ currentCursor.block().setUserData(new SlideUserBlockData(pageNumber, pair));
+ currentCursor.insertText(pair.second->document()->toPlainText());
+ }
}
}
}
diff --git a/kpresenter/part/KPrViewModeOutline.h b/kpresenter/part/KPrViewModeOutline.h
index a19e5c5..3c96bda 100644
--- a/kpresenter/part/KPrViewModeOutline.h
+++ b/kpresenter/part/KPrViewModeOutline.h
@@ -22,7 +22,10 @@
#ifndef KPRVIEWMODEOUTLINE_H
#define KPRVIEWMODEOUTLINE_H
+#include <QTextBlockUserData>
+
#include "KoPAViewMode.h"
+#include "pagelayout/KPrPlaceholders.h"
class KoPAView;
class KoPACanvas;
@@ -46,6 +49,24 @@ public:
void activate(KoPAViewMode *previousViewMode);
void deactivate();
void populate();
+protected:
+ /**
+ * Class to manage block data
+ */
+ class SlideUserBlockData : public QTextBlockUserData
+ {
+ public:
+ SlideUserBlockData(int pageNumber, OutlinePair outlinePair)
+ : m_pageNumber(pageNumber), m_outlinePair(outlinePair)
+ {}
+
+ ~SlideUserBlockData() {}
+ int pageNumber() { return m_pageNumber; }
+ OutlinePair outlinePair() { return m_outlinePair; }
+ private:
+ int m_pageNumber;
+ OutlinePair m_outlinePair;
+ };
private:
KPrOutlineEditor *m_outlineEditor;
diff --git a/kpresenter/part/pagelayout/KPrPlaceholders.cpp b/kpresenter/part/pagelayout/KPrPlaceholders.cpp
index 5510fe3..60b5214 100644
--- a/kpresenter/part/pagelayout/KPrPlaceholders.cpp
+++ b/kpresenter/part/pagelayout/KPrPlaceholders.cpp
@@ -258,7 +258,7 @@ OutlineData KPrPlaceholders::outlineData() const
OutlineData outline;
for (Placeholders::iterator it( m_placeholders.begin() ) ; it != m_placeholders.end(); ++it ) {
KoTextShapeData * data = ( dynamic_cast<KPrPlaceholderShape *>( it->shape ) ) ?
- 0 : qobject_cast<KoTextShapeData*>( it->shape->userData() );
+ 0 : qobject_cast<KoTextShapeData*>( it->shape->userData() );
if (it->presentationClass == "title") {
outline.append(QPair<PlaceholderType, KoTextShapeData*>(Title, data));
} else if (it->presentationClass == "subtitle") {
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic