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

List:       kde-commits
Subject:    koffice/kword/part
From:       Thomas Zander <zander () kde ! org>
Date:       2010-12-27 13:15:16
Message-ID: 20101227131516.60A59AC8B3 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1209600 by zander:

Use page-style command for changing header/footers

This removes the 'relayout' method which is totally non-sensical
and deleted frames while thats the job of the frameLayout. Wish I could
get some of the stuff the guy that wrote that was smoking ;)

 M  +0 -31     KWDocument.cpp  
 M  +0 -2      KWDocument.h  
 M  +15 -4     KWView.cpp  


--- trunk/koffice/kword/part/KWDocument.cpp #1209599:1209600
@@ -327,37 +327,6 @@
     }
 }
 
-void KWDocument::relayout()
-{
-    foreach (KWFrameSet *fs, m_frameSets) {
-        KWTextFrameSet *tfs = dynamic_cast<KWTextFrameSet*>(fs);
-        if (tfs == 0) continue;
-        if (tfs->textFrameSetType() != KWord::MainTextFrameSet) continue;
-        // we switch to the interaction tool to avoid crashes if the tool was \
                editing a frame.
-        KoToolManager::instance()->switchToolRequested(KoInteractionTool_ID);
-        QSet<KWPage> coveredPages;
-        foreach (KWFrame *frame, tfs->frames()) {
-            KWPage page = pageManager()->page(frame->shape());
-            if (page.isValid()) {
-                if (! coveredPages.contains(page)) {
-                    coveredPages += page;
-                    continue; // keep one frame per page.
-                }
-            }
-
-            foreach (KoView *view, views()) {
-                KoCanvasBase *canvas = static_cast<KWView*>(view)->canvasBase();
-                canvas->shapeManager()->remove(frame->shape());
-            }
-            tfs->removeFrame(frame);
-            delete frame->shape();
-        }
-    }
-    PageProcessingQueue *ppq = new PageProcessingQueue(this);
-    foreach (const KWPage &page, pageManager()->pages())
-        ppq->addPage(page);
-}
-
 void KWDocument::addFrameSet(KWFrameSet *fs)
 {
     if (m_frameSets.contains(fs)) return;
--- trunk/koffice/kword/part/KWDocument.h #1209599:1209600
@@ -167,8 +167,6 @@
     bool layoutFinishedAtleastOnce() const { return m_mainFramesetEverFinished; }
 
 public slots:
-    /// Relayout the pages
-    void relayout();
     /// Register new frameset
     void addFrameSet(KWFrameSet *f);
     /**
--- trunk/koffice/kword/part/KWView.cpp #1209599:1209600
@@ -51,6 +51,7 @@
 #include "commands/KWCreateOutlineCommand.h"
 #include "commands/KWClipFrameCommand.h"
 #include "commands/KWRemoveFrameClipCommand.h"
+#include "commands/KWPageStylePropertiesCommand.h"
 
 // koffice libs includes
 #include <kofficeversion.h>
@@ -1085,8 +1086,13 @@
     if (!m_currentPage.isValid())
         return;
     Q_ASSERT(m_currentPage.pageStyle().isValid());
-    m_currentPage.pageStyle().setHeaderPolicy(m_actionViewHeader->isChecked() ? \
                KWord::HFTypeEvenOdd : KWord::HFTypeNone);
-    m_document->relayout();
+    KWPageStyle after = m_currentPage.pageStyle();
+    after.detach(after.name());
+    after.setHeaderPolicy(m_actionViewHeader->isChecked()
+            ? KWord::HFTypeUniform : KWord::HFTypeNone);
+    KWPageStylePropertiesCommand *cmd = new KWPageStylePropertiesCommand(m_document,
+            m_currentPage.pageStyle(), after);
+    m_document->addCommand(cmd);
 }
 
 void KWView::toggleFooter()
@@ -1094,8 +1100,13 @@
     if (!m_currentPage.isValid())
         return;
     Q_ASSERT(m_currentPage.pageStyle().isValid());
-    m_currentPage.pageStyle().setFooterPolicy(m_actionViewFooter->isChecked() ? \
                KWord::HFTypeEvenOdd : KWord::HFTypeNone);
-    m_document->relayout();
+    KWPageStyle after = m_currentPage.pageStyle();
+    after.detach(after.name());
+    after.setFooterPolicy(m_actionViewFooter->isChecked()
+            ? KWord::HFTypeUniform : KWord::HFTypeNone);
+    KWPageStylePropertiesCommand *cmd = new KWPageStylePropertiesCommand(m_document,
+            m_currentPage.pageStyle(), after);
+    m_document->addCommand(cmd);
 }
 
 void KWView::toggleSnapToGrid()


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

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