[poppler] poppler/qt4/src: poppler-document.cc, 1.17, 1.18 poppler-private.h, 1.7, 1.8 poppler-qt4.h, 1.27, 1.28

Albert Astals Cid aacid at kemper.freedesktop.org
Mon May 1 06:32:33 PDT 2006


Update of /cvs/poppler/poppler/qt4/src
In directory kemper:/tmp/cvs-serv29288/qt4/src

Modified Files:
	poppler-document.cc poppler-private.h poppler-qt4.h 
Log Message:
        * qt4/src/poppler-document.cc:
        * qt4/src/poppler-private.h:
        * qt4/src/poppler-qt4.h: Add the possibility of setting the paper
        color

One step more to make oKular fully use the qt4 bindings



Index: poppler-document.cc
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-document.cc,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- poppler-document.cc	2 Apr 2006 18:07:59 -0000	1.17
+++ poppler-document.cc	1 May 2006 13:32:31 -0000	1.18
@@ -420,6 +420,16 @@
             return false;
         }
     }
+    
+    void Document::setPaperColor(const QColor &color)
+    {
+        m_doc->setPaperColor(color);
+    }
+    
+    QColor Document::paperColor() const
+    {
+    	return m_doc->paperColor;
+    }
 
     QDateTime convertDate( char *dateString )
     {

Index: poppler-private.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-private.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- poppler-private.h	23 Apr 2006 15:50:52 -0000	1.7
+++ poppler-private.h	1 May 2006 13:32:31 -0000	1.8
@@ -66,6 +66,7 @@
 	DocumentData(GooString *filePath, GooString *ownerPassword, GooString *userPassword) :
 	    doc(filePath, ownerPassword, userPassword), m_splashOutputDev(0)
 	    {
+		paperColor = Qt::white;
 		// It might be more appropriate to delete these in PDFDoc
 		delete ownerPassword;
 		delete userPassword;
@@ -82,11 +83,11 @@
 	{
 		if (!m_splashOutputDev)
 		{
-			SplashColor white;
-			white[0] = 255;
-			white[1] = 255;
-			white[2] = 255;
-			m_splashOutputDev = new SplashOutputDev(splashModeRGB8, 4, gFalse, white);
+			SplashColor bgColor;
+			bgColor[0] = paperColor.red();
+			bgColor[1] = paperColor.green();
+			bgColor[2] = paperColor.blue();
+			m_splashOutputDev = new SplashOutputDev(splashModeRGB8, 4, gFalse, bgColor);
 			m_splashOutputDev->startDoc(doc.getXRef());
 		}
 		return m_splashOutputDev;
@@ -146,12 +147,23 @@
 				addTocChildren( docSyn, &item, children );
 		}
 	}
+	
+	void setPaperColor(const QColor &color)
+	{
+		if (color != paperColor)
+		{
+			paperColor = color;
+			delete m_splashOutputDev;
+			m_splashOutputDev = NULL;
+		}
+	}
 
 	class PDFDoc doc;
 	bool locked;
 	FontInfoScanner *m_fontInfoScanner;
 	SplashOutputDev *m_splashOutputDev;
 	QList<EmbeddedFile*> m_embeddedFiles;
+	QColor paperColor;
     };
 
     class FontInfoData

Index: poppler-qt4.h
===================================================================
RCS file: /cvs/poppler/poppler/qt4/src/poppler-qt4.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- poppler-qt4.h	2 Apr 2006 18:07:59 -0000	1.27
+++ poppler-qt4.h	1 May 2006 13:32:31 -0000	1.28
@@ -685,6 +685,12 @@
 	LinkDestination *linkDestination( const QString &name );
 	
 	bool print(const QString &fileName, const QList<int> pageList, double hDPI, double vDPI, int rotate);
+	
+	/**
+	  Sets the paper color, if not set it is white by default.
+	 */
+	void setPaperColor(const QColor &color);
+	QColor paperColor() const;
 
 	~Document();
   



More information about the poppler mailing list