|
|
@ -32,6 +32,7 @@ |
|
|
|
#include "domain/UBGraphicsTextItem.h" |
|
|
|
#include "domain/UBGraphicsTextItem.h" |
|
|
|
#include "domain/UBGraphicsTextItemDelegate.h" |
|
|
|
#include "domain/UBGraphicsTextItemDelegate.h" |
|
|
|
#include "domain/UBGraphicsWidgetItem.h" |
|
|
|
#include "domain/UBGraphicsWidgetItem.h" |
|
|
|
|
|
|
|
#include "domain/UBGraphicsGroupContainerItem.h" |
|
|
|
|
|
|
|
|
|
|
|
#include "frameworks/UBFileSystemUtils.h" |
|
|
|
#include "frameworks/UBFileSystemUtils.h" |
|
|
|
|
|
|
|
|
|
|
@ -128,8 +129,9 @@ bool UBCFFSubsetAdaptor::ConvertCFFFileToUbz(QString &cffSourceFile, UBDocumentP |
|
|
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
UBCFFSubsetAdaptor::UBCFFSubsetReader::UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content): |
|
|
|
UBCFFSubsetAdaptor::UBCFFSubsetReader::UBCFFSubsetReader(UBDocumentProxy *proxy, QFile *content) |
|
|
|
mProxy(proxy) |
|
|
|
: mProxy(proxy) |
|
|
|
|
|
|
|
, mGSectionContainer(NULL) |
|
|
|
{ |
|
|
|
{ |
|
|
|
int errorLine, errorColumn; |
|
|
|
int errorLine, errorColumn; |
|
|
|
QString errorStr; |
|
|
|
QString errorStr; |
|
|
@ -168,6 +170,8 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parse() |
|
|
|
|
|
|
|
|
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &element) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
mGSectionContainer = new UBGraphicsGroupContainerItem(); |
|
|
|
|
|
|
|
|
|
|
|
QDomElement currentSvgElement = element.firstChildElement(); |
|
|
|
QDomElement currentSvgElement = element.firstChildElement(); |
|
|
|
while (!currentSvgElement.isNull()) { |
|
|
|
while (!currentSvgElement.isNull()) { |
|
|
|
if (!parseSvgElement(currentSvgElement)) |
|
|
|
if (!parseSvgElement(currentSvgElement)) |
|
|
@ -176,6 +180,16 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseGSection(const QDomElement &ele |
|
|
|
currentSvgElement = currentSvgElement.nextSiblingElement(); |
|
|
|
currentSvgElement = currentSvgElement.nextSiblingElement(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer->childItems().count()) |
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
mCurrentScene->addGroup(mGSectionContainer); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
delete mGSectionContainer; |
|
|
|
|
|
|
|
mGSectionContainer = NULL; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSwitchSection(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSwitchSection(const QDomElement &element) |
|
|
@ -247,6 +261,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgRect(const QDomElement &elem |
|
|
|
repositionSvgItem(svgItem, width, height, x1, y1, transform); |
|
|
|
repositionSvgItem(svgItem, width, height, x1, y1, transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
delete generator; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -293,6 +312,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgEllipse(const QDomElement &e |
|
|
|
repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform); |
|
|
|
repositionSvgItem(svgItem, rx * 2, ry * 2, cx - 2*rx, cy+ry, transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
delete generator; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -375,6 +399,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolygon(const QDomElement &e |
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); |
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 - strokeWidth/2 + transform.m31(), y1 + strokeWidth/2 + transform.m32(), transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
delete generator; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -454,6 +483,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgPolyline(const QDomElement & |
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform); |
|
|
|
repositionSvgItem(svgItem, width +strokeWidth, height + strokeWidth, x1 + transform.m31() - strokeWidth/2, y1 + transform.m32() + strokeWidth/2, transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
delete generator; |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -593,6 +627,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgText(const QDomElement &elem |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
delete generator; |
|
|
|
delete generator; |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
@ -712,6 +751,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgTextarea(const QDomElement & |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(svgItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
hashSceneItem(element, svgItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(svgItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &element) |
|
|
@ -749,6 +793,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgImage(const QDomElement &ele |
|
|
|
repositionSvgItem(pixItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(pixItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, pixItem); |
|
|
|
hashSceneItem(element, pixItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(pixItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &element) |
|
|
@ -791,6 +840,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgFlash(const QDomElement &ele |
|
|
|
repositionSvgItem(flashItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(flashItem, width, height, x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, flashItem); |
|
|
|
hashSceneItem(element, flashItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(flashItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -829,6 +883,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgAudio(const QDomElement &ele |
|
|
|
repositionSvgItem(audioItem, audioItem->boundingRect().width(), audioItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(audioItem, audioItem->boundingRect().width(), audioItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, audioItem); |
|
|
|
hashSceneItem(element, audioItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(audioItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &element) |
|
|
|
bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &element) |
|
|
@ -867,6 +926,11 @@ bool UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgVideo(const QDomElement &ele |
|
|
|
repositionSvgItem(videoItem, videoItem->boundingRect().width(), videoItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); |
|
|
|
repositionSvgItem(videoItem, videoItem->boundingRect().width(), videoItem->boundingRect().height(), x + transform.m31(), y + transform.m32(), transform); |
|
|
|
hashSceneItem(element, videoItem); |
|
|
|
hashSceneItem(element, videoItem); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (mGSectionContainer) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
addItemToGSection(videoItem); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -877,6 +941,11 @@ void UBCFFSubsetAdaptor::UBCFFSubsetReader::parseSvgSectionAttr(const QDomElemen |
|
|
|
svgSection.attribute(aHeight).toInt()); |
|
|
|
svgSection.attribute(aHeight).toInt()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void UBCFFSubsetAdaptor::UBCFFSubsetReader::addItemToGSection(QGraphicsItem *item) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
mGSectionContainer->addToGroup(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(const QDomElement &element, UBGraphicsItem *item) |
|
|
|
void UBCFFSubsetAdaptor::UBCFFSubsetReader::hashSceneItem(const QDomElement &element, UBGraphicsItem *item) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// adding element pointer to hash to refer if needed
|
|
|
|
// adding element pointer to hash to refer if needed
|
|
|
|