r18749 by fschmid - Follow up to fix for Bug #11985, apply fix to other vector import calls too.

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 19 11:22:12 UTC 2014


Author: fschmid
Date: Sun Jan 19 11:22:12 2014
New Revision: 18749

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18749
Log:
Follow up to fix for Bug #11985, apply fix to other vector import calls too.

Modified:
    trunk/Scribus/scribus/plugins/import/pub/importpub.cpp

Modified: trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18749&path=/trunk/Scribus/scribus/plugins/import/pub/importpub.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pub/importpub.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pub/importpub.cpp Sun Jan 19 11:22:12 2014
@@ -620,15 +620,42 @@
 							  fmt->loadFile(fileName, LoadSavePlugin::lfUseCurrentPage|LoadSavePlugin::lfInteractive|LoadSavePlugin::lfScripted);
 							  if (m_Doc->m_Selection->count() > 0)
 							  {
-								ite = m_Doc->groupObjectsSelection();
-								QPainterPath ba = Coords.toQPainterPath(true);
-								QRectF baR = ba.boundingRect();
-								ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
-								ite->setWidthHeight(baR.width(), baR.height(), true);
-								FPoint tp2(getMinClipF(&Coords));
-								Coords.translate(-tp2.x(), -tp2.y());
-								ite->PoLine = Coords.copy();
-								finishItem(ite);
+								  ite = m_Doc->groupObjectsSelection();
+								  double rot = 0;
+								  if (m_style["libwpg:rotate"])
+									  rot = m_style["libwpg:rotate"]->getDouble();
+								  QPainterPath ba = Coords.toQPainterPath(true);
+								  QRectF baR = ba.boundingRect();
+								  if (rot != 0)
+								  {
+									  QTransform mm;
+									  mm.translate(baR.x(), baR.y());
+									  mm.translate(baR.width() / 2.0, baR.height() / 2.0);
+									  mm.rotate(rot);
+									  mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
+									  mm.translate(-baR.x(), -baR.y());
+									  ba = mm.map(ba);
+									  baR = ba.boundingRect();
+									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+									  ite->setWidthHeight(baR.width(), baR.height(), true);
+									  Coords.fromQPainterPath(ba, true);
+									  FPoint tp2(getMinClipF(&Coords));
+									  Coords.translate(-tp2.x(), -tp2.y());
+									  ite->PoLine = Coords.copy();
+									  int rm = m_Doc->RotMode();
+									  m_Doc->RotMode(2);
+									  m_Doc->RotateItem(-rot, ite);
+									  m_Doc->RotMode(rm);
+								  }
+								  else
+								  {
+									  ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+									  ite->setWidthHeight(baR.width(), baR.height(), true);
+									  FPoint tp2(getMinClipF(&Coords));
+									  Coords.translate(-tp2.x(), -tp2.y());
+									  ite->PoLine = Coords.copy();
+								  }
+								  finishItem(ite);
 							  }
 						  }
 					  }
@@ -716,11 +743,41 @@
 							if (m_Doc->m_Selection->count() > 0)
 							{
 								ite = m_Doc->groupObjectsSelection();
-								ite->setTextFlowMode(PageItem::TextFlowUsesBoundingBox);
-								Elements->append(ite);
-								ite->setXYPos(baseX + x, baseY + y, true);
-								ite->setWidthHeight(w, h, true);
-								ite->updateClip();
+								double rot = 0;
+								if (m_style["libwpg:rotate"])
+									rot = m_style["libwpg:rotate"]->getDouble();
+								QPainterPath ba = Coords.toQPainterPath(true);
+								QRectF baR = ba.boundingRect();
+								if (rot != 0)
+								{
+									QTransform mm;
+									mm.translate(baR.x(), baR.y());
+									mm.translate(baR.width() / 2.0, baR.height() / 2.0);
+									mm.rotate(rot);
+									mm.translate(-baR.width() / 2.0, -baR.height() / 2.0);
+									mm.translate(-baR.x(), -baR.y());
+									ba = mm.map(ba);
+									baR = ba.boundingRect();
+									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+									ite->setWidthHeight(baR.width(), baR.height(), true);
+									Coords.fromQPainterPath(ba, true);
+									FPoint tp2(getMinClipF(&Coords));
+									Coords.translate(-tp2.x(), -tp2.y());
+									ite->PoLine = Coords.copy();
+									int rm = m_Doc->RotMode();
+									m_Doc->RotMode(2);
+									m_Doc->RotateItem(-rot, ite);
+									m_Doc->RotMode(rm);
+								}
+								else
+								{
+									ite->setXYPos(baseX + baR.x(), baseY + baR.y(), true);
+									ite->setWidthHeight(baR.width(), baR.height(), true);
+									FPoint tp2(getMinClipF(&Coords));
+									Coords.translate(-tp2.x(), -tp2.y());
+									ite->PoLine = Coords.copy();
+								}
+								finishItem(ite);
 							}
 						}
 					}




More information about the scribus-commit mailing list