summaryrefslogtreecommitdiffstats
path: root/kpresenter/KPrBackground.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kpresenter/KPrBackground.cpp
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz
koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kpresenter/KPrBackground.cpp')
-rw-r--r--kpresenter/KPrBackground.cpp134
1 files changed, 67 insertions, 67 deletions
diff --git a/kpresenter/KPrBackground.cpp b/kpresenter/KPrBackground.cpp
index e8e7586d..e2d08fa2 100644
--- a/kpresenter/KPrBackground.cpp
+++ b/kpresenter/KPrBackground.cpp
@@ -28,9 +28,9 @@
#include "KPrUtils.h"
#include "KPrBrush.h"
-#include <qpainter.h>
-#include <qpicture.h>
-#include <qfileinfo.h>
+#include <tqpainter.h>
+#include <tqpicture.h>
+#include <tqfileinfo.h>
#include <KoRichText.h>
#include <KoTextObject.h>
@@ -49,8 +49,8 @@ KPrBackGround::KPrBackGround( KPrPage *_page )
{
backType = BT_COLOR;
backView = BV_CENTER;
- backColor1 = Qt::white;
- backColor2 = Qt::white;
+ backColor1 = TQt::white;
+ backColor2 = TQt::white;
bcType = BCT_PLAIN;
unbalanced = false;
xfactor = 100;
@@ -74,18 +74,18 @@ void KPrBackGround::setBackPicture ( const KoPictureKey& key )
backPicture = pictureCollection()->findOrLoad(key.filename(), key.lastModified() );
}
-void KPrBackGround::drawBackground( QPainter *_painter, const KoTextZoomHandler* zoomHandler,
- const QRect& _crect, bool _drawBorders )
+void KPrBackGround::drawBackground( TQPainter *_painter, const KoTextZoomHandler* zoomHandler,
+ const TQRect& _crect, bool _drawBorders )
{
- QRect pageRect = zoomHandler->zoomRect( m_page->getPageRect() );
- QRect crect = pageRect.intersect( _crect );
+ TQRect pageRect = zoomHandler->zoomRect( m_page->getPageRect() );
+ TQRect crect = pageRect.intersect( _crect );
if ( crect.isEmpty() )
return;
- QSize ext = pageRect.size();
+ TQSize ext = pageRect.size();
drawBackground( _painter, ext, crect, _drawBorders );
}
-void KPrBackGround::drawBackground( QPainter *_painter, const QSize& ext, const QRect& crect, bool _drawBorders )
+void KPrBackGround::drawBackground( TQPainter *_painter, const TQSize& ext, const TQRect& crect, bool _drawBorders )
{
if ( m_page->displayBackground() )
{
@@ -123,11 +123,11 @@ void KPrBackGround::reload()
}
-QDomElement KPrBackGround::save( QDomDocument &doc )
+TQDomElement KPrBackGround::save( TQDomDocument &doc )
{
- QString tag = m_page->masterPage() == 0 ? "MASTERPAGE" : "PAGE";
- QDomElement page=doc.createElement( tag );
- QDomElement element;
+ TQString tag = m_page->masterPage() == 0 ? "MASTERPAGE" : "PAGE";
+ TQDomElement page=doc.createElement( tag );
+ TQDomElement element;
element=doc.createElement("BACKMASTER");
element.setAttribute( "useMasterBackground", static_cast<int>(m_page->useMasterBackground() ) );
@@ -149,13 +149,13 @@ QDomElement KPrBackGround::save( QDomDocument &doc )
page.appendChild(element);
}
- if (backColor1!=Qt::white) {
+ if (backColor1!=TQt::white) {
element=doc.createElement("BACKCOLOR1");
element.setAttribute("color", backColor1.name());
page.appendChild(element);
}
- if (backColor2!=Qt::white) {
+ if (backColor2!=TQt::white) {
element=doc.createElement("BACKCOLOR2");
element.setAttribute("color", backColor2.name());
page.appendChild(element);
@@ -194,7 +194,7 @@ void KPrBackGround::saveOasisBackgroundPageStyle( KoGenStyle& stylepageauto, KoG
{
case BT_COLOR:
{
- QBrush qbrush( backColor1 );
+ TQBrush qbrush( backColor1 );
KPrBrush brush( qbrush, backColor1, backColor2, bcType,
bcType == BCT_PLAIN ? FT_BRUSH : FT_GRADIENT,
unbalanced, xfactor, yfactor );
@@ -206,7 +206,7 @@ void KPrBackGround::saveOasisBackgroundPageStyle( KoGenStyle& stylepageauto, KoG
{
stylepageauto.addProperty("draw:fill", "bitmap" );
stylepageauto.addProperty("draw:fill-image-name", saveOasisPictureStyle( mainStyles ) );
- QString repeat = "repeat";
+ TQString repeat = "repeat";
switch ( backView )
{
case BV_ZOOM:
@@ -225,7 +225,7 @@ void KPrBackGround::saveOasisBackgroundPageStyle( KoGenStyle& stylepageauto, KoG
}
-QString KPrBackGround::saveOasisPictureStyle( KoGenStyles& mainStyles )
+TQString KPrBackGround::saveOasisPictureStyle( KoGenStyles& mainStyles )
{
//<draw:fill-image draw:name="Pattern" xlink:href="Pictures/100000000000005E0000005E43C87AF2.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
KoGenStyle pictureStyle( KPrDocument::STYLE_PICTURE /*no family name*/ );
@@ -244,7 +244,7 @@ void KPrBackGround::loadOasis(KoOasisContext & context )
styleStack.setTypeProperties( "drawing-page" );
if ( styleStack.hasAttributeNS( KoXmlNS::draw, "fill" ) )
{
- const QString fill = styleStack.attributeNS( KoXmlNS::draw, "fill" );
+ const TQString fill = styleStack.attributeNS( KoXmlNS::draw, "fill" );
kdDebug(33001) <<"fill page type :" << fill << endl;
if ( fill == "solid" || fill == "gradient" )
{
@@ -268,21 +268,21 @@ void KPrBackGround::loadOasis(KoOasisContext & context )
}
else if ( fill == "bitmap" )
{
- QString style = styleStack.attributeNS( KoXmlNS::draw, "fill-image-name" );
- QDomElement* draw =context.oasisStyles().drawStyles()[style];
+ TQString style = styleStack.attributeNS( KoXmlNS::draw, "fill-image-name" );
+ TQDomElement* draw =context.oasisStyles().drawStyles()[style];
- const QString href( draw->attributeNS( KoXmlNS::xlink, "href", QString::null) );
+ const TQString href( draw->attributeNS( KoXmlNS::xlink, "href", TQString()) );
kdDebug()<<" href: "<<href<<endl;
if ( !href.isEmpty() )
{
- QString strExtension;
- const int result=href.findRev(".");
+ TQString strExtension;
+ const int result=href.tqfindRev(".");
if (result>=0)
{
strExtension=href.mid(result+1); // As we are using KoPicture, the extension should be without the dot.
}
- QString filename(href);
- const KoPictureKey key(filename, QDateTime::currentDateTime(Qt::UTC));
+ TQString filename(href);
+ const KoPictureKey key(filename, TQDateTime::tqcurrentDateTime(Qt::UTC));
backPicture.setKey(key);
KoStore* store = context.store();
@@ -298,7 +298,7 @@ void KPrBackGround::loadOasis(KoOasisContext & context )
if ( styleStack.hasAttributeNS( KoXmlNS::style, "repeat" ) )
{
- QString repeat = styleStack.attributeNS( KoXmlNS::style, "repeat" );
+ TQString repeat = styleStack.attributeNS( KoXmlNS::style, "repeat" );
if ( repeat == "stretch" )
setBackView( BV_ZOOM );
else if ( repeat == "no-repeat" )
@@ -314,10 +314,10 @@ void KPrBackGround::loadOasis(KoOasisContext & context )
}
}
-void KPrBackGround::load( const QDomElement &element )
+void KPrBackGround::load( const TQDomElement &element )
{
//compatible with old file format kpresenter-1.4
- QDomElement e=element.namedItem("BACKMASTER").toElement();
+ TQDomElement e=element.namedItem("BACKMASTER").toElement();
if ( !e.isNull() )
{
if ( e.hasAttribute( "useMasterBackground" ) )
@@ -363,9 +363,9 @@ void KPrBackGround::load( const QDomElement &element )
if(e.hasAttribute("blue"))
blue=e.attribute("blue").toInt();
if(e.hasAttribute("color"))
- setBackColor1(QColor(e.attribute("color")));
+ setBackColor1(TQColor(e.attribute("color")));
else
- setBackColor1(QColor(red, green, blue));
+ setBackColor1(TQColor(red, green, blue));
}
e=element.namedItem("BACKCOLOR2").toElement();
if(!e.isNull()) {
@@ -377,9 +377,9 @@ void KPrBackGround::load( const QDomElement &element )
if(e.hasAttribute("blue"))
blue=e.attribute("blue").toInt();
if(e.hasAttribute("color"))
- setBackColor2(QColor(e.attribute("color")));
+ setBackColor2(TQColor(e.attribute("color")));
else
- setBackColor2(QColor(red, green, blue));
+ setBackColor2(TQColor(red, green, blue));
}
e=element.namedItem("BGRADIENT").toElement();
if(!e.isNull()) {
@@ -423,8 +423,8 @@ void KPrBackGround::load( const QDomElement &element )
e=element.namedItem("BACKPIX").toElement();
if(!e.isNull()) {
bool openPic = true;
- QString _data;
- QString _fileName;
+ TQString _data;
+ TQString _fileName;
if(e.hasAttribute("data"))
_data=e.attribute("data");
if ( _data.isEmpty() )
@@ -435,11 +435,11 @@ void KPrBackGround::load( const QDomElement &element )
_fileName=e.attribute("filename");
if ( !_fileName.isEmpty() )
{
- if ( int _envVarB = _fileName.find( '$' ) >= 0 )
+ if ( int _envVarB = _fileName.tqfind( '$' ) >= 0 )
{
- int _envVarE = _fileName.find( '/', _envVarB );
- QString path = getenv( QFile::encodeName(_fileName.mid( _envVarB, _envVarE-_envVarB )) );
- _fileName.replace( _envVarB-1, _envVarE-_envVarB+1, path );
+ int _envVarE = _fileName.tqfind( '/', _envVarB );
+ TQString path = getenv( TQFile::encodeName(_fileName.mid( _envVarB, _envVarE-_envVarB )) );
+ _fileName.tqreplace( _envVarB-1, _envVarE-_envVarB+1, path );
}
}
if ( openPic )
@@ -450,14 +450,14 @@ void KPrBackGround::load( const QDomElement &element )
KoPictureKey key( _fileName );
backPicture.clear();
backPicture.setKey(key);
- QByteArray rawData=_data.utf8(); // XPM is normally ASCII, therefore UTF-8
+ TQByteArray rawData=_data.utf8(); // XPM is normally ASCII, therefore UTF-8
rawData[rawData.size()-1]=char(10); // Replace the NULL character by a LINE FEED
- QBuffer buffer(rawData);
- backPicture.loadXpm(&buffer);
+ TQBuffer buffer(rawData);
+ backPicture.loadXpm(TQT_TQIODEVICE(&buffer));
}
#if 0
- if ( ext == orig_size.toQSize() )
+ if ( ext == orig_size.toTQSize() )
ext = backPicture.size();
backPicture = backPicture.scale( ext );
@@ -476,31 +476,31 @@ void KPrBackGround::load( const QDomElement &element )
// try to find a BACKCLIP tag if the BACKCLIPKEY is not available...
e=element.namedItem("BACKCLIP").toElement();
if(!e.isNull()) {
- QString _fileName;
+ TQString _fileName;
if(e.hasAttribute("filename"))
_fileName=e.attribute("filename");
if ( !_fileName.isEmpty() )
{
- if ( int _envVarB = _fileName.find( '$' ) >= 0 )
+ if ( int _envVarB = _fileName.tqfind( '$' ) >= 0 )
{
- int _envVarE = _fileName.find( '/', _envVarB );
- QString path = getenv( QFile::encodeName(_fileName.mid( _envVarB, _envVarE-_envVarB )) );
- _fileName.replace( _envVarB-1, _envVarE-_envVarB+1, path );
+ int _envVarE = _fileName.tqfind( '/', _envVarB );
+ TQString path = getenv( TQFile::encodeName(_fileName.mid( _envVarB, _envVarE-_envVarB )) );
+ _fileName.tqreplace( _envVarB-1, _envVarE-_envVarB+1, path );
}
}
- //KPClipartKey clipKey( _fileName, QDateTime( pictureCollection()->tmpDate(),
+ //KPClipartKey clipKey( _fileName, TQDateTime( pictureCollection()->tmpDate(),
// pictureCollection()->tmpTime() ) );
backPicture = pictureCollection()->loadPicture( _fileName ); // load from disk !
}
}
}
-void KPrBackGround::drawBackColor( QPainter *_painter, const QSize& ext, const QRect& crect )
+void KPrBackGround::drawBackColor( TQPainter *_painter, const TQSize& ext, const TQRect& crect )
{
if ( (backType == BT_COLOR && bcType == BCT_PLAIN) || backColor1 == backColor2 ) //plain color
{
//kdDebug(33001) << "KPrBackGround::drawBackColor (filling " << DEBUGRECT(crect) << ")" << endl;
- _painter->fillRect( crect, QBrush( getBackColor1() ) );
+ _painter->fillRect( crect, TQBrush( getBackColor1() ) );
}
else if (backType == BT_COLOR && bcType != BCT_PLAIN) { //gradient
if ( !gradientPixmap || gradientPixmap->size() != ext )
@@ -508,11 +508,11 @@ void KPrBackGround::drawBackColor( QPainter *_painter, const QSize& ext, const Q
_painter->drawPixmap( crect.topLeft(), *gradientPixmap, crect );
}
else /*if ( backType == BT_CLIPART || backType == BT_PICTURE )*/ //no gradient or bg color
- _painter->fillRect( crect, QBrush( Qt::white ) );
+ _painter->fillRect( crect, TQBrush( TQt::white ) );
return;
}
-void KPrBackGround::drawBackPix( QPainter *_painter, const QSize& ext, const QRect& /*crect*/ )
+void KPrBackGround::drawBackPix( TQPainter *_painter, const TQSize& ext, const TQRect& /*crect*/ )
{
/*kdDebug(33001) << "KPrBackGround::drawBackPix ext=" << ext.width() << "," << ext.height() << endl;
kdDebug(33001) << "mode=" << (backView==BV_ZOOM?"ZOOM":backView==BV_TILED?"TILED":backView==BV_CENTER?"CENTER":"OTHER")
@@ -520,27 +520,27 @@ void KPrBackGround::drawBackPix( QPainter *_painter, const QSize& ext, const QRe
if ( !backPicture.isNull() )
{
// depend on page size and desktop size
- const QSize _origSize = backPicture.getOriginalSize();
+ const TQSize _origSize = backPicture.getOriginalSize();
// NOTE: make all multiplications before any division
double w = _origSize.width();
w *= ext.width();
#if KDE_IS_VERSION(3,1,90)
- QRect desk = KGlobalSettings::desktopGeometry(kapp->activeWindow());
+ TQRect desk = KGlobalSettings::desktopGeometry(TQT_TQWIDGET(kapp->activeWindow()));
#else
- QRect desk = QApplication::desktop()->screenGeometry();
+ TQRect desk = TQApplication::desktop()->screenGeometry();
#endif
w /= desk.width();
double h = _origSize.height();
h *= ext.height();
h /= desk.height();
- const QSize _pixSize = QSize( (int)w, (int)h );
- QPixmap backPix;
+ const TQSize _pixSize = TQSize( (int)w, (int)h );
+ TQPixmap backPix;
switch ( backView )
{
case BV_ZOOM:
backPix=backPicture.generatePixmap( ext, true );
- _painter->drawPixmap( QRect( 0, 0, ext.width(), ext.height() ), backPix );
+ _painter->drawPixmap( TQRect( 0, 0, ext.width(), ext.height() ), backPix );
break;
case BV_TILED:
backPix=backPicture.generatePixmap( _pixSize, true );
@@ -550,7 +550,7 @@ void KPrBackGround::drawBackPix( QPainter *_painter, const QSize& ext, const QRe
{
backPix=backPicture.generatePixmap( _pixSize, true );
- QPixmap *pix = new QPixmap( ext.width(), ext.height() );
+ TQPixmap *pix = new TQPixmap( ext.width(), ext.height() );
bool delPix = true;
int _x = 0, _y = 0;
@@ -587,17 +587,17 @@ void KPrBackGround::drawBackPix( QPainter *_painter, const QSize& ext, const QRe
}
}
-void KPrBackGround::drawBorders( QPainter *_painter, const QSize& /*ext*/, const QRect& /*crect*/ )
+void KPrBackGround::drawBorders( TQPainter *_painter, const TQSize& /*ext*/, const TQRect& /*crect*/ )
{
- _painter->setPen( QApplication::palette().active().color( QColorGroup::Dark ) );
- _painter->setBrush( Qt::NoBrush );
+ _painter->setPen( TQApplication::tqpalette().active().color( TQColorGroup::Dark ) );
+ _painter->setBrush( TQt::NoBrush );
- QRect rect = m_page->getZoomPageRect();
+ TQRect rect = m_page->getZoomPageRect();
_painter->drawRect( rect.x()-1,rect.y()-1,rect.width()+1,rect.height()+1 );
}
-void KPrBackGround::generateGradient( const QSize& size )
+void KPrBackGround::generateGradient( const TQSize& size )
{
if ( backType == BT_COLOR || backType == BT_CLIPART ||
backType == BT_PICTURE && backView == BV_CENTER ) {