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

List:       kde-commits
Subject:    [calligra/calligra/2.9] words/part: Let's remove frameSet() and setFrameSet() from KWFrame
From:       C. Boemann <cbo () boemann ! dk>
Date:       2015-01-31 17:08:53
Message-ID: E1YHbXR-0007y5-HA () scm ! kde ! org
[Download RAW message or body]

Git commit a73754138ca5b8c6fcb6386abd45f08a65ef18e4 by C. Boemann.
Committed on 31/01/2015 at 13:55.
Pushed by boemann into branch 'calligra/2.9'.

Let's remove frameSet() and setFrameSet() from KWFrame
Well we can't completely, but I renamed them so most usage could be avoided

Also changed some dialog to take list of shapes instead of list of frames. There
were no reason to only work on frames

M  +3    -3    words/part/KWDocument.cpp
M  +1    -1    words/part/KWOdfSharedLoadingData.cpp
M  +3    -2    words/part/KWRootAreaProvider.cpp
M  +4    -13   words/part/KWView.cpp
M  +2    -2    words/part/KWView.h
M  +21   -21   words/part/dialogs/KWAnchoringProperties.cpp
M  +4    -6    words/part/dialogs/KWAnchoringProperties.h
M  +6    -6    words/part/dialogs/KWFrameConnectSelector.cpp
M  +10   -9    words/part/dialogs/KWFrameDialog.cpp
M  +1    -1    words/part/dialogs/KWFrameDialog.h
M  +31   -48   words/part/dialogs/KWRunAroundProperties.cpp
M  +2    -3    words/part/dialogs/KWRunAroundProperties.h
M  +1    -3    words/part/dockers/KWStatisticsWidget.cpp
M  +2    -4    words/part/frames/KWCopyShape.cpp
M  +1    -6    words/part/frames/KWFrame.cpp
M  +2    -18   words/part/frames/KWFrame.h
M  +2    -2    words/part/frames/KWFrameLayout.cpp
M  +4    -4    words/part/frames/KWFrameSet.cpp
M  +1    -1    words/part/frames/KWFrameSet.h
M  +2    -2    words/part/frames/KWTextFrameSet.cpp

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

diff --git a/words/part/KWDocument.cpp b/words/part/KWDocument.cpp
index 2ac3b8c..b820145 100644
--- a/words/part/KWDocument.cpp
+++ b/words/part/KWDocument.cpp
@@ -197,7 +197,7 @@ void KWDocument::addShape(KoShape *shape)
 void KWDocument::removeShape(KoShape *shape)
 {
     KWFrame *frame = dynamic_cast<KWFrame*>(shape->applicationData());
-    kDebug(32001) << "shape=" << shape << "frame=" << frame << "frameSetType=" << \
(frame ? Words::frameSetTypeName(frame->frameSet()) : QString()); +    kDebug(32001) \
<< "shape=" << shape << "frame=" << frame << "frameSetType=" << (frame ? \
Words::frameSetTypeName(KWFrameSet::from(shape)) : QString());  KWFrameSet *fs = \
                KWFrameSet::from(shape);
     if (fs) { // not all shapes have to have a frame. Only top-level ones do.
         if (fs->shapeCount() == 1) // last frame on FrameSet
@@ -454,7 +454,7 @@ void KWDocument::addFrameSet(KWFrameSet *fs)
 
 void KWDocument::addFrame(KWFrame *frame)
 {
-    kDebug(32001) << "frame=" << frame << "frameSet=" << frame->frameSet();
+    kDebug(32001) << "frame=" << frame << "frameSet=" << \
KWFrameSet::from(frame->shape());  //firePageSetupChanged();
     emit shapeAdded(frame->shape(), KoShapeManager::AddWithoutRepaint);
 }
@@ -462,7 +462,7 @@ void KWDocument::addFrame(KWFrame *frame)
 void KWDocument::removeFrame(KWFrame *frame)
 {
     if (frame->shape() == 0) return;
-    kDebug(32001) << "frame=" << frame << "frameSet=" << frame->frameSet();
+    kDebug(32001) << "frame=" << frame << "frameSet=" << \
KWFrameSet::from(frame->shape());  
     emit shapeRemoved(frame->shape());
     KWPage page = pageManager()->page(frame->shape());
diff --git a/words/part/KWOdfSharedLoadingData.cpp \
b/words/part/KWOdfSharedLoadingData.cpp index 8f5e47b..66e003e 100644
--- a/words/part/KWOdfSharedLoadingData.cpp
+++ b/words/part/KWOdfSharedLoadingData.cpp
@@ -63,7 +63,7 @@ void KWOdfSharedLoadingData::shapeInserted(KoShape *shape, const \
KoXmlElement &e  KWTextFrameSet *fs = 0;
         KWFrame *previous = m_nextFrames.value(shape->name());
         if (previous)
-            fs = dynamic_cast<KWTextFrameSet*>(previous->frameSet());
+            fs = dynamic_cast<KWTextFrameSet*>(KWFrameSet::from(previous->shape()));
         if (fs == 0) {
             fs = new KWTextFrameSet(m_loader->document());
             fs->setName(m_loader->document()->uniqueFrameSetName(shape->name()));
diff --git a/words/part/KWRootAreaProvider.cpp b/words/part/KWRootAreaProvider.cpp
index 7fde4d2..8a58c47 100644
--- a/words/part/KWRootAreaProvider.cpp
+++ b/words/part/KWRootAreaProvider.cpp
@@ -219,10 +219,11 @@ KoTextLayoutRootArea* \
                KWRootAreaProvider::provideNext(KoTextDocumentLayout *docu
             if (fs->type() != Words::OtherFrameSet && (!tfs || \
tfs->textFrameSetType() != Words::OtherTextFrameSet))  continue;
             foreach (KWFrame *frame, fs->frames()) {
-                if (frame->anchoredPageNumber() == pageNumber) {
+                KoShape *shape = frame->shape();
+                int anchoredPageNumber = shape->anchor() ? \
shape->anchor()->pageNumber() : -1; +                if (anchoredPageNumber == \
pageNumber) {  qreal oldOffset = frame->anchoredFrameOffset();
                     qreal newOffset = rootAreaPage->page.offsetInDocument();
-                    KoShape *shape = frame->shape();
                     if (!qFuzzyCompare(1 + oldOffset, 1 + newOffset)) {
                         frame->setAnchoredFrameOffset(newOffset);
                         QPointF pos(shape->position().x(), newOffset - oldOffset + \
                shape->position().y());
diff --git a/words/part/KWView.cpp b/words/part/KWView.cpp
index c4dda09..9cb6b82 100644
--- a/words/part/KWView.cpp
+++ b/words/part/KWView.cpp
@@ -458,18 +458,9 @@ void KWView::setupActions()
     */
 }
 
-QList<KWFrame*> KWView::selectedFrames() const
+QList<KoShape *> KWView::selectedShapes() const
 {
-    QList<KWFrame*> frames;
-    foreach (KoShape *shape, \
                canvasBase()->shapeManager()->selection()->selectedShapes()) {
-        KWFrame *frame = kwdocument()->frameOfShape(shape);
-
-	if (frame) {
-	    frames.append(frame);
-	}
-    }
-
-    return frames;
+    return canvasBase()->shapeManager()->selection()->selectedShapes(KoFlake::TopLevelSelection);
  }
 
 KoShape* KWView::selectedShape() const
@@ -522,7 +513,7 @@ void KWView::showWordCountInStatusBar(bool doShow)
 
 void KWView::editFrameProperties()
 {
-    QPointer<KWFrameDialog> frameDialog = new KWFrameDialog(selectedFrames(), \
m_document, m_canvas); +    QPointer<KWFrameDialog> frameDialog = new \
KWFrameDialog(selectedShapes(), m_document, m_canvas);  frameDialog->exec();
     delete frameDialog;
 }
@@ -791,7 +782,7 @@ void KWView::selectionChanged()
     if (shape) {
         // Disallow shape properties action for auto-generated frames.
         const KWFrame *frame = kwdocument()->frameOfShape(shape);
-        const bool enableAction = !frame || \
!Words::isAutoGenerated(frame->frameSet()); +        const bool enableAction = !frame \
|| !Words::isAutoGenerated(KWFrameSet::from(frame->shape()));  \
m_actionFormatFrameSet->setEnabled(enableAction);  \
m_actionFormatFrameSet->setVisible(enableAction);  }
diff --git a/words/part/KWView.h b/words/part/KWView.h
index 5413e4f..e49f287 100644
--- a/words/part/KWView.h
+++ b/words/part/KWView.h
@@ -159,8 +159,8 @@ protected:
 private:
     void setupActions();
     virtual KoPrintJob *createPrintJob();
-    /// loops over the selected shapes and returns the frames that go with them.
-    QList<KWFrame*> selectedFrames() const;
+    /// loops over the selected shapes and returns the top level shapes.
+    QList<KoShape *> selectedShapes() const;
     KoShape *selectedShape() const;
 
 private slots:
diff --git a/words/part/dialogs/KWAnchoringProperties.cpp \
b/words/part/dialogs/KWAnchoringProperties.cpp index 0be863e..2154f14 100644
--- a/words/part/dialogs/KWAnchoringProperties.cpp
+++ b/words/part/dialogs/KWAnchoringProperties.cpp
@@ -105,7 +105,6 @@ const int KWAnchoringProperties::horizRels[4][20] = {
 
 KWAnchoringProperties::KWAnchoringProperties(FrameConfigSharedState *state)
     : m_state(state)
-    , m_shape(0)
 {
     widget.setupUi(this);
 
@@ -153,10 +152,10 @@ \
                KWAnchoringProperties::KWAnchoringProperties(FrameConfigSharedState \
                *state)
     connect(widget.cHOffsetArea, SIGNAL(currentIndexChanged(int)), this, \
SLOT(horizRelChanged(int)));  }
 
-bool KWAnchoringProperties::open(const QList<KWFrame*> &frames)
+bool KWAnchoringProperties::open(const QList<KoShape *> &shapes)
 {
     m_state->addUser();
-    m_frames = frames;
+    m_shapes = shapes;
 
     GuiHelper::State anchorTypeHelper = GuiHelper::Unset;
     GuiHelper::State vertHelper = GuiHelper::Unset;
@@ -171,15 +170,16 @@ bool KWAnchoringProperties::open(const QList<KWFrame*> &frames)
 
     bool atLeastOne = false;
 
-    foreach (KWFrame *frame, frames) {
-        if (frame->frameSet()->type() == Words::TextFrameSet) {
-            if (static_cast<KWTextFrameSet *>(frame->frameSet())->textFrameSetType() \
                != Words::OtherTextFrameSet) {
-                continue;
+    foreach (KoShape *shape, shapes) {
+        KWFrameSet *fs = KWFrameSet::from(shape);
+        if (fs && fs->type() == Words::TextFrameSet) {
+            if (static_cast<KWTextFrameSet *>(fs)->textFrameSetType() != \
Words::OtherTextFrameSet) { +                continue; // we don't change for main or \
headers or footers  }
         }
         atLeastOne = true;
 
-        KoShapeAnchor *anchor = frame->shape()->anchor();
+        KoShapeAnchor *anchor = shape->anchor();
         KoShapeAnchor::AnchorType anchorTypeOfFrame = anchor ? anchor->anchorType() \
: KoShapeAnchor::AnchorPage;  
         // FIXME these should fetch correct values if anchor == 0
@@ -492,11 +492,10 @@ void KWAnchoringProperties::anchorTypeChanged(int type)
 
 void KWAnchoringProperties::open(KoShape *shape)
 {
-    m_state->addUser();
-    m_shape = shape;
-    KoShapeAnchor::AnchorType anchorTypeOfShape = KoShapeAnchor::AnchorPage;
-    // This method is only called when creating a new shape, so AnchorPage is what \
                it is at this point
-    m_anchorTypeGroup->button(anchorTypeOfShape)->setChecked(true);
+    QList<KoShape *> list;
+    list.append(shape);
+
+    open(list);
 }
 
 void KWAnchoringProperties::save()
@@ -507,25 +506,26 @@ void KWAnchoringProperties::save()
 void KWAnchoringProperties::save(KUndo2Command *macro, KWCanvas *canvas)
 {
     Q_ASSERT(macro);
-    Q_ASSERT(m_frames.count() > 0);
+    Q_ASSERT(m_shapes.count() > 0);
 
     if (m_anchorTypeGroup->checkedId() != -1) {
-        foreach (KWFrame *frame, m_frames) {
-            if (frame->frameSet()->type() == Words::TextFrameSet) {
-                if (static_cast<KWTextFrameSet \
                *>(frame->frameSet())->textFrameSetType() != \
                Words::OtherTextFrameSet) {
-                    continue;
+        foreach (KoShape *shape, m_shapes) {
+            KWFrameSet *fs = KWFrameSet::from(shape);
+            if (fs && fs->type() == Words::TextFrameSet) {
+                if (static_cast<KWTextFrameSet *>(fs)->textFrameSetType() != \
Words::OtherTextFrameSet) { +                    continue; // we don't change for \
main or headers or footers  }
             }
 
             KoShapeAnchor::AnchorType type = \
KoShapeAnchor::AnchorType(m_anchorTypeGroup->checkedId());  
-            KoShapeAnchor *anchor = frame->shape()->anchor();
+            KoShapeAnchor *anchor = shape->anchor();
             if (!anchor) {
-                anchor = new KoShapeAnchor(frame->shape());
+                anchor = new KoShapeAnchor(shape);
                 anchor->setAnchorType(KoShapeAnchor::AnchorPage);
                 anchor->setHorizontalPos(KoShapeAnchor::HFromLeft);
                 anchor->setVerticalPos(KoShapeAnchor::VFromTop);
-                frame->shape()->setAnchor(anchor);
+                shape->setAnchor(anchor);
             }
             KoShapeContainer *container = 0;
             // we change from page anchored to text shape anchored.
diff --git a/words/part/dialogs/KWAnchoringProperties.h \
b/words/part/dialogs/KWAnchoringProperties.h index 67299d1..36fdab0 100644
--- a/words/part/dialogs/KWAnchoringProperties.h
+++ b/words/part/dialogs/KWAnchoringProperties.h
@@ -30,7 +30,6 @@
 #include <QList>
 #include <QPointF>
 
-class KWFrame;
 class KoShape;
 class KWCanvas;
 
@@ -42,9 +41,9 @@ public:
     /// constructor
     explicit KWAnchoringProperties(FrameConfigSharedState *state);
 
-    /// load all info from the argument frames into this widget
-    /// returns true if at least one frame was accepted
-    bool open(const QList<KWFrame*> &frames);
+    /// load all info from the argument shapes into this widget
+    /// returns true if at least one shape was accepted
+    bool open(const QList<KoShape *> &shapes);
     /// reimplemented
     void open(KoShape *shape);
     /// reimplemented
@@ -76,8 +75,7 @@ private:
     QButtonGroup *m_anchorTypeGroup;
     QButtonGroup *m_vertPosGroup;
     QButtonGroup *m_horizPosGroup;
-    QList<KWFrame*> m_frames;
-    KoShape *m_shape;
+    QList<KoShape *> m_shapes;
     int m_anchorType;
     int m_vertPos;
     int m_horizPos;
diff --git a/words/part/dialogs/KWFrameConnectSelector.cpp \
b/words/part/dialogs/KWFrameConnectSelector.cpp index 2c4ddf6..cdb50f9 100644
--- a/words/part/dialogs/KWFrameConnectSelector.cpp
+++ b/words/part/dialogs/KWFrameConnectSelector.cpp
@@ -52,13 +52,13 @@ bool KWFrameConnectSelector::open(KWFrame *frame)
         m_frameSets.append(textFs);
         QTreeWidgetItem *row = new QTreeWidgetItem(widget.framesList);
         row->setText(0, textFs->name());
-        if (frame->frameSet() == fs)
+        if (KWFrameSet::from(m_frame->shape()) == fs)
             widget.framesList->setCurrentItem(row);
         m_items.append(row);
     }
 
-    if (textFrame->frameSet()) { // already has a frameset
-        KWTextFrameSet *textFs = \
static_cast<KWTextFrameSet*>(textFrame->frameSet()); +    if \
(KWFrameSet::from(textFrame->shape())) { // already has a frameset +        \
KWTextFrameSet *textFs = \
static_cast<KWTextFrameSet*>(KWFrameSet::from(textFrame->shape()));  if \
                (textFs->textFrameSetType() != Words::OtherTextFrameSet)
             return false; // can't alter frameSet of this auto-generated frame!
 
@@ -101,11 +101,11 @@ void KWFrameConnectSelector::nameChanged(const QString &text)
 void KWFrameConnectSelector::save()
 {
     Q_ASSERT(m_frameSets.count() == m_items.count());
-    KWFrameSet *oldFS = m_frame->frameSet();
+    KWFrameSet *oldFS = KWFrameSet::from(m_frame->shape());
     if (widget.newRadio->isChecked()) {
         KWTextFrameSet *newFS = new KWTextFrameSet(m_state->document());
         newFS->setName(widget.frameSetName->text());
-        m_frame->setFrameSet(newFS);
+        m_frame->setFrameSetxx(newFS);
         m_state->document()->addFrameSet(newFS);
     } else { // attach to (different) FS
         QTreeWidgetItem *selected = widget.framesList->currentItem();
@@ -114,7 +114,7 @@ void KWFrameConnectSelector::save()
         Q_ASSERT(index >= 0);
         KWFrameSet *newFS = m_frameSets[index];
         if (oldFS != newFS)
-            m_frame->setFrameSet(newFS);
+            m_frame->setFrameSetxx(newFS);
     }
     if (oldFS && oldFS->shapeCount() == 0) {
         // TODO
diff --git a/words/part/dialogs/KWFrameDialog.cpp \
b/words/part/dialogs/KWFrameDialog.cpp index 1963da9..9302058 100644
--- a/words/part/dialogs/KWFrameDialog.cpp
+++ b/words/part/dialogs/KWFrameDialog.cpp
@@ -27,9 +27,9 @@
 #include "KWRunAroundProperties.h"
 #include "KWAnchoringProperties.h"
 #include "KWCanvas.h"
-#include "frames/KWFrame.h"
+#include "frames/KWFrameSet.h"
 
-KWFrameDialog::KWFrameDialog(const QList<KWFrame*> &frames, KWDocument *document, \
KWCanvas *canvas) +KWFrameDialog::KWFrameDialog(const QList<KoShape *> &shapes, \
KWDocument *document, KWCanvas *canvas)  : KPageDialog(canvas)
         , m_frameConnectSelector(0)
         , m_canvas(canvas)
@@ -38,25 +38,26 @@ KWFrameDialog::KWFrameDialog(const QList<KWFrame*> &frames, \
KWDocument *document  setFaceType(Tabbed);
 
     m_anchoringProperties = new KWAnchoringProperties(m_state);
-    if (m_anchoringProperties->open(frames))
+    if (m_anchoringProperties->open(shapes))
         addPage(m_anchoringProperties, i18n("Smart Positioning"));
 
     m_runAroundProperties = new KWRunAroundProperties(m_state);
-    if (m_runAroundProperties->open(frames))
+    if (m_runAroundProperties->open(shapes))
         addPage(m_runAroundProperties, i18n("Text Run Around"));
 
-    if (frames.count() == 1) {
+    /*
+    if (shapes.count() == 1) {
         m_frameConnectSelector = new KWFrameConnectSelector(m_state);
-        KWFrame *frame = frames.first();
-        m_state->setKeepAspectRatio(frame->shape()->keepAspectRatio());
-        if (m_frameConnectSelector->open(frame))
+        KoShape *shape = shapes.first();
+        m_state->setKeepAspectRatio(shape->keepAspectRatio());
+        if (m_frameConnectSelector->open(shape))
             addPage(m_frameConnectSelector, i18n("Connect Text Frames"));
         else {
             delete m_frameConnectSelector;
             m_frameConnectSelector = 0;
         }
     }
-
+    */
 
     connect(this, SIGNAL(okClicked()), this, SLOT(okClicked()));
     connect(this, SIGNAL(cancelClicked()), this, SLOT(cancelClicked()));
diff --git a/words/part/dialogs/KWFrameDialog.h b/words/part/dialogs/KWFrameDialog.h
index e976544..2ea0c36 100644
--- a/words/part/dialogs/KWFrameDialog.h
+++ b/words/part/dialogs/KWFrameDialog.h
@@ -48,7 +48,7 @@ public:
      * @param document the parent document where the frames belong to
      * @param canvas the canvas for centering the dialog and providing undobuffer
      */
-    KWFrameDialog(const QList<KWFrame*> &selectedFrames, KWDocument *document, \
KWCanvas *canvas = 0); +    KWFrameDialog(const QList<KoShape *> &selectedShapes, \
KWDocument *document, KWCanvas *canvas = 0);  ~KWFrameDialog();
 
     /**
diff --git a/words/part/dialogs/KWRunAroundProperties.cpp \
b/words/part/dialogs/KWRunAroundProperties.cpp index f09d9fe..80dbc58 100644
--- a/words/part/dialogs/KWRunAroundProperties.cpp
+++ b/words/part/dialogs/KWRunAroundProperties.cpp
@@ -28,8 +28,7 @@
 #include <kundo2command.h>
 
 KWRunAroundProperties::KWRunAroundProperties(FrameConfigSharedState *state)
-        : m_state(state),
-        m_shape(0)
+        : m_state(state)
 {
     widget.setupUi(this);
 
@@ -65,10 +64,10 @@ KWRunAroundProperties::KWRunAroundProperties(FrameConfigSharedState \
                *state)
     connect(widget.enough, SIGNAL(toggled(bool)), this, \
SLOT(enoughRunAroundToggled(bool)));  }
 
-bool KWRunAroundProperties::open(const QList<KWFrame*> &frames)
+bool KWRunAroundProperties::open(const QList<KoShape *> &shapes)
 {
     m_state->addUser();
-    m_frames = frames;
+    m_shapes = shapes;
     GuiHelper::State runaround = GuiHelper::Unset;
     GuiHelper::State raDistanceLeft = GuiHelper::Unset;
     GuiHelper::State raDistanceTop = GuiHelper::Unset;
@@ -86,50 +85,51 @@ bool KWRunAroundProperties::open(const QList<KWFrame*> &frames)
 
     bool atLeastOne = false;
 
-    foreach (KWFrame *frame, frames) {
-        if (frame->frameSet()->type() == Words::TextFrameSet) {
-            if (static_cast<KWTextFrameSet *>(frame->frameSet())->textFrameSetType() \
                != Words::OtherTextFrameSet) {
-                continue;
+    foreach (KoShape *shape, shapes) {
+        KWFrameSet *fs = KWFrameSet::from(shape);
+        if (fs && fs->type() == Words::TextFrameSet) {
+            if (static_cast<KWTextFrameSet *>(fs)->textFrameSetType() != \
Words::OtherTextFrameSet) { +                continue; // we don't change for main or \
headers or footers  }
         }
         atLeastOne = true;
         if (runaround == GuiHelper::Unset) {
-            side = frame->shape()->textRunAroundSide();
+            side = shape->textRunAroundSide();
             runaround = GuiHelper::On;
-        } else if (side != frame->shape()->textRunAroundSide())
+        } else if (side != shape->textRunAroundSide())
             runaround = GuiHelper::TriState;
 
         if (raThreshold == GuiHelper::Unset) {
-            threshold = frame->shape()->textRunAroundThreshold();
+            threshold = shape->textRunAroundThreshold();
             raThreshold = GuiHelper::On;
-        } else if (threshold != frame->shape()->textRunAroundThreshold())
+        } else if (threshold != shape->textRunAroundThreshold())
             raThreshold = GuiHelper::TriState;
 
         if (raContour == GuiHelper::Unset) {
-            contour = frame->shape()->textRunAroundContour();
+            contour = shape->textRunAroundContour();
             raContour = GuiHelper::On;
-        } else if (contour != frame->shape()->textRunAroundContour())
+        } else if (contour != shape->textRunAroundContour())
             raContour = GuiHelper::TriState;
 
         if (raDistanceLeft == GuiHelper::Unset) {
-            distanceLeft = frame->shape()->textRunAroundDistanceLeft();
+            distanceLeft = shape->textRunAroundDistanceLeft();
             raDistanceLeft = GuiHelper::On;
-        } else if (distanceLeft != frame->shape()->textRunAroundDistanceLeft())
+        } else if (distanceLeft != shape->textRunAroundDistanceLeft())
             raDistanceLeft = GuiHelper::TriState;
         if (raDistanceTop == GuiHelper::Unset) {
-            distanceTop = frame->shape()->textRunAroundDistanceTop();
+            distanceTop = shape->textRunAroundDistanceTop();
             raDistanceTop = GuiHelper::On;
-        } else if (distanceTop != frame->shape()->textRunAroundDistanceTop())
+        } else if (distanceTop != shape->textRunAroundDistanceTop())
             raDistanceTop = GuiHelper::TriState;
         if (raDistanceRight == GuiHelper::Unset) {
-            distanceRight = frame->shape()->textRunAroundDistanceRight();
+            distanceRight = shape->textRunAroundDistanceRight();
             raDistanceRight = GuiHelper::On;
-        } else if (distanceRight != frame->shape()->textRunAroundDistanceRight())
+        } else if (distanceRight != shape->textRunAroundDistanceRight())
             raDistanceRight = GuiHelper::TriState;
         if (raDistanceBottom == GuiHelper::Unset) {
-            distanceBottom = frame->shape()->textRunAroundDistanceBottom();
+            distanceBottom = shape->textRunAroundDistanceBottom();
             raDistanceBottom = GuiHelper::On;
-        } else if (distanceBottom != frame->shape()->textRunAroundDistanceBottom())
+        } else if (distanceBottom != shape->textRunAroundDistanceBottom())
             raDistanceBottom = GuiHelper::TriState;
     }
 
@@ -160,19 +160,10 @@ bool KWRunAroundProperties::open(const QList<KWFrame*> &frames)
 
 void KWRunAroundProperties::open(KoShape *shape)
 {
-    m_state->addUser();
-    m_shape = shape;
-    m_runAroundSide->button(shape->textRunAroundSide())->setChecked(true);
-    widget.threshold->changeValue(shape->textRunAroundThreshold());
-    widget.distanceLeft->changeValue(shape->textRunAroundDistanceLeft());
-    widget.distanceTop->changeValue(shape->textRunAroundDistanceTop());
-    widget.distanceRight->changeValue(shape->textRunAroundDistanceRight());
-    widget.distanceBottom->changeValue(shape->textRunAroundDistanceBottom());
-    if (shape->textRunAroundContour() == KoShape::ContourFull) {
-        m_runAroundContour->button(KoShape::ContourOutside)->setChecked(true);
-    } else {
-        m_runAroundContour->button(shape->textRunAroundContour())->setChecked(true);
-    }
+    QList<KoShape *> list;
+    list.append(shape);
+
+    open(list);
 }
 
 void KWRunAroundProperties::save()
@@ -182,21 +173,13 @@ void KWRunAroundProperties::save()
 
 void KWRunAroundProperties::save(KUndo2Command *macro)
 {
-    if (m_frames.count() == 0) {
-        KWFrame *frame = m_state->frame();
-        if (frame == 0 && m_shape)
-            frame = m_state->createFrame(m_shape);
-        Q_ASSERT(frame);
-        m_state->markFrameUsed();
-        m_frames.append(frame);
-    }
-    foreach (KWFrame *frame, m_frames) {
-        if (frame->frameSet()->type() == Words::TextFrameSet) {
-            if (static_cast<KWTextFrameSet *>(frame->frameSet())->textFrameSetType() \
                != Words::OtherTextFrameSet) {
-                continue;
+    foreach (KoShape *shape, m_shapes) {
+        KWFrameSet *fs = KWFrameSet::from(shape);
+        if (fs && fs->type() == Words::TextFrameSet) {
+            if (static_cast<KWTextFrameSet *>(fs)->textFrameSetType() != \
Words::OtherTextFrameSet) { +                continue; // we don't change for main or \
headers or footers  }
         }
-        KoShape *shape = frame->shape();
         KoShape::TextRunAroundSide side = shape->textRunAroundSide();
         int runThrough = shape->runThrough();
         qreal distanceLeft = shape->textRunAroundDistanceLeft();
diff --git a/words/part/dialogs/KWRunAroundProperties.h \
b/words/part/dialogs/KWRunAroundProperties.h index 82a717e..cae9111 100644
--- a/words/part/dialogs/KWRunAroundProperties.h
+++ b/words/part/dialogs/KWRunAroundProperties.h
@@ -40,7 +40,7 @@ public:
 
     /// load all info from the argument frames into this widget
     /// returns true if at least one frame was accepted
-    bool open(const QList<KWFrame*> &frames);
+    bool open(const QList<KoShape *> &shapes);
     /// reimplemented
     void open(KoShape *shape);
     /// reimplemented
@@ -63,8 +63,7 @@ private:
     QButtonGroup *m_runAroundSide;
     QButtonGroup *m_runAround;
     QButtonGroup *m_runAroundContour;
-    QList<KWFrame*> m_frames;
-    KoShape *m_shape;
+    QList<KoShape *> m_shapes;
 };
 
 #endif // KWRUNAROUNDPROPERTIES_H
diff --git a/words/part/dockers/KWStatisticsWidget.cpp \
b/words/part/dockers/KWStatisticsWidget.cpp index 2d4b3d7..aacfaf3 100644
--- a/words/part/dockers/KWStatisticsWidget.cpp
+++ b/words/part/dockers/KWStatisticsWidget.cpp
@@ -463,9 +463,7 @@ void KWStatisticsWidget::selectionChanged()
 
     KoShape *shape = m_selection->firstSelectedShape();
     if (!shape) return;
-    KWFrame *frame = dynamic_cast<KWFrame*>(shape->applicationData());
-    if (!frame) return; // you can have embedded shapes selected, in that case it \
                surely is no text frameset.
-    KWTextFrameSet *fs = dynamic_cast<KWTextFrameSet*>(frame->frameSet());
+    KWTextFrameSet *fs = dynamic_cast<KWTextFrameSet*>(KWFrameSet::from(shape));
     if (fs) {
         if (m_textDocument) {
             disconnect(m_textDocument, SIGNAL(contentsChanged()), m_timer, \
                SLOT(start()));
diff --git a/words/part/frames/KWCopyShape.cpp b/words/part/frames/KWCopyShape.cpp
index 1a7ec2b..5ac0ad9 100644
--- a/words/part/frames/KWCopyShape.cpp
+++ b/words/part/frames/KWCopyShape.cpp
@@ -169,11 +169,9 @@ bool KWCopyShape::loadOdf(const KoXmlElement &element, \
KoShapeLoadingContext &co  {
     Q_UNUSED(element);
     Q_UNUSED(context);
-#ifdef __GNUC__
-    #warning TODO: implement KWCopyShape::loadOdf
-#endif
 
-    return false; // TODO
+    return false; // TODO well not really as we only use copy shapes for headers and \
footers and +                  // those copies are not saved
 }
 
 KoShape *KWCopyShape::original() const
diff --git a/words/part/frames/KWFrame.cpp b/words/part/frames/KWFrame.cpp
index 43fcbf1..bc99bcb 100644
--- a/words/part/frames/KWFrame.cpp
+++ b/words/part/frames/KWFrame.cpp
@@ -143,7 +143,7 @@ void KWFrame::cleanupShape(KoShape* shape)
     }
 }
 
-void KWFrame::setFrameSet(KWFrameSet *fs)
+void KWFrame::setFrameSetxx(KWFrameSet *fs)
 {
     if (fs == m_frameSet)
         return;
@@ -174,11 +174,6 @@ void KWFrame::removeCopy(KWFrame* frame)
     m_copyShapes.removeAll(frame);
 }
 
-void KWFrame::copySettings(const KWFrame *frame)
-{
-    shape()->copySettings(frame->shape());
-}
-
 void KWFrame::saveOdf(KoShapeSavingContext &context, const KWPage &page, int \
/*pageZIndexOffset*/) const  {
     if (minimumFrameHeight() > 1) {
diff --git a/words/part/frames/KWFrame.h b/words/part/frames/KWFrame.h
index 342fea6..5440cbe 100644
--- a/words/part/frames/KWFrame.h
+++ b/words/part/frames/KWFrame.h
@@ -77,7 +77,7 @@ public:
      * Return the parent frameset.
      * @return the parent frameset
      */
-    KWFrameSet *frameSet() const {
+    KWFrameSet *frameSetxx() const {
         return m_frameSet;
     }
     /**
@@ -86,19 +86,10 @@ public:
      * new frameset
      * @param newFrameSet the new frameset
      */
-    virtual void setFrameSet(KWFrameSet *newFrameSet);
+    virtual void setFrameSetxx(KWFrameSet *newFrameSet);
 
     void cleanupShape(KoShape* shape);
 
-    /*
-    void clearLoadingData() {
-        m_anchoredPageNumber = -1;
-    }
-    */
-
-    int anchoredPageNumber() const {
-        return m_shape->anchor() ? m_shape->anchor()->pageNumber() : -1;
-    }
     qreal anchoredFrameOffset() const {
         return m_anchoredFrameOffset;
     }
@@ -116,12 +107,6 @@ public:
     void removeCopy(KWFrame* frame);
 
     /**
-     * Copy all the settings from the parameter frame and apply them to this frame.
-     * @param frame the frame to use as original
-     */
-    void copySettings(const KWFrame *frame);
-
-    /**
      * Save the frame as ODF
      * @param context the context for saving.
      */
@@ -129,7 +114,6 @@ public:
 
 private:
     KoShape *m_shape;
-    bool m_copyToEverySheet;
     qreal m_anchoredFrameOffset;
     KWFrameSet *m_frameSet;
     qreal m_minimumFrameHeight;
diff --git a/words/part/frames/KWFrameLayout.cpp \
b/words/part/frames/KWFrameLayout.cpp index 03b096b..ac22b05 100644
--- a/words/part/frames/KWFrameLayout.cpp
+++ b/words/part/frames/KWFrameLayout.cpp
@@ -293,12 +293,12 @@ void KWFrameLayout::layoutFramesOnPage(int pageNumber)
     kDebug(32001) << "pageNumber=" << pageNumber << "columns=" << columns.count << \
"shapeCount=" << frames.count();  foreach (KWFrame *frame, frames) {
         KWTextFrameSet *textFrameSet = 0;
-        switch (frame->frameSet()->type()) {
+        switch (KWFrameSet::from(frame->shape())->type()) {
         case Words::BackgroundFrameSet:
             pageBackground = frame;
             continue;
         case Words::TextFrameSet:
-            textFrameSet = static_cast<KWTextFrameSet*>(frame->frameSet());
+            textFrameSet = \
                static_cast<KWTextFrameSet*>(KWFrameSet::from(frame->shape()));
             if (textFrameSet->textFrameSetType() == Words::OtherTextFrameSet) {
                 minZIndex = qMin(minZIndex, frame->shape()->zIndex());
                 continue;
diff --git a/words/part/frames/KWFrameSet.cpp b/words/part/frames/KWFrameSet.cpp
index 01df9fd..a960d3b 100644
--- a/words/part/frames/KWFrameSet.cpp
+++ b/words/part/frames/KWFrameSet.cpp
@@ -56,10 +56,10 @@ void KWFrameSet::cleanupFrames()
 void KWFrameSet::addFrame(KWFrame *frame)
 {
     Q_ASSERT(frame);
-    kDebug(32001) << "frame=" << frame << "frameSet=" << frame->frameSet();
+    kDebug(32001) << "frame=" << frame << "frameSetxx=" << frame->frameSetxx();
     Q_ASSERT(!m_frames.contains(frame));
     m_frames.append(frame); // this one first, so we don't enter the addFrame twice.
-    frame->setFrameSet(this);
+    frame->setFrameSetxx(this);
     setupFrame(frame);
 
     KWCopyShape* copyShape = dynamic_cast<KWCopyShape*>(frame->shape());
@@ -93,7 +93,7 @@ void KWFrameSet::removeFrame(KWFrame *frame, KoShape *shape)
             KWFrame *frame = frames()[i];
             if (KWCopyShape *cs = dynamic_cast<KWCopyShape*>(frame->shape())) {
                 if (cs->original() == shape) {
-                    Q_ASSERT(frame->frameSet() == this);
+                    Q_ASSERT(frame->frameSetxx() == this);
                     frame->cleanupShape(cs);
                     removeFrame(frame, cs);
                     delete cs;
@@ -103,7 +103,7 @@ void KWFrameSet::removeFrame(KWFrame *frame, KoShape *shape)
     }
 
     if (m_frames.removeAll(frame)) {
-        frame->setFrameSet(0);
+        frame->setFrameSetxx(0);
         emit frameRemoved(frame);
     }
 }
diff --git a/words/part/frames/KWFrameSet.h b/words/part/frames/KWFrameSet.h
index e550f5a..87d6a25 100644
--- a/words/part/frames/KWFrameSet.h
+++ b/words/part/frames/KWFrameSet.h
@@ -47,7 +47,7 @@ public:
     /** fetch the frameset of a shape
      * @param shape the shape to fetch the frameset from
      */
-    static KWFrameSet *from(KoShape *shape) {KWFrame *f = \
dynamic_cast<KWFrame*>(shape->applicationData()); return f ? f->frameSet() : 0;} +    \
static KWFrameSet *from(KoShape *shape) {KWFrame *f = \
dynamic_cast<KWFrame*>(shape->applicationData()); return f ? f->frameSetxx() : 0;}  
     /**
      * Add a new Frame
diff --git a/words/part/frames/KWTextFrameSet.cpp \
b/words/part/frames/KWTextFrameSet.cpp index b5948f1..9eb207c 100644
--- a/words/part/frames/KWTextFrameSet.cpp
+++ b/words/part/frames/KWTextFrameSet.cpp
@@ -77,7 +77,7 @@ KWTextFrameSet::~KWTextFrameSet()
 void KWTextFrameSet::setupFrame(KWFrame *frame)
 {
     Q_ASSERT(frame->shape());
-    Q_ASSERT(frame->frameSet() == this);
+    Q_ASSERT(frame->frameSetxx() == this);
     Q_ASSERT(frames().contains(frame));
 
     KWPage page = m_pageManager->page(frame->shape());
@@ -97,7 +97,7 @@ void KWTextFrameSet::setupFrame(KWFrame *frame)
         return;
     }
 
-    kDebug(32001) << "frameSet=" << frame->frameSet() << "frame=" << frame << \
"pageNumber=" << page.pageNumber(); +    kDebug(32001) << "frameSet=" << \
frame->frameSetxx() << "frame=" << frame << "pageNumber=" << page.pageNumber();  
     // Handle the special case that the KoTextShapeData already defines a \
                QTextDocument that we need
     // to take over. This is the case with OtherTextFrameSet's where the \
KWTextFrameSet


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

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