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

List:       kde-commits
Subject:    koffice/kword
From:       Sebastian Sauer <mail () dipe ! org>
Date:       2007-03-15 21:23:08
Message-ID: 1173993788.368338.14677.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 642934 by sebsauer:

This is an initial try to get more into our prev opendocument implementation and to \
get it working with KWord again. So far, nothing works expect showing the content as \
simple text. But since that's more then what was working before and since it's a nice \
way to try to understand our prev impl, just let's commit it... :)



 M  +1 -0      part/CMakeLists.txt  
 M  +8 -3      part/KWDocument.cpp  
 M  +1 -0      part/KWDocument.h  
 A             part/KWOpenDocumentLoader.cpp   [License: LGPL (v2+)]
 A             part/KWOpenDocumentLoader.h   [License: LGPL (v2+)]
 M  +41 -9     plugins/scripting/Variable.h  


--- trunk/koffice/kword/part/CMakeLists.txt #642933:642934
@@ -19,6 +19,7 @@
     KWViewMode.cpp
     KWViewModeNormal.cpp
     KWViewModePreview.cpp
+    KWOpenDocumentLoader.cpp
     KWDLoader.cpp
 
     frame/KWTextDocumentLayout.cpp
--- trunk/koffice/kword/part/KWDocument.cpp #642933:642934
@@ -25,6 +25,7 @@
 #include "KWCanvas.h"
 #include "KWPageManager.h"
 #include "KWPage.h"
+#include "KWOpenDocumentLoader.h"
 #include "KWDLoader.h"
 #include "frame/KWFrameSet.h"
 #include "frame/KWTextFrameSet.h"
@@ -340,9 +341,13 @@
     m_inlineTextObjectManager->setProperty(KoInlineObject::PageCount, pageCount());
 }
 
-bool KWDocument::loadOasis(const QDomDocument&, KoOasisStyles&, const QDomDocument&, \
                KoStore*) {
-    // TODO
-    return false;
+bool KWDocument::loadOasis(const QDomDocument& doc, KoOasisStyles& styles, const \
QDomDocument& settings, KoStore* store) { +    clear();
+    KWOpenDocumentLoader loader(this);
+    bool rc = loader.load(doc, styles, settings, store);
+    if (rc)
+        endOfLoading();
+    return rc;
 }
 
 bool KWDocument::loadXML( QIODevice *, const QDomDocument & doc ) {
--- trunk/koffice/kword/part/KWDocument.h #642933:642934
@@ -241,6 +241,7 @@
 private:
     friend class PageProcessingQueue;
     friend class KWDLoader;
+    friend class KWOpenDocumentLoader;
     friend class KWStartupWidget;
     QString renameFrameSet( const QString& prefix , const QString& base );
     /// post process loading after either oasis or oldxml loading finished
--- trunk/koffice/kword/plugins/scripting/Variable.h #642933:642934
@@ -34,20 +34,25 @@
 
 namespace Scripting {
 
-    class Variable : public KoVariable
+    class Variable : public QObject, public KoVariable
     {
+            Q_OBJECT
         public:
             explicit Variable(Kross::Action* action, const KoProperties* props = 0)
-                : KoVariable(), m_action(action), m_props(props)
-            {
-            }
-
-            virtual ~Variable() {}
-
+                : KoVariable(), m_action(action), m_props(props), m_optionswidget(0) \
{} +            virtual ~Variable() { setOptionsWidget(); }
             Kross::Action* action() const { return m_action; }
 
             virtual void setProperties(const KoProperties* props)
             {
+                kDebug(32010) << "Scripting::Variable::setProperties" << endl;
+                //Q_ASSERT(props);
+                //QString value = props->property("value").toString();
+                //setValue(value);
+
+                m_props = props;
+                emit propertiesUpdated();
+#if 0
                 Q_ASSERT(props);
                 const QString function = m_props->property("getValue").toString();
                 kDebug(32010) << "Scripting::Variable::setProperties: function=" << \
function << endl; @@ -63,11 +68,16 @@
                 }
                 QString value = props->property("value").toString();
                 setValue(value);
+#endif
             }
 
             virtual QWidget* createOptionsWidget()
             {
                 kDebug(32010) << "Scripting::Variable::createOptionsWidget" << endl;
+                emit optionsWidgetRequest();
+                return m_optionswidget;
+
+#if 0
                 QWidget* resultwidget = 0;
                 //m_action->setProperty("PropertyName", m_action->objectName());
                 const QString function = \
m_props->property("createOptionsWidget").toString(); @@ -83,17 +93,37 @@
                             resultwidget = dynamic_cast< QWidget* >( qvariant_cast< \
QObject* >(result) );  }
                 }
-
                 //m_action->trigger();
                 //QString widgetname = m_action->property("OptionsWidget");
                 if( value().isNull() && m_props )
                     setProperties(m_props);
-
                 return resultwidget;
+#endif
             }
+
+        public Q_SLOTS:
+
+            QString value() const {
+                return KoVariable::value();
+            }
+
+            void setValue(const QString& value) {
+                KoVariable::setValue(value);
+            }
+
+            void setOptionsWidget(QWidget* optionswidget = 0) {
+                //delete m_optionswidget;
+                m_optionswidget = optionswidget;
+            }
+
+        Q_SIGNALS:
+            void propertiesUpdated();
+            void optionsWidgetRequest();
+
         private:
             Kross::Action* m_action;
             const KoProperties* m_props;
+            QWidget* m_optionswidget;
     };
 
     class VariableFactory : public KoInlineObjectFactory
@@ -107,10 +137,12 @@
                 var.name = action->text();
                 KoProperties *props = new KoProperties();
                 props->setProperty("id", action->objectName());
+                /*
                 foreach(QString propname, action->propertyNames()) {
                     const QString value = action->property(propname);
                     props->setProperty(propname, value);
                 }
+                */
                 var.properties = props;
                 addTemplate(var);
             }


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

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