summaryrefslogtreecommitdiffstats
path: root/kpdf/core/generator_pdf
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:03:33 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-19 19:03:33 +0000
commite69e8b1d09fb579316595b4e6a850e717358a8b1 (patch)
treea24fc20865f65772f530d16177520190594ffdd2 /kpdf/core/generator_pdf
parenteecec9afb81fdebb0f22e9da22635874c403f854 (diff)
downloadtdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.tar.gz
tdegraphics-e69e8b1d09fb579316595b4e6a850e717358a8b1.zip
TQt4 port kdegraphics
This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdegraphics@1237557 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpdf/core/generator_pdf')
-rw-r--r--kpdf/core/generator_pdf/generator_pdf.cpp58
-rw-r--r--kpdf/core/generator_pdf/generator_pdf.h4
-rw-r--r--kpdf/core/generator_pdf/gp_outputdev.cpp8
-rw-r--r--kpdf/core/generator_pdf/gp_outputdev.h4
4 files changed, 37 insertions, 37 deletions
diff --git a/kpdf/core/generator_pdf/generator_pdf.cpp b/kpdf/core/generator_pdf/generator_pdf.cpp
index 9540d2fd..8ad34900 100644
--- a/kpdf/core/generator_pdf/generator_pdf.cpp
+++ b/kpdf/core/generator_pdf/generator_pdf.cpp
@@ -57,7 +57,7 @@
* internal: thread race prevention is done via the 'docLock' mutex. the
* mutex is needed only because we have the asyncronous thread; else
* the operations are all within the 'gui' thread, scheduled by the
- * Qt scheduler and no mutex is needed.
+ * TQt scheduler and no mutex is needed.
* external: dangerous operations are all locked via mutex internally, and the
* only needed external thing is the 'canGeneratePixmap' method
* that tells if the generator is free (since we don't want an
@@ -152,7 +152,7 @@ bool PDFGenerator::loadDocument( const TQString & filePath, TQValueVector<KPDFPa
}
// 2. reopen the document using the password
- GString * pwd2 = new GString( TQString::fromLocal8Bit(password.data()).latin1() );
+ GString * pwd2 = new GString( TQString(TQString::fromLocal8Bit(password.data())).latin1() );
delete pdfdoc;
pdfdoc = new PDFDoc( new GString( TQFile::encodeName( filePath ) ), pwd2, pwd2 );
delete pwd2;
@@ -209,7 +209,7 @@ const DocumentInfo * PDFGenerator::generateDocumentInfo()
if ( pdfdoc )
{
docInfo.set( "format", i18n( "PDF v. <version>", "PDF v. %1" )
- .arg( TQString::number( pdfdoc->getPDFVersion() ) ), i18n( "Format" ) );
+ .tqarg( TQString::number( pdfdoc->getPDFVersion() ) ), i18n( "Format" ) );
docInfo.set( "encryption", pdfdoc->isEncrypted() ? i18n( "Encrypted" ) : i18n( "Unencrypted" ),
i18n("Security") );
docInfo.set( "optimization", pdfdoc->isLinearized() ? i18n( "Yes" ) : i18n( "No" ),
@@ -423,18 +423,18 @@ bool PDFGenerator::print( KPrinter& printer )
marginBottom = (int)printer.option("kde-margin-bottom").toDouble();
bool forceRasterize = printer.option("kde-kpdf-forceRaster").toInt();
- if (ps.find(TQRegExp("w\\d+h\\d+")) == 0)
+ if (ps.tqfind(TQRegExp("w\\d+h\\d+")) == 0)
{
- // size not supported by Qt, CUPS gives us the size as wWIDTHhHEIGHT, at least on the printers i tester
+ // size not supported by TQt, CUPS gives us the size as wWIDTHhHEIGHT, at least on the printers i tester
// remove the w
ps = ps.mid(1);
- int hPos = ps.find("h");
+ int hPos = ps.tqfind("h");
paperWidth = ps.left(hPos).toInt();
paperHeight = ps.mid(hPos+1).toInt();
}
else
{
- // size is supported by Qt, we get either the pageSize name or nothing because the CUPS driver
+ // size is supported by TQt, we get either the pageSize name or nothing because the CUPS driver
// does not do any translation, then use KPrinter::pageSize to get the page size
KPrinter::PageSize qtPageSize;
if (!ps.isEmpty()) qtPageSize = pageNameToPageSize(ps);
@@ -449,7 +449,7 @@ bool PDFGenerator::print( KPrinter& printer )
paperHeight = metrics.height();
}
- KTempFile tf( TQString::null, ".ps" );
+ KTempFile tf( TQString(), ".ps" );
globalParams->setPSPaperWidth(paperWidth);
globalParams->setPSPaperHeight(paperHeight);
TQString pstitle = getDocumentInfo("Title", true);
@@ -457,7 +457,7 @@ bool PDFGenerator::print( KPrinter& printer )
{
pstitle = m_document->currentDocument().fileName( false );
}
- // this looks non-unicode-safe and it is. anything other than ASCII is not specified
+ // this looks non-tqunicode-safe and it is. anything other than ASCII is not specified
// and some printers actually stop printing when they encounter non-ASCII characters in the
// Postscript %%Title tag
TQCString pstitle8Bit = pstitle.latin1();
@@ -524,18 +524,18 @@ bool PDFGenerator::print( KPrinter& printer )
}
}
-static GString *QStringToGString(const TQString &s) {
+static GString *TQStringToGString(const TQString &s) {
int len = s.length();
char *cstring = (char *)gmallocn(s.length(), sizeof(char));
for (int i = 0; i < len; ++i)
- cstring[i] = s.at(i).unicode();
+ cstring[i] = s.tqat(i).tqunicode();
return new GString(cstring, len);
}
-static TQString unicodeToQString(Unicode* u, int len) {
+static TQString tqunicodeToTQString(Unicode* u, int len) {
TQString ret;
ret.setLength(len);
- TQChar* qch = (TQChar*) ret.unicode();
+ TQChar* qch = (TQChar*) ret.tqunicode();
for (;len;--len)
*qch++ = (TQChar) *u++;
return ret;
@@ -568,7 +568,7 @@ static TQString UnicodeParsedString(GString *s1) {
u = s1->getChar(i) & 0xff;
++i;
}
- result += unicodeToQString( &u, 1 );
+ result += tqunicodeToTQString( &u, 1 );
}
return result;
}
@@ -586,7 +586,7 @@ TQString PDFGenerator::getMetaData( const TQString & key, const TQString & optio
// asking for the page related to a 'named link destination'. the
// option is the link name. @see addSynopsisChildren.
DocumentViewport viewport;
- GString * namedDest = QStringToGString(option);
+ GString * namedDest = TQStringToGString(option);
docLock.lock();
LinkDest * destination = pdfdoc->findDest( namedDest );
if ( destination )
@@ -610,7 +610,7 @@ bool PDFGenerator::reparseConfig()
{
// load paper color from Settings or use the white default color
TQColor color = ( (KpdfSettings::renderMode() == KpdfSettings::EnumRenderMode::Paper ) &&
- KpdfSettings::changeColors() ) ? KpdfSettings::paperColor() : Qt::white;
+ KpdfSettings::changeColors() ) ? KpdfSettings::paperColor() : TQt::white;
// if paper color is changed we have to rebuild every visible pixmap in addition
// to the outputDevice. it's the 'heaviest' case, other effect are just recoloring
// over the page rendered on 'standard' white background.
@@ -789,11 +789,11 @@ TQString PDFGenerator::getDocumentInfo( const TQString & data, bool canReturnNul
// [Albert] Code adapted from pdfinfo.cc on xpdf
Object info;
if ( !pdfdoc )
- return canReturnNull ? TQString::null : i18n( "Unknown" );
+ return canReturnNull ? TQString() : i18n( "Unknown" );
pdfdoc->getDocInfo( &info );
if ( !info.isDict() )
- return canReturnNull ? TQString::null : i18n( "Unknown" );
+ return canReturnNull ? TQString() : i18n( "Unknown" );
Object obj;
Dict *infoDict = info.getDict();
@@ -807,7 +807,7 @@ TQString PDFGenerator::getDocumentInfo( const TQString & data, bool canReturnNul
}
obj.free();
info.free();
- return canReturnNull ? TQString::null : i18n( "Unknown" );
+ return canReturnNull ? TQString() : i18n( "Unknown" );
}
TQString PDFGenerator::getDocumentDate( const TQString & data ) const
@@ -856,7 +856,7 @@ TQString PDFGenerator::getDocumentDate( const TQString & data ) const
return result;
}
-void PDFGenerator::addSynopsisChildren( TQDomNode * parent, GList * items )
+void PDFGenerator::addSynopsisChildren( TQDomNode * tqparent, GList * items )
{
int numItems = items->getLength();
for ( int i = 0; i < numItems; ++i )
@@ -868,11 +868,11 @@ void PDFGenerator::addSynopsisChildren( TQDomNode * parent, GList * items )
TQString name;
Unicode * uniChar = outlineItem->getTitle();
int titleLength = outlineItem->getTitleLength();
- name = unicodeToQString(uniChar, titleLength);
+ name = tqunicodeToTQString(uniChar, titleLength);
if ( name.isEmpty() )
continue;
TQDomElement item = docSyn.createElement( name );
- parent->appendChild( item );
+ tqparent->appendChild( item );
// 2. find the page the link refers to
LinkAction * a = outlineItem->getAction();
@@ -888,7 +888,7 @@ void PDFGenerator::addSynopsisChildren( TQDomNode * parent, GList * items )
// so better storing the reference and provide the viewport as metadata
// on demand
GString *s = g->getNamedDest();
- TQChar *charArray = new QChar[s->getLength()];
+ TQChar *charArray = new TQChar[s->getLength()];
for (int i = 0; i < s->getLength(); ++i) charArray[i] = TQChar(s->getCString()[i]);
TQString option(charArray, s->getLength());
item.setAttribute( "ViewportName", option );
@@ -909,11 +909,11 @@ void PDFGenerator::addSynopsisChildren( TQDomNode * parent, GList * items )
item.setAttribute( "Open", TQVariant( (bool)outlineItem->isOpen() ).toString() );
- // 3. recursively descend over children
+ // 3. recursively descend over tqchildren
outlineItem->open();
- GList * children = outlineItem->getKids();
- if ( children )
- addSynopsisChildren( &item, children );
+ GList * tqchildren = outlineItem->getKids();
+ if ( tqchildren )
+ addSynopsisChildren( &item, tqchildren );
}
}
@@ -1017,10 +1017,10 @@ void PDFGenerator::addTransition( int pageNumber, KPDFPage * page )
switch ( pdfTransition->getAlignment() ) {
case PageTransition::Horizontal:
- transition->setAlignment( KPDFPageTransition::Horizontal );
+ transition->tqsetAlignment( KPDFPageTransition::Horizontal );
break;
case PageTransition::Vertical:
- transition->setAlignment( KPDFPageTransition::Vertical );
+ transition->tqsetAlignment( KPDFPageTransition::Vertical );
break;
}
diff --git a/kpdf/core/generator_pdf/generator_pdf.h b/kpdf/core/generator_pdf/generator_pdf.h
index 662c19fd..b7d2deb2 100644
--- a/kpdf/core/generator_pdf/generator_pdf.h
+++ b/kpdf/core/generator_pdf/generator_pdf.h
@@ -95,7 +95,7 @@ class PDFGenerator : public Generator
TQString getDocumentInfo( const TQString & data, bool canReturnNull = false ) const;
TQString getDocumentDate( const TQString & data ) const;
// private function for creating the document synopsis hieracy
- void addSynopsisChildren( TQDomNode * parent, GList * items );
+ void addSynopsisChildren( TQDomNode * tqparent, GList * items );
// private function for creating the transition information
void addTransition( int pageNumber, KPDFPage * page );
// (async related) receive data from the generator thread
@@ -124,7 +124,7 @@ class PDFGenerator : public Generator
* @short A thread that builds contents for PDFGenerator in the background.
*
*/
-class PDFPixmapGeneratorThread : public QThread
+class PDFPixmapGeneratorThread : public TQThread
{
public:
PDFPixmapGeneratorThread( PDFGenerator * generator );
diff --git a/kpdf/core/generator_pdf/gp_outputdev.cpp b/kpdf/core/generator_pdf/gp_outputdev.cpp
index df3fd85b..b6c40520 100644
--- a/kpdf/core/generator_pdf/gp_outputdev.cpp
+++ b/kpdf/core/generator_pdf/gp_outputdev.cpp
@@ -109,7 +109,7 @@ void KPDFOutputDev::endPage()
for (int j = 0; j < bh; j++)
{
getBitmap()->getPixel(i, j, pixel);
- img->setPixel( i, j, qRgb( pixel[0], pixel[1], pixel[2] ) );
+ img->setPixel( i, j, tqRgb( pixel[0], pixel[1], pixel[2] ) );
}
}
delete [] pixel;
@@ -172,7 +172,7 @@ void KPDFOutputDev::processLink( Link * link, Catalog * catalog )
}
void KPDFOutputDev::drawImage( GfxState *state, Object *ref, Stream *str,
- int _width, int _height, GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg )
+ int _width, int _height, GfxImageColorMap *colorMap, int *tqmaskColors, GBool inlineImg )
{
if ( m_generateImages )
{
@@ -207,7 +207,7 @@ void KPDFOutputDev::drawImage( GfxState *state, Object *ref, Stream *str,
m_rects.push_back( rect );
}
}
- SplashOutputDev::drawImage( state, ref, str, _width, _height, colorMap, maskColors, inlineImg );
+ SplashOutputDev::drawImage( state, ref, str, _width, _height, colorMap, tqmaskColors, inlineImg );
}
//END - OutputDev hooked calls
@@ -246,7 +246,7 @@ KPDFLink * KPDFOutputDev::generateLink( LinkAction * a )
{
LinkGoTo * g = (LinkGoTo *) a;
// ceate link: no ext file, namedDest, object pointer
- link = new KPDFLinkGoto( TQString::null, decodeViewport( g->getNamedDest(), g->getDest() ) );
+ link = new KPDFLinkGoto( TQString(), decodeViewport( g->getNamedDest(), g->getDest() ) );
}
break;
diff --git a/kpdf/core/generator_pdf/gp_outputdev.h b/kpdf/core/generator_pdf/gp_outputdev.h
index 7788b1db..a4d33b04 100644
--- a/kpdf/core/generator_pdf/gp_outputdev.h
+++ b/kpdf/core/generator_pdf/gp_outputdev.h
@@ -32,7 +32,7 @@ class DocumentViewport;
* @short A SplashOutputDev renderer that grabs text and links.
*
* This output device:
- * - renders the page using SplashOutputDev (its parent)
+ * - renders the page using SplashOutputDev (its tqparent)
* - harvests text into a textPage (for searching text)
* - harvests links and collects them
* - collects images and collects them
@@ -63,7 +63,7 @@ class KPDFOutputDev : public SplashOutputDev
virtual void processLink(Link *link, Catalog *catalog);
//----- image drawing
virtual void drawImage(GfxState *state, Object *ref, Stream *str, int width, int height,
- GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg);
+ GfxImageColorMap *colorMap, int *tqmaskColors, GBool inlineImg);
private:
// delete all interal objects and data