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

List:       kde-commits
Subject:    [calligra/plugins-formulashape2g-gopalK] /: Fixed loading and saving of formulashape 2g.
From:       Gopalakrishna Bhat A <gopalakbhat () gmail ! com>
Date:       2013-03-03 16:50:54
Message-ID: 20130303165054.B9406A604F () git ! kde ! org
[Download RAW message or body]

Git commit cbcbe1e923abfe375a15004c3e2cfecf44c767b6 by Gopalakrishna Bhat A.
Committed on 03/03/2013 at 23:19.
Pushed by gopalakrishnabhat into branch 'plugins-formulashape2g-gopalK'.

Fixed loading and saving of formulashape 2g.

M  +2    -2    libs/odf/KoXmlReader.cpp
M  +14   -0    plugins/staging/formulashape-2g/FormulaDocument.cpp
M  +3    -0    plugins/staging/formulashape-2g/FormulaDocument.h
M  +1    -1    plugins/staging/formulashape-2g/FormulaShape.cpp

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

diff --git a/libs/odf/KoXmlReader.cpp b/libs/odf/KoXmlReader.cpp
index b5fe9f8..d4d5b72 100644
--- a/libs/odf/KoXmlReader.cpp
+++ b/libs/odf/KoXmlReader.cpp
@@ -1788,7 +1788,7 @@ static void itemAsQDomNode(QDomDocument& ownerDoc, \
KoXmlPackedDocument* packedDo  if (i != -1) prefix = qName.left(i);
                 if (i != -1) localName = qName.mid(i + 1);
 
-                if (packedDoc->processNamespace) {
+                if (packedDoc->processNamespace && i != -1) {
                     element.setAttributeNS(qname.nsURI, qName, value);
                     element.setAttribute(localName, value);
                 } else
@@ -1881,7 +1881,7 @@ static void itemAsQDomNode(QDomDocument& ownerDoc, \
KoXmlPackedDocument* packedDo  if (i != -1) prefix = qName.left(i);
                 if (i != -1) localName = qName.mid(i + 1);
 
-                if (packedDoc->processNamespace) {
+                if (packedDoc->processNamespace && i != -1) {
                     element.setAttributeNS(nsURI, qName, value);
                     element.setAttribute(localName, value);
                 } else
diff --git a/plugins/staging/formulashape-2g/FormulaDocument.cpp \
b/plugins/staging/formulashape-2g/FormulaDocument.cpp index 306b1a6..8f8f17b 100644
--- a/plugins/staging/formulashape-2g/FormulaDocument.cpp
+++ b/plugins/staging/formulashape-2g/FormulaDocument.cpp
@@ -57,6 +57,7 @@ public:
     ~Private();
 
     FormulaShape *parent;
+    QString content;
 };
 
 FormulaDocument::Private::Private()
@@ -160,4 +161,17 @@ void FormulaDocument::paintContent( QPainter &painter, const \
QRect &rect )  Q_UNUSED( rect );
 }
 
+bool FormulaDocument::setContent(QString text, QString *errorMsg, int *errorLine, \
int *errorColumn) +{
+    if (QtMmlDocument::setContent(text, errorMsg, errorLine, errorColumn)) {
+        d->content = text;
+        return true;
+    }
 
+    return false;
+}
+
+QString FormulaDocument::content()
+{
+    return d->content;
+}
diff --git a/plugins/staging/formulashape-2g/FormulaDocument.h \
b/plugins/staging/formulashape-2g/FormulaDocument.h index 533b81a..d0dca3c 100644
--- a/plugins/staging/formulashape-2g/FormulaDocument.h
+++ b/plugins/staging/formulashape-2g/FormulaDocument.h
@@ -52,6 +52,9 @@ public:
     KoView *createViewInstance( QWidget *parent );
     
     void paintContent( QPainter &painter, const QRect &rect ); 
+
+    bool setContent(QString text, QString *errorMsg, int *errorLine, int \
*errorColumn); +    QString content();
     
 private:
     class Private;
diff --git a/plugins/staging/formulashape-2g/FormulaShape.cpp \
b/plugins/staging/formulashape-2g/FormulaShape.cpp index 5cf70e4..fd3f838 100644
--- a/plugins/staging/formulashape-2g/FormulaShape.cpp
+++ b/plugins/staging/formulashape-2g/FormulaShape.cpp
@@ -82,7 +82,7 @@ void FormulaShape::saveOdf(KoShapeSavingContext &context) const
     saveOdfAttributes(context, OdfAllAttributes);
     writer.startElement( "draw:object" );
     // TODO add some namespace magic to avoid adding "math:" namespace everywhere
-    //formulaData()->formulaElement()->writeMathML( &context.xmlWriter() );
+    writer.addCompleteElement(m_document->content().toUtf8());
     writer.endElement(); // draw:object
     writer.endElement(); // draw:frame
 }


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

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