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

List:       kde-commits
Subject:    koffice/kword
From:       Thomas Zander <zander () kde ! org>
Date:       2008-10-25 23:08:48
Message-ID: 1224976128.308382.32649.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 875905 by zander:

After the refactor with dataMaps we started seeing various crashes,
this fixes the one in KWFrameLayout and removes code in the scripting
engine that no longer can work.

 M  +4 -1      part/frames/KWFrameLayout.cpp  
 M  +0 -31     plugins/scripting/FrameSet.h  
 M  +0 -12     plugins/scripting/Module.cpp  
 M  +1 -14     plugins/scripting/Module.h  


--- trunk/koffice/kword/part/frames/KWFrameLayout.cpp #875904:875905
@@ -499,7 +499,10 @@
     Q_ASSERT(page.isValid());
     KoShapeFactory *factory = KoShapeRegistry::instance()->value(TextShape_SHAPEID);
     Q_ASSERT(factory);
-    KoShape *shape = factory->createDefaultShapeAndInit(m_document->dataCenterMap());
+    QMap<QString, KoDataCenter *> dataCenterMap;
+    if (m_document)
+        dataCenterMap = m_document->dataCenterMap();
+    KoShape *shape = factory->createDefaultShapeAndInit(dataCenterMap);
     shape->setPosition(QPointF(0, page.offsetInDocument()));
     return shape;
 }
--- trunk/koffice/kword/plugins/scripting/FrameSet.h #875904:875905
@@ -95,37 +95,6 @@
         return 0;
     }
 
-    /** Add and return a new \a Frame to this frameset using the shape
-    defined with the \p shapeId identifier. */
-    QObject* addFrame(const QString& shapeId) {
-        KoShapeFactory *factory = KoShapeRegistry::instance()->value(shapeId);
-        if (! factory) {
-            kWarning(32010) << "Scripting::Module::addFrame() Invalid shapeId: " << shapeId << endl;
-            return 0;
-        }
-        // FIXME check if it is ok to pass an empty map. The shape might not work and crash the program
-        QMap<QString, KoDataCenter *> dataCenterMap;
-        KoShape *shape = factory->createDefaultShapeAndInit( dataCenterMap );
-        Q_ASSERT(shape);
-        shape->setZIndex(100 + m_frameset->frameCount());
-        KWFrame* frame = 0;
-        KWTextFrameSet* textframeset = dynamic_cast<KWTextFrameSet*>((KWFrameSet*)m_frameset);
-        if (textframeset)
-            frame = new KWTextFrame(shape, textframeset);
-        else
-            frame = new KWFrame(shape, m_frameset);
-        return new Frame(this, frame);
-    }
-
-    /** Add and return a new \a Frame to this frameset which has the
-    shapeId KoTextShape_SHAPEID and is used to display the \a TextDocument . */
-    QObject* addTextFrame() {
-        return addFrame(TextShape_SHAPEID);
-    }
-
-    //void addFrame(KWFrame *frame);
-    //void removeFrame(KWFrame *frame);
-
     /** Return the \a TextDocument object or NULL if this frameset does not
     have a \a TextDocument object. */
     QObject* document() {
--- trunk/koffice/kword/plugins/scripting/Module.cpp #875904:875905
@@ -185,18 +185,6 @@
     return 0;
 }
 
-QObject* Module::addTextFrame(const QString& framesetname)
-{
-    FrameSet* set = dynamic_cast< FrameSet* >(addTextFrameSet(framesetname));
-    return set ? set->addTextFrame() : 0;
-}
-
-QObject* Module::addFrame(const QString& framesetname, const QString& shapeId)
-{
-    FrameSet* set = dynamic_cast< FrameSet* >(addFrameSet(framesetname));
-    return set ? set->addFrame(shapeId) : 0;
-}
-
 QObject* Module::findFrameSet(KWord::TextFrameSetType type)
 {
     foreach(KWFrameSet* set, kwDoc()->frameSets()) {
--- trunk/koffice/kword/plugins/scripting/Module.h #875904:875905
@@ -167,19 +167,6 @@
     /** Return a the \a Frame object identified by the index frameNr. */
     QObject* frame(int frameNr);
 
-    /** Add and return a new \a FrameSet object for text handled with \a TextDocument .
-    *
-    * Python sample code;
-    * \code
-    * import KWord
-    * textshape = KWord.addTextFrame("MyTextShape")
-    * textshape.document().setText("Some text")
-    * \endcode
-    */
-    QObject* addTextFrame(const QString& framesetname);
-    /** Add and return a new \a FrameSet object. */
-    QObject* addFrame(const QString& framesetname, const QString& shapeId);
-
     /***** Page Layout *****/
 
     /** Return the standard page layout. */
@@ -206,7 +193,7 @@
     QObject* tool();
 
 private:
-    /// \internal d-pointer class.
+    /// \internal d-pointer class. (TODO: remove the dpointer, just overhead for non-exported class)
     class Private;
     /// \internal d-pointer instance.
     Private* const d;
[prev in list] [next in list] [prev in thread] [next in thread] 

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