r18816 by fschmid - Adding an ODG-Importer written from scratch, as the existing ODG import is hopelessly outdated.
scribus-commit
scribus-commit at lists.scribus.net
Sun Feb 16 21:01:30 UTC 2014
Author: fschmid
Date: Sun Feb 16 21:01:30 2014
New Revision: 18816
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18816
Log:
Adding an ODG-Importer written from scratch, as the existing ODG import is hopelessly outdated.
Added:
trunk/Scribus/scribus/plugins/import/odg/
trunk/Scribus/scribus/plugins/import/odg/CMakeLists.txt
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.h
trunk/Scribus/scribus/plugins/import/odg/importodgplugin.cpp
trunk/Scribus/scribus/plugins/import/odg/importodgplugin.h
Modified:
trunk/Scribus/scribus/fpointarray.cpp
trunk/Scribus/scribus/plugins/import/CMakeLists.txt
trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
trunk/Scribus/scribus/plugins/import/pages/importpages.h
trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
trunk/Scribus/scribus/plugins/import/viva/importviva.h
trunk/Scribus/scribus/scribus.cpp
trunk/Scribus/scribus/util.h
Modified: trunk/Scribus/scribus/fpointarray.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/fpointarray.cpp
==============================================================================
--- trunk/Scribus/scribus/fpointarray.cpp (original)
+++ trunk/Scribus/scribus/fpointarray.cpp Sun Feb 16 21:01:30 2014
@@ -898,6 +898,7 @@
double contrlx, contrly, curx, cury, subpathx, subpathy, tox, toy, x1, y1, x2, y2, xc, yc;
double px1, py1, px2, py2, px3, py3;
bool relative;
+ int moveCount = 0;
svgInit();
char command = *(ptr++), lastCommand = ' ';
subpathx = subpathy = curx = cury = contrlx = contrly = 0.0;
@@ -924,6 +925,7 @@
subpathx = curx = relative ? curx + tox : tox;
subpathy = cury = relative ? cury + toy : toy;
svgMoveTo(curx, cury );
+ moveCount++;
break;
}
case 'l':
@@ -1098,11 +1100,11 @@
contrly = cury;
}
}
- if ((lastCommand != 'z') && (lastCommand != 'Z'))
+ if (((lastCommand != 'z') && (lastCommand != 'Z')) || (moveCount > 1))
ret = true;
if (size() > 2)
{
- if ((point(0).x() == point(size()-2).x()) && (point(0).y() == point(size()-2).y()))
+ if ((point(0).x() == point(size()-2).x()) && (point(0).y() == point(size()-2).y()) && (moveCount == 1))
ret = false;
}
}
Modified: trunk/Scribus/scribus/plugins/import/CMakeLists.txt
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/CMakeLists.txt
==============================================================================
--- trunk/Scribus/scribus/plugins/import/CMakeLists.txt (original)
+++ trunk/Scribus/scribus/plugins/import/CMakeLists.txt Sun Feb 16 21:01:30 2014
@@ -4,6 +4,7 @@
ADD_SUBDIRECTORY(cvg)
ADD_SUBDIRECTORY(drw)
ADD_SUBDIRECTORY(idml)
+ADD_SUBDIRECTORY(odg)
ADD_SUBDIRECTORY(oodraw)
ADD_SUBDIRECTORY(pages)
ADD_SUBDIRECTORY(pct)
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Sun Feb 16 21:01:30 2014
@@ -89,9 +89,9 @@
void OODrawImportPlugin::languageChange()
{
importAction->setText( tr("Import &OpenOffice.org Draw..."));
- FileFormat* fmt = getFormatByExt("odg");
- fmt->trName = tr("OpenDocument 1.0 Draw", "Import/export format name");
- fmt->filter = tr("OpenDocument 1.0 Draw (*.odg *.ODG)");
+// FileFormat* fmt = getFormatByExt("odg");
+// fmt->trName = tr("OpenDocument 1.0 Draw", "Import/export format name");
+// fmt->filter = tr("OpenDocument 1.0 Draw (*.odg *.ODG)");
FileFormat* fmt2 = getFormatByExt("sxd");
fmt2->trName = tr("OpenOffice.org 1.x Draw", "Import/export format name");
fmt2->filter = tr("OpenOffice.org 1.x Draw (*.sxd *.SXD)");
@@ -121,18 +121,18 @@
void OODrawImportPlugin::registerFormats()
{
- QString odtName = tr("OpenDocument 1.0 Draw", "Import/export format name");
- FileFormat odtformat(this);
- odtformat.trName = odtName; // Human readable name
- odtformat.formatId = 0;
- odtformat.filter = odtName + " (*.odg *.ODG)"; // QFileDialog filter
- odtformat.fileExtensions = QStringList() << "odg";
- odtformat.load = true;
- odtformat.save = false;
- odtformat.thumb = true;
- odtformat.mimeTypes = QStringList("application/vnd.oasis.opendocument.graphics"); // MIME types
- odtformat.priority = 64; // Priority
- registerFormat(odtformat);
+// QString odtName = tr("OpenDocument 1.0 Draw", "Import/export format name");
+// FileFormat odtformat(this);
+// odtformat.trName = odtName; // Human readable name
+// odtformat.formatId = 0;
+// odtformat.filter = odtName + " (*.odg *.ODG)"; // QFileDialog filter
+// odtformat.fileExtensions = QStringList() << "odg";
+// odtformat.load = true;
+// odtformat.save = false;
+// odtformat.thumb = true;
+// odtformat.mimeTypes = QStringList("application/vnd.oasis.opendocument.graphics"); // MIME types
+// odtformat.priority = 64; // Priority
+// registerFormat(odtformat);
QString sxdName = tr("OpenOffice.org 1.x Draw", "Import/export format name");
FileFormat sxdformat(this);
@@ -169,7 +169,7 @@
flags |= lfInteractive;
PrefsContext* prefs = PrefsManager::instance()->prefsFile->getPluginContext("OODrawImport");
QString wdir = prefs->get("wdir", ".");
- CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), QObject::tr("OpenOffice.org Draw (*.sxd *.odg);;All Files (*)"));
+ CustomFDialog diaf(ScCore->primaryMainWindow(), wdir, QObject::tr("Open"), QObject::tr("OpenOffice.org Draw (*.sxd *.SXD);;All Files (*)"));
if (diaf.exec())
{
fileName = diaf.selectedFile();
@@ -291,7 +291,7 @@
drawPagePNode = body.namedItem( "office:drawing" );
}
}
- else
+ else
drawPagePNode = body;
StyleStack::Mode mode = isOODraw2 ? StyleStack::OODraw2x : StyleStack::OODraw1x;
m_styleStack.setMode( mode );
@@ -426,7 +426,7 @@
drawPagePNode = body.namedItem( "office:drawing" );
}
}
- else
+ else
drawPagePNode = body;
StyleStack::Mode mode = isOODraw2 ? StyleStack::OODraw2x : StyleStack::OODraw1x;
m_styleStack.setMode( mode );
@@ -951,7 +951,7 @@
if( m_styleStack.hasAttribute("svg:stroke-color"))
oostyle.strokeColor = parseColor(m_styleStack.attribute("svg:stroke-color"));
if( m_styleStack.hasAttribute( "svg:stroke-opacity" ) )
- oostyle.strokeTrans = ScCLocale::toDoubleC(m_styleStack.attribute( "svg:stroke-opacity" ).remove( '%' )) / 100.0;
+ oostyle.strokeTrans = 1.0 - ScCLocale::toDoubleC(m_styleStack.attribute( "svg:stroke-opacity" ).remove( '%' )) / 100.0;
if( m_styleStack.attribute( "draw:stroke" ) == "dash" )
{
QString style = m_styleStack.attribute( "draw:stroke-dash" );
@@ -984,7 +984,7 @@
if( m_styleStack.hasAttribute( "draw:fill-color" ) )
oostyle.fillColor = parseColor( m_styleStack.attribute("draw:fill-color"));
if( m_styleStack.hasAttribute( "draw:transparency" ) )
- oostyle.fillTrans = ScCLocale::toDoubleC(m_styleStack.attribute( "draw:transparency" ).remove( '%' )) / 100.0;
+ oostyle.fillTrans = 1.0 - ScCLocale::toDoubleC(m_styleStack.attribute( "draw:transparency" ).remove( '%' )) / 100.0;
}
else if( fill == "gradient" )
{
Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.cpp Sun Feb 16 21:01:30 2014
@@ -53,7 +53,6 @@
#include "sctextstream.h"
#include "selection.h"
#include "undomanager.h"
-#include "util.h"
#include "util_formats.h"
#include "util_icon.h"
#include "util_math.h"
Modified: trunk/Scribus/scribus/plugins/import/pages/importpages.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/pages/importpages.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pages/importpages.h (original)
+++ trunk/Scribus/scribus/plugins/import/pages/importpages.h Sun Feb 16 21:01:30 2014
@@ -17,6 +17,7 @@
#include "pageitem.h"
#include "sccolor.h"
#include "fpointarray.h"
+#include "util.h"
#include <QList>
#include <QTransform>
#include <QMultiMap>
@@ -31,19 +32,6 @@
class Selection;
class TransactionSettings;
class ScZipHandler;
-
-class AttributeValue
-{
- public:
- AttributeValue() : valid(false), value("")
- {
- }
- AttributeValue(QString val) : valid(true), value(val)
- {
- }
- bool valid;
- QString value;
-};
class PagesPlug : public QObject
{
Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.cpp Sun Feb 16 21:01:30 2014
@@ -52,7 +52,6 @@
#include "sctextstream.h"
#include "selection.h"
#include "undomanager.h"
-#include "util.h"
#include "util_formats.h"
#include "util_icon.h"
#include "util_math.h"
Modified: trunk/Scribus/scribus/plugins/import/viva/importviva.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/plugins/import/viva/importviva.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/viva/importviva.h (original)
+++ trunk/Scribus/scribus/plugins/import/viva/importviva.h Sun Feb 16 21:01:30 2014
@@ -19,6 +19,7 @@
#include "sctextstruct.h"
#include "text/storytext.h"
#include "fpointarray.h"
+#include "util.h"
#include <QList>
#include <QTransform>
#include <QMultiMap>
@@ -32,19 +33,6 @@
class ScribusDoc;
class Selection;
class TransactionSettings;
-
-class AttributeValue
-{
- public:
- AttributeValue() : valid(false), value("")
- {
- }
- AttributeValue(QString val) : valid(true), value(val)
- {
- }
- bool valid;
- QString value;
-};
//! \brief Viva importer plugin
class VivaPlug : public QObject
Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Sun Feb 16 21:01:30 2014
@@ -11674,6 +11674,11 @@
void ScribusMainWindow::testQTQuick2_1()
{
/*
+ QQuickView *qqv = new QQuickView;
+ qqv->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml"));
+ qqv->show();
+ */
+ /*
qDebug()<<"Testing Qt Quick 2.0";
QQuickView qqv;
Modified: trunk/Scribus/scribus/util.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18816&path=/trunk/Scribus/scribus/util.h
==============================================================================
--- trunk/Scribus/scribus/util.h (original)
+++ trunk/Scribus/scribus/util.h Sun Feb 16 21:01:30 2014
@@ -37,6 +37,29 @@
class ScribusView;
class ScStreamFilter;
struct CopyPasteBuffer;
+
+class AttributeValue
+{
+ public:
+ AttributeValue() : valid(false), value("")
+ {
+ }
+ AttributeValue(QString val)
+ {
+ if (val.isEmpty() || (val == ""))
+ {
+ valid = false;
+ value = QString();
+ }
+ else
+ {
+ valid = true;
+ value = val;
+ }
+ }
+ bool valid;
+ QString value;
+};
// class Foi;
More information about the scribus-commit
mailing list