summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2007-04-14 23:51:52 +0000
committerAlbert Astals Cid <aacid@kde.org>2007-04-14 23:51:52 +0000
commitb47bcd8f79347522da94c80fe41cfce4c3742c8f (patch)
treef41755fb8faae9ee57d3b025407c2422d674c1d5
parenta09ba6da457ce29090c9b797f5d22dacc97bdf8a (diff)
branchport link and color fixes
-rw-r--r--utils/HtmlFonts.cc8
-rw-r--r--utils/HtmlOutputDev.cc18
-rw-r--r--utils/HtmlOutputDev.h15
3 files changed, 29 insertions, 12 deletions
diff --git a/utils/HtmlFonts.cc b/utils/HtmlFonts.cc
index c77683b0..e267c259 100644
--- a/utils/HtmlFonts.cc
+++ b/utils/HtmlFonts.cc
@@ -33,10 +33,10 @@ extern GBool xml;
GooString* HtmlFont::DefaultFont=new GooString("Times"); // Arial,Helvetica,sans-serif
HtmlFontColor::HtmlFontColor(GfxRGB rgb){
- r=static_cast<int>(255*rgb.r);
- g=static_cast<int>(255*rgb.g);
- b=static_cast<int>(255*rgb.b);
- if (!(Ok(r)&&Ok(b)&&Ok(g))) {printf("Error : Bad color \n");r=0;g=0;b=0;}
+ r=static_cast<int>(rgb.r/65535.0*255.0);
+ g=static_cast<int>(rgb.g/65535.0*255.0);
+ b=static_cast<int>(rgb.b/65535.0*255.0);
+ if (!(Ok(r)&&Ok(b)&&Ok(g))) {printf("Error : Bad color %d %d %d\n", r, g, b);r=0;g=0;b=0;}
}
GooString *HtmlFontColor::convtoX(unsigned int xcol) const{
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index dedd81bf..8febfa9f 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -27,6 +27,7 @@
#include "goo/gmem.h"
#include "Error.h"
#include "GfxState.h"
+#include "Page.h"
#ifdef ENABLE_LIBJPEG
#include "DCTStream.h"
#endif
@@ -1036,6 +1037,12 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state) {
void HtmlOutputDev::endPage() {
+ Links *linksList = catalog->getPage(pageNum)->getLinks(catalog);
+ for (int i = 0; i < linksList->getNumLinks(); ++i)
+ {
+ processLink(linksList->getLink(i));
+ }
+
pages->conv();
pages->coalesce();
pages->dump(page, pageNum);
@@ -1267,23 +1274,20 @@ void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
-void HtmlOutputDev::drawLink(Link* link,Catalog *cat){
-#warning THIS WONT WORK OUTPUTDEV DOES NOT HAS drawLink anymore
-/*
- double _x1,_y1,_x2,_y2,w;
+void HtmlOutputDev::processLink(Link* link){
+ double _x1,_y1,_x2,_y2;
int x1,y1,x2,y2;
link->getRect(&_x1,&_y1,&_x2,&_y2);
- w = link->getBorderStyle()->getWidth();
cvtUserToDev(_x1,_y1,&x1,&y1);
cvtUserToDev(_x2,_y2,&x2,&y2);
- GooString* _dest=getLinkDest(link,cat);
+ GooString* _dest=getLinkDest(link,catalog);
HtmlLink t((double) x1,(double) y2,(double) x2,(double) y1,_dest);
pages->AddLink(t);
- delete _dest;*/
+ delete _dest;
}
GooString* HtmlOutputDev::getLinkDest(Link *link,Catalog* catalog){
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index b1966237..d38bb8a6 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -232,6 +232,18 @@ public:
//----- initialization and control
+ virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+ int rotate, GBool useMediaBox, GBool crop,
+ int sliceX, int sliceY, int sliceW, int sliceH,
+ GBool printing, Catalog * catalogA,
+ GBool (* abortCheckCbk)(void *data) = NULL,
+ void * abortCheckCbkData = NULL)
+ {
+ catalog = catalogA;
+ return gTrue;
+ }
+
+
// Start a page.
virtual void startPage(int pageNum, GfxState *state);
@@ -259,7 +271,6 @@ public:
//new feature
virtual int DevType() {return 1234;}
- virtual void drawLink(Link *link,Catalog *cat);
int getPageWidth() { return maxPageWidth; }
int getPageHeight() { return maxPageHeight; }
@@ -272,6 +283,7 @@ private:
// convert encoding into a HTML standard, or encoding->getCString if not
// recognized
static char* mapEncodingToHtml(GooString* encoding);
+ void processLink(Link *link);
GooString* getLinkDest(Link *link,Catalog *catalog);
void dumpMetaVars(FILE *);
void doFrame(int firstPage);
@@ -294,6 +306,7 @@ private:
GooString *Docname;
GooString *docTitle;
GooList *glMetaVars;
+ Catalog *catalog;
friend class HtmlPage;
};