r19212 by jghali - #12344: setting for columns and text flow around frame ignored when generating a pdf

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 12 11:47:22 UTC 2014


Author: jghali
Date: Thu Jun 12 11:47:22 2014
New Revision: 19212

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19212
Log:
#12344: setting for columns and text flow around frame ignored when generating a pdf

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pdflib_core.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19212&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Jun 12 11:47:22 2014
@@ -2297,17 +2297,21 @@
 	p->restore();
 }
 
-QImage PageItem::DrawObj_toImage(double maxSize)
+QImage PageItem::DrawObj_toImage(double maxSize, int options)
 {
 	bool isEmbedded_Old = isEmbedded;
+	double rotation_Old = m_rotation;
 	double minx =  std::numeric_limits<double>::max();
 	double miny =  std::numeric_limits<double>::max();
 	double maxx = -std::numeric_limits<double>::max();
 	double maxy = -std::numeric_limits<double>::max();
 	double x1, x2, y1, y2;
+	if (options & NoRotation)
+		m_rotation = 0.0;
 	getVisualBoundingRect(&x1, &y1, &x2, &y2);
+	m_rotation = rotation_Old;
 	double maxAdd = 0;
-	if (hasSoftShadow())
+	if (hasSoftShadow() && !(options & NoSoftShadow))
 		maxAdd = qMax(fabs(softShadowXOffset()), fabs(softShadowYOffset())) + softShadowBlurRadius();
 	minx = qMin(minx, x1) - maxAdd;
 	miny = qMin(miny, y1) - maxAdd;
@@ -2326,15 +2330,21 @@
 	painter->setZoomFactor(sc);
 	painter->save();
 	painter->translate(igXpos, igYpos);
+	if (options & NoRotation)
+		painter->rotate(-m_rotation);
 	isEmbedded = true;
 	invalid = true;
 	DrawObj(painter, QRectF());
-	isEmbedded = false;
 	painter->restore();
 	painter->end();
 	delete painter;
 	m_Doc->guidesPrefs().framesShown = savedFlag;
 	isEmbedded = isEmbedded_Old;
+	if (!isEmbedded && (asTextFrame() || asPathText()))
+	{
+		invalid = true;
+		layout();
+	}
 	return retImg;
 }
 
@@ -7504,7 +7514,6 @@
 		}
 		m_Doc->regionsChanged()->update(QRectF());
 	}
-
 }
 
 void PageItem::restoreImageEffects(UndoState *state, bool isUndo)

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19212&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Thu Jun 12 11:47:22 2014
@@ -155,6 +155,14 @@
 
 public:	// Start enumerator definitions
 
+	/** @brief Draw options for DrawObj_toImage()
+	 * 
+	 */
+	enum DrawOption {
+		NoRotation = 1, // Draw as if item was not rotated
+		NoSoftShadow = 2
+	};
+
 	/** @brief Item Type
 	 *
 	 * Soon, item type will probably go away in favour of using
@@ -261,7 +269,7 @@
 	virtual void DrawObj_Post(ScPainter *p);
 	virtual void DrawObj_Decoration(ScPainter *p);
 	virtual void DrawObj_Item(ScPainter *p, QRectF e) = 0;
-	QImage DrawObj_toImage(double maxSize);
+	QImage DrawObj_toImage(double maxSize, int options = 0);
 	QImage DrawObj_toImage(QList<PageItem*> &emG, double scaling);
 	void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
 	void DrawStrokePattern(ScPainter *p, QPainterPath &path);

Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19212&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Thu Jun 12 11:47:22 2014
@@ -3515,14 +3515,11 @@
 	tmp += "1 0 0 1 0 " + FToStr(-(ite->height() + ite->visualLineWidth()))+" cm\n";
 	tmp += FToStr(ite->width() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius()) + " 0 0 " + FToStr(ite->height() + ite->visualLineWidth() + 2 * ite->softShadowBlurRadius())+" 0 0 cm\n" ;
 
-	double savRot = ite->rotation();
-	ite->setRotation(0, true);
 	double maxSize = qMax(ite->visualWidth(), ite->visualHeight());
 	maxSize = qMin(3000.0, maxSize * (softShadowDPI / 72.0));
 	bool savedShadow = ite->hasSoftShadow();
 	ite->setHasSoftShadow(false);
-	QImage imgC = ite->DrawObj_toImage(maxSize);
-	ite->setRotation(savRot, true);
+	QImage imgC = ite->DrawObj_toImage(maxSize, PageItem::NoRotation);
 	ite->setHasSoftShadow(savedShadow);
 
 	imgC = imgC.copy(-pixelRadius,-pixelRadius,imgC.width()+2*pixelRadius,imgC.height()+2*pixelRadius); // Add border




More information about the scribus-commit mailing list