export ubz is as previous again

preferencesAboutTextFull
Ivan Ilyin 13 years ago
parent 687da649b4
commit a77937cdfd
  1. 221
      src/adaptors/UBSvgSubsetAdaptor.cpp
  2. 1
      src/adaptors/UBSvgSubsetAdaptor.h
  3. 16
      src/domain/UBGraphicsPolygonItem.cpp
  4. 2
      src/domain/UBGraphicsPolygonItem.h

@ -1041,162 +1041,153 @@ bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::persistScene()
openStroke = 0; openStroke = 0;
} }
UBGraphicsGroupContainerItem *groupItem = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item); UBGraphicsPixmapItem *pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*> (item);
if (groupItem && groupItem->isVisible()) if (pixmapItem && pixmapItem->isVisible())
{ {
qDebug() << "came across the group during the parsing"; pixmapItemToLinkedImage(pixmapItem);
continue; continue;
} }
parseCommonItems(item); UBGraphicsSvgItem *svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*> (item);
}
if (openStroke) if (svgItem && svgItem->isVisible())
{ {
mXmlWriter.writeEndElement(); svgItemToLinkedSvg(svgItem);
groupHoldsInfo = false; continue;
openStroke = 0; }
}
mXmlWriter.writeEndDocument(); UBGraphicsVideoItem *videoItem = qgraphicsitem_cast<UBGraphicsVideoItem*> (item);
QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex + 1);
QFile file(fileName);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) if (videoItem && videoItem->isVisible())
{ {
qCritical() << "cannot open " << fileName << " for writing ..."; videoItemToLinkedVideo(videoItem);
return false; continue;
} }
file.write(buffer.data());
file.flush();
file.close();
} UBGraphicsAudioItem* audioItem = qgraphicsitem_cast<UBGraphicsAudioItem*> (item);
else if (audioItem && audioItem->isVisible()) {
{ audioItemToLinkedAudio(audioItem);
qDebug() << "ignoring unmodified page" << mPageIndex + 1; continue;
} }
return true; UBGraphicsAppleWidgetItem *appleWidgetItem = qgraphicsitem_cast<UBGraphicsAppleWidgetItem*> (item);
}
bool UBSvgSubsetAdaptor::UBSvgSubsetWriter::parseCommonItems(QGraphicsItem *item) if (appleWidgetItem && appleWidgetItem->isVisible())
{ {
UBGraphicsPixmapItem *pixmapItem = qgraphicsitem_cast<UBGraphicsPixmapItem*> (item); graphicsAppleWidgetToSvg(appleWidgetItem);
continue;
}
if (pixmapItem && pixmapItem->isVisible()) UBGraphicsW3CWidgetItem *w3cWidgetItem = qgraphicsitem_cast<UBGraphicsW3CWidgetItem*> (item);
{
pixmapItemToLinkedImage(pixmapItem);
return true;
}
UBGraphicsSvgItem *svgItem = qgraphicsitem_cast<UBGraphicsSvgItem*> (item); if (w3cWidgetItem && w3cWidgetItem->isVisible())
{
graphicsW3CWidgetToSvg(w3cWidgetItem);
continue;
}
if (svgItem && svgItem->isVisible()) UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*> (item);
{
svgItemToLinkedSvg(svgItem);
return true;
}
UBGraphicsVideoItem *videoItem = qgraphicsitem_cast<UBGraphicsVideoItem*> (item); if (pdfItem && pdfItem->isVisible())
{
pdfItemToLinkedPDF(pdfItem);
continue;
}
if (videoItem && videoItem->isVisible()) UBGraphicsTextItem *textItem = qgraphicsitem_cast<UBGraphicsTextItem*> (item);
{
videoItemToLinkedVideo(videoItem);
return true;
}
UBGraphicsAudioItem* audioItem = qgraphicsitem_cast<UBGraphicsAudioItem*> (item); if (textItem && textItem->isVisible())
if (audioItem && audioItem->isVisible()) { {
audioItemToLinkedAudio(audioItem); textItemToSvg(textItem);
return true; continue;
} }
UBGraphicsAppleWidgetItem *appleWidgetItem = qgraphicsitem_cast<UBGraphicsAppleWidgetItem*> (item); UBGraphicsCurtainItem *curtainItem = qgraphicsitem_cast<UBGraphicsCurtainItem*> (item);
if (appleWidgetItem && appleWidgetItem->isVisible()) if (curtainItem && curtainItem->isVisible())
{ {
graphicsAppleWidgetToSvg(appleWidgetItem); curtainItemToSvg(curtainItem);
return true; continue;
} }
UBGraphicsW3CWidgetItem *w3cWidgetItem = qgraphicsitem_cast<UBGraphicsW3CWidgetItem*> (item); UBGraphicsRuler *ruler = qgraphicsitem_cast<UBGraphicsRuler*> (item);
if (w3cWidgetItem && w3cWidgetItem->isVisible()) if (ruler && ruler->isVisible())
{ {
graphicsW3CWidgetToSvg(w3cWidgetItem); rulerToSvg(ruler);
return true; continue;
} }
UBGraphicsPDFItem *pdfItem = qgraphicsitem_cast<UBGraphicsPDFItem*> (item); UBGraphicsCache* cache = qgraphicsitem_cast<UBGraphicsCache*>(item);
if(cache && cache->isVisible())
{
cacheToSvg(cache);
continue;
}
if (pdfItem && pdfItem->isVisible()) UBGraphicsCompass *compass = qgraphicsitem_cast<UBGraphicsCompass*> (item);
{
pdfItemToLinkedPDF(pdfItem);
return true;
}
UBGraphicsTextItem *textItem = qgraphicsitem_cast<UBGraphicsTextItem*> (item); if (compass && compass->isVisible())
{
compassToSvg(compass);
continue;
}
if (textItem && textItem->isVisible()) UBGraphicsProtractor *protractor = qgraphicsitem_cast<UBGraphicsProtractor*> (item);
{
textItemToSvg(textItem);
return true;
}
UBGraphicsCurtainItem *curtainItem = qgraphicsitem_cast<UBGraphicsCurtainItem*> (item); if (protractor && protractor->isVisible())
{
protractorToSvg(protractor);
continue;
}
if (curtainItem && curtainItem->isVisible()) UBGraphicsTriangle *triangle = qgraphicsitem_cast<UBGraphicsTriangle*> (item);
{
curtainItemToSvg(curtainItem);
return true;
}
UBGraphicsRuler *ruler = qgraphicsitem_cast<UBGraphicsRuler*> (item); if (triangle && triangle->isVisible())
{
triangleToSvg(triangle);
continue;
}
if (ruler && ruler->isVisible()) UBGraphicsGroupContainerItem *groupItem = qgraphicsitem_cast<UBGraphicsGroupContainerItem*>(item);
{
rulerToSvg(ruler);
return true;
}
UBGraphicsCache* cache = qgraphicsitem_cast<UBGraphicsCache*>(item); if (groupItem && groupItem->isVisible())
if(cache && cache->isVisible()) {
{ qDebug() << "came across the group during the parsing";
cacheToSvg(cache); continue;
return true; }
} }
UBGraphicsCompass *compass = qgraphicsitem_cast<UBGraphicsCompass*> (item); if (openStroke)
{
mXmlWriter.writeEndElement();
groupHoldsInfo = false;
openStroke = 0;
}
if (compass && compass->isVisible()) mXmlWriter.writeEndDocument();
{ QString fileName = mDocumentPath + UBFileSystemUtils::digitFileFormat("/page%1.svg", mPageIndex + 1);
compassToSvg(compass); QFile file(fileName);
return true;
}
UBGraphicsProtractor *protractor = qgraphicsitem_cast<UBGraphicsProtractor*> (item); if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
qCritical() << "cannot open " << fileName << " for writing ...";
return false;
}
file.write(buffer.data());
file.flush();
file.close();
if (protractor && protractor->isVisible())
{
protractorToSvg(protractor);
return true;
} }
else
UBGraphicsTriangle *triangle = qgraphicsitem_cast<UBGraphicsTriangle*> (item);
if (triangle && triangle->isVisible())
{ {
triangleToSvg(triangle); qDebug() << "ignoring unmodified page" << mPageIndex + 1;
return true;
} }
return true; return true;
} }
void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo) void UBSvgSubsetAdaptor::UBSvgSubsetWriter::polygonItemToSvgLine(UBGraphicsPolygonItem* polygonItem, bool groupHoldsInfo)
{ {
mXmlWriter.writeStartElement("line"); mXmlWriter.writeStartElement("line");

@ -156,7 +156,6 @@ class UBSvgSubsetAdaptor
UBSvgSubsetWriter(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex); UBSvgSubsetWriter(UBDocumentProxy* proxy, UBGraphicsScene* pScene, const int pageIndex);
bool persistScene(); bool persistScene();
bool parseCommonItems(QGraphicsItem *item);
virtual ~UBSvgSubsetWriter(){} virtual ~UBSvgSubsetWriter(){}

@ -189,18 +189,18 @@ void UBGraphicsPolygonItem::paint ( QPainter * painter, const QStyleOptionGraphi
QGraphicsPolygonItem::paint(painter, option, widget); QGraphicsPolygonItem::paint(painter, option, widget);
} }
QPainterPath UBGraphicsPolygonItem::shape() const //QPainterPath UBGraphicsPolygonItem::shape() const
{ //{
QPainterPath path; // QPainterPath path;
path.addRect(boundingRect()); // path.addRect(boundingRect());
return path; // return path;
// static QPainterPath shapePath = QGraphicsPolygonItem::shape(); //// static QPainterPath shapePath = QGraphicsPolygonItem::shape();
// return shapePath; //// return shapePath;
} //}
UBGraphicsScene* UBGraphicsPolygonItem::scene() UBGraphicsScene* UBGraphicsPolygonItem::scene()

@ -118,7 +118,7 @@ class UBGraphicsPolygonItem : public QGraphicsPolygonItem, public UBItem
protected: protected:
void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget); void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget);
QPainterPath shape () const; // QPainterPath shape () const;
private: private:

Loading…
Cancel
Save