r18289 by fschmid - Fixed Bug #11541: Wrong image scaling in imported IDML file

scribus-commit scribus-commit at lists.scribus.net
Mon May 27 20:34:35 UTC 2013


Author: fschmid
Date: Mon May 27 20:34:35 2013
New Revision: 18289

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18289
Log:
Fixed Bug #11541: Wrong image scaling in imported IDML file

Modified:
    trunk/Scribus/scribus/plugins/import/idml/importidml.cpp

Modified: trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18289&path=/trunk/Scribus/scribus/plugins/import/idml/importidml.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/idml/importidml.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/idml/importidml.cpp Mon May 27 20:34:35 2013
@@ -1516,6 +1516,7 @@
 	int TextColumnCount = def_TextColumnCount;
 	double TextColumnGutter = def_TextColumnGutter;
 	double TextColumnFixedWidth = def_TextColumnFixedWidth;
+	QString imageFit = "None";
 	PageItem::TextFlowMode textFlow = def_TextFlow;
 	if (itElem.hasAttribute("AppliedObjectStyle"))
 	{
@@ -1793,6 +1794,11 @@
 				GElements.append(el.at(ec));
 			}
 		}
+		else if (ite.tagName() == "FrameFittingOption")
+		{
+			if (ite.hasAttribute("FittingOnEmptyFrame"))
+				imageFit = ite.attribute("FittingOnEmptyFrame");
+		}
 		else if (ite.tagName() == "TransparencySetting")
 		{
 			for(QDomNode itp = ite.firstChild(); !itp.isNull(); itp = itp.nextSibling() )
@@ -2290,12 +2296,21 @@
 							tempFile->close();
 							item->isInlineImage = true;
 							item->isTempFile = true;
-							item->ScaleType   = true;
 							item->AspectRatio = true;
+							if (imageFit == "None")
+								item->ScaleType   = true;
+							else if (imageFit == "ContentToFrame")
+								item->ScaleType   = false;
+							else if (imageFit == "Proportionally")
+							{
+								item->ScaleType   = false;
+								item->AspectRatio = false;
+							}
 							m_Doc->loadPict(fileName, item);
 							item->setImageXYOffset(dxi - grOffset.x(), dyi - grOffset.y());
 							item->setImageXYScale(scXi / item->pixm.imgInfo.xres * 72, scYi / item->pixm.imgInfo.xres * 72);
 							item->setImageRotation(-roti);
+							item->AdjustPictScale();
 						}
 					}
 					delete tempFile;
@@ -2310,12 +2325,22 @@
 						fileName = url.toLocalFile().toLocal8Bit();
 					else
 						fileName = fi.fileName().toLocal8Bit();
-					item->ScaleType   = true;
 					item->AspectRatio = true;
+					if (imageFit == "None")
+						item->ScaleType   = true;
+					else if (imageFit == "ContentToFrame")
+						item->ScaleType   = false;
+					else if (imageFit == "Proportionally")
+					{
+						item->ScaleType   = false;
+						item->AspectRatio = false;
+					}
 					m_Doc->loadPict(QUrl::fromPercentEncoding(fileName), item);
 					item->setImageXYScale(scXi / item->pixm.imgInfo.xres * 72, scYi / item->pixm.imgInfo.xres * 72);
 					item->setImageXYOffset((dxi - grOffset.x()) / item->imageXScale(), (dyi - grOffset.y()) / item->imageYScale());
 					item->setImageRotation(-roti);
+					if (imageFit != "None")
+						item->AdjustPictScale();
 				}
 			}
 			GElements.append(m_Doc->Items->takeAt(z));




More information about the scribus-commit mailing list