|
|
@ -443,7 +443,6 @@ bool UBCFFAdaptor::UBToCFFConverter::parseMetadata() |
|
|
|
QSize tmpSize = getSVGDimentions(nextInElement.text()); |
|
|
|
QSize tmpSize = getSVGDimentions(nextInElement.text()); |
|
|
|
if (!tmpSize.isNull()) { |
|
|
|
if (!tmpSize.isNull()) { |
|
|
|
mSVGSize = tmpSize; |
|
|
|
mSVGSize = tmpSize; |
|
|
|
mViewbox.setRect(0,0, tmpSize.width(), tmpSize.height()); |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
qDebug() << "can't interpret svg section size"; |
|
|
|
qDebug() << "can't interpret svg section size"; |
|
|
|
errorStr = "InterpretSvgSizeError"; |
|
|
|
errorStr = "InterpretSvgSizeError"; |
|
|
@ -487,6 +486,11 @@ bool UBCFFAdaptor::UBToCFFConverter::parseContent() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (QRect() == mViewbox) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mViewbox.setRect(0,0, mSVGSize.width(), mSVGSize.height()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
svgDocumentSection.setAttribute(aIWBViewBox, rectToIWBAttr(mViewbox)); |
|
|
|
svgDocumentSection.setAttribute(aIWBViewBox, rectToIWBAttr(mViewbox)); |
|
|
|
svgDocumentSection.setAttribute(aWidth, QString("%1").arg(mViewbox.width())); |
|
|
|
svgDocumentSection.setAttribute(aWidth, QString("%1").arg(mViewbox.width())); |
|
|
|
svgDocumentSection.setAttribute(aHeight, QString("%1").arg(mViewbox.height())); |
|
|
|
svgDocumentSection.setAttribute(aHeight, QString("%1").arg(mViewbox.height())); |
|
|
@ -639,30 +643,29 @@ QDomElement UBCFFAdaptor::UBToCFFConverter::parseSvgPageSection(const QDomElemen |
|
|
|
|
|
|
|
|
|
|
|
void UBCFFAdaptor::UBToCFFConverter::writeQDomElementToXML(const QDomNode &node) |
|
|
|
void UBCFFAdaptor::UBToCFFConverter::writeQDomElementToXML(const QDomNode &node) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (!node.isNull()){ |
|
|
|
if (!node.isNull()) |
|
|
|
if (node.isText()) |
|
|
|
if (node.isText()) |
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mIWBContentWriter->writeCharacters(node.nodeValue()); |
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mIWBContentWriter->writeStartElement(node.namespaceURI(), node.toElement().tagName()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < node.toElement().attributes().count(); i++) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mIWBContentWriter->writeCharacters(node.nodeValue()); |
|
|
|
QDomAttr attr = node.toElement().attributes().item(i).toAttr(); |
|
|
|
|
|
|
|
mIWBContentWriter->writeAttribute(attr.name(), attr.value()); |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
QDomNode child = node.firstChild(); |
|
|
|
|
|
|
|
while(!child.isNull()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
mIWBContentWriter->writeStartElement(node.namespaceURI(), node.toElement().tagName()); |
|
|
|
writeQDomElementToXML(child); |
|
|
|
|
|
|
|
child = child.nextSibling(); |
|
|
|
for (int i = 0; i < node.toElement().attributes().count(); i++) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
QDomAttr attr = node.toElement().attributes().item(i).toAttr(); |
|
|
|
|
|
|
|
mIWBContentWriter->writeAttribute(attr.name(), attr.value()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
QDomNode child = node.firstChild(); |
|
|
|
|
|
|
|
while(!child.isNull()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
writeQDomElementToXML(child); |
|
|
|
|
|
|
|
child = child.nextSibling(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mIWBContentWriter->writeEndElement(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
mIWBContentWriter->writeEndElement(); |
|
|
|
|
|
|
|
}
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection() |
|
|
|
bool UBCFFAdaptor::UBToCFFConverter::writeExtendedIwbSection() |
|
|
@ -1025,8 +1028,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCoordinatesFromUBZ(const QDomElement &ub |
|
|
|
|
|
|
|
|
|
|
|
item.setRect(0,0, width, height); |
|
|
|
item.setRect(0,0, width, height); |
|
|
|
item.setTransform(tr); |
|
|
|
item.setTransform(tr); |
|
|
|
|
|
|
|
|
|
|
|
item.setTransformOriginPoint(item.boundingRect().center()); |
|
|
|
|
|
|
|
item.setRotation(-alpha); |
|
|
|
item.setRotation(-alpha); |
|
|
|
QMatrix sceneMatrix = item.sceneMatrix(); |
|
|
|
QMatrix sceneMatrix = item.sceneMatrix(); |
|
|
|
|
|
|
|
|
|
|
@ -1107,6 +1108,9 @@ bool UBCFFAdaptor::UBToCFFConverter::setContentFromUBZ(const QDomElement &ubzEle |
|
|
|
svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng); |
|
|
|
svgElement.setAttribute(aSVGRequiredExtension, svgRequiredExtensionPrefix+fePng); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bRet = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (!bRet) |
|
|
|
if (!bRet) |
|
|
@ -1142,7 +1146,6 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen |
|
|
|
|
|
|
|
|
|
|
|
QDomNode spanNode = htmlPNode.firstChild(); |
|
|
|
QDomNode spanNode = htmlPNode.firstChild(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
while (!spanNode.isNull()) |
|
|
|
while (!spanNode.isNull()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (spanNode.isText()) |
|
|
|
if (spanNode.isText()) |
|
|
@ -1153,7 +1156,10 @@ void UBCFFAdaptor::UBToCFFConverter::setCFFTextFromHTMLTextNode(const QDomElemen |
|
|
|
else |
|
|
|
else |
|
|
|
if (spanNode.isElement()) |
|
|
|
if (spanNode.isElement()) |
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
QDomElement pElementIwb; |
|
|
|
QDomElement spanElement = textDoc.createElementNS(svgIWBNS,svgIWBNSPrefix + ":" + tIWBTspan); |
|
|
|
QDomElement spanElement = textDoc.createElementNS(svgIWBNS,svgIWBNSPrefix + ":" + tIWBTspan); |
|
|
|
|
|
|
|
setCommonAttributesFromUBZ(htmlPNode.toElement(), pElementIwb, spanElement); |
|
|
|
|
|
|
|
|
|
|
|
if (spanNode.hasAttributes()) |
|
|
|
if (spanNode.hasAttributes()) |
|
|
|
{
|
|
|
|
{
|
|
|
|
int attrCount = spanNode.attributes().count(); |
|
|
|
int attrCount = spanNode.attributes().count(); |
|
|
@ -1196,6 +1202,8 @@ QString UBCFFAdaptor::UBToCFFConverter::ubzAttrNameToCFFAttrName(QString cffAttr |
|
|
|
QString sRet = cffAttrName; |
|
|
|
QString sRet = cffAttrName; |
|
|
|
if (QString("color") == cffAttrName) |
|
|
|
if (QString("color") == cffAttrName) |
|
|
|
sRet = QString("fill"); |
|
|
|
sRet = QString("fill"); |
|
|
|
|
|
|
|
if (QString("align") == cffAttrName) |
|
|
|
|
|
|
|
sRet = QString("text-align"); |
|
|
|
|
|
|
|
|
|
|
|
return sRet; |
|
|
|
return sRet; |
|
|
|
} |
|
|
|
} |
|
|
|