r18853 by fschmid - Fixed Bug #12099: Non-working text import woth ODP files
scribus-commit
scribus-commit at lists.scribus.net
Thu Feb 27 20:51:05 UTC 2014
Author: fschmid
Date: Thu Feb 27 20:51:05 2014
New Revision: 18853
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18853
Log:
Fixed Bug #12099: Non-working text import woth ODP files
Modified:
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.h
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18853&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Thu Feb 27 20:51:05 2014
@@ -632,7 +632,7 @@
{
ObjStyle tmpOStyle;
PageItem *retObj = NULL;
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
if (e.hasAttribute("svg:d"))
@@ -694,7 +694,7 @@
double y = parseUnit(e.attribute("svg:y")) ;
double w = parseUnit(e.attribute("svg:width"));
double h = parseUnit(e.attribute("svg:height"));
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
bool has_Text = false;
@@ -919,7 +919,7 @@
double y1 = e.attribute( "svg:y1" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:y1" ) );
double x2 = e.attribute( "svg:x2" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:x2" ) );
double y2 = e.attribute( "svg:y2" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:y2" ) );
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if (tmpOStyle.measureDist == 0)
tmpOStyle.measureDist = tmpOStyle.fontSize;
QLineF refLine = QLineF(x1, y1, x2, y2);
@@ -996,7 +996,7 @@
double y1 = e.attribute( "svg:y1" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:y1" ) );
double x2 = e.attribute( "svg:x2" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:x2" ) );
double y2 = e.attribute( "svg:y2" ).isEmpty() ? 0.0 : parseUnit( e.attribute( "svg:y2" ) );
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if (tmpOStyle.stroke_type == 0)
return retObj;
int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, tmpOStyle.LineW, CommonStrings::None, tmpOStyle.CurrColorStroke, true);
@@ -1034,7 +1034,7 @@
double y = parseUnit(e.attribute("svg:y")) ;
double w = parseUnit(e.attribute("svg:width"));
double h = parseUnit(e.attribute("svg:height"));
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Ellipse, baseX+x, baseY+y, w, h, tmpOStyle.LineW, tmpOStyle.CurrColorFill, tmpOStyle.CurrColorStroke, true);
@@ -1055,7 +1055,7 @@
double w = parseUnit(e.attribute("svg:width"));
double h = parseUnit(e.attribute("svg:height"));
double corner = parseUnit(e.attribute("draw:corner-radius"));
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Rectangle, baseX+x, baseY+y, w, h, tmpOStyle.LineW, tmpOStyle.CurrColorFill, tmpOStyle.CurrColorStroke, true);
@@ -1077,7 +1077,7 @@
{
ObjStyle tmpOStyle;
PageItem *retObj = NULL;
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
int z = m_Doc->itemAdd(PageItem::Polygon, PageItem::Unspecified, baseX, baseY, 10, 10, tmpOStyle.LineW, tmpOStyle.CurrColorFill, tmpOStyle.CurrColorStroke, true);
@@ -1095,7 +1095,7 @@
{
ObjStyle tmpOStyle;
PageItem *retObj = NULL;
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if (tmpOStyle.stroke_type == 0)
return retObj;
int z = m_Doc->itemAdd(PageItem::PolyLine, PageItem::Unspecified, baseX, baseY, 10, 10, tmpOStyle.LineW, CommonStrings::None, tmpOStyle.CurrColorStroke, true);
@@ -1126,7 +1126,7 @@
{
ObjStyle tmpOStyle;
PageItem *retObj = NULL;
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
if ((tmpOStyle.fill_type == 0) && (tmpOStyle.stroke_type == 0))
return retObj;
FPointArray pArray;
@@ -1186,7 +1186,7 @@
double r = 0.0;
if (e.hasAttribute("draw:transform"))
parseTransform(e.attribute("draw:transform"), &r, &x, &y);
- resovleStyle(tmpOStyle, e.attribute("draw:style-name"));
+ resovleStyle(tmpOStyle, getStyleName(e));
QDomElement n = e.firstChildElement();
if (!n.isNull())
{
@@ -1940,6 +1940,16 @@
}
}
+QString OdgPlug::getStyleName(QDomElement &e)
+{
+ QString styleName = "standard";
+ if (e.hasAttribute("draw:style-name"))
+ styleName = e.attribute("draw:style-name");
+ else if (e.hasAttribute("presentation:style-name"))
+ styleName = e.attribute("presentation:style-name");
+ return styleName;
+}
+
void OdgPlug::resovleStyle(ObjStyle &tmpOStyle, QString pAttrs)
{
if (m_Styles.contains(pAttrs))
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18853&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.h (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.h Thu Feb 27 20:51:05 2014
@@ -283,6 +283,7 @@
void parseViewBox( const QDomElement& object, double *x, double *y, double *w, double *h );
void appendPoints(FPointArray *composite, const QDomElement& object, bool closePath);
void parseStyles(QDomElement &sp);
+ QString getStyleName(QDomElement &e);
void resovleStyle(ObjStyle &tmpOStyle, QString pAttrs);
double parseUnit(const QString &unit);
const char * getCoord( const char *ptr, double &number );
More information about the scribus-commit
mailing list