diff options
Diffstat (limited to 'kivio/kiviopart/kivioglobal.cpp')
-rw-r--r-- | kivio/kiviopart/kivioglobal.cpp | 186 |
1 files changed, 93 insertions, 93 deletions
diff --git a/kivio/kiviopart/kivioglobal.cpp b/kivio/kiviopart/kivioglobal.cpp index d9e08037..7479af08 100644 --- a/kivio/kiviopart/kivioglobal.cpp +++ b/kivio/kiviopart/kivioglobal.cpp @@ -19,9 +19,9 @@ #include "kivioglobal.h" -#include <qdom.h> -#include <qpixmap.h> -#include <qprinter.h> +#include <tqdom.h> +#include <tqpixmap.h> +#include <tqprinter.h> #include <kdebug.h> #include <kglobal.h> @@ -44,52 +44,52 @@ struct PaperSizeDef { int unit; }; -void Kivio::savePageLayout(QDomElement& e, const KoPageLayout& layout) +void Kivio::savePageLayout(TQDomElement& e, const KoPageLayout& tqlayout) { - XmlWriteFloat(e, "width", layout.ptWidth); - XmlWriteFloat(e, "height", layout.ptHeight); - XmlWriteFloat(e, "marginLeft", layout.ptLeft); - XmlWriteFloat(e, "marginRight", layout.ptRight); - XmlWriteFloat(e, "marginTop", layout.ptTop); - XmlWriteFloat(e, "marginBottom", layout.ptBottom); - XmlWriteString(e, "format", KoPageFormat::formatString(layout.format)); - XmlWriteString(e, "orientation", Kivio::orientationString(layout.orientation)); + XmlWriteFloat(e, "width", tqlayout.ptWidth); + XmlWriteFloat(e, "height", tqlayout.ptHeight); + XmlWriteFloat(e, "marginLeft", tqlayout.ptLeft); + XmlWriteFloat(e, "marginRight", tqlayout.ptRight); + XmlWriteFloat(e, "marginTop", tqlayout.ptTop); + XmlWriteFloat(e, "marginBottom", tqlayout.ptBottom); + XmlWriteString(e, "format", KoPageFormat::formatString(tqlayout.format)); + XmlWriteString(e, "orientation", Kivio::orientationString(tqlayout.orientation)); } -// ## TODO: remove this method, now that layout.saveOasis() does it all -KoGenStyle Kivio::savePageLayout(const KoPageLayout& layout) +// ## TODO: remove this method, now that tqlayout.saveOasis() does it all +KoGenStyle Kivio::savePageLayout(const KoPageLayout& tqlayout) { - return layout.saveOasis(); + return tqlayout.saveOasis(); } -KoPageLayout Kivio::loadPageLayout(const QDomElement& e) +KoPageLayout Kivio::loadPageLayout(const TQDomElement& e) { - KoPageLayout layout; + KoPageLayout tqlayout; if(e.hasAttribute("unit")) { // Compatibility with Kivio <= 1.2.x kdDebug(43000) << "Compatibility mode..." << endl; KoUnit::Unit unit = Kivio::convToKoUnit(XmlReadInt(e, "unit", 0)); - layout.ptWidth = KoUnit::fromUserValue(XmlReadFloat(e, "width", 0.0), unit); - layout.ptHeight = KoUnit::fromUserValue(XmlReadFloat(e, "height", 0.0), unit); - layout.ptLeft = KoUnit::fromUserValue(XmlReadFloat(e, "marginLeft", 0.0), unit); - layout.ptRight = KoUnit::fromUserValue(XmlReadFloat(e, "marginRight", 0.0), unit); - layout.ptTop = KoUnit::fromUserValue(XmlReadFloat(e, "marginTop", 0.0), unit); - layout.ptBottom = KoUnit::fromUserValue(XmlReadFloat(e, "marginBottom", 0.0), unit); - Kivio::setFormatOrientation(layout); + tqlayout.ptWidth = KoUnit::fromUserValue(XmlReadFloat(e, "width", 0.0), unit); + tqlayout.ptHeight = KoUnit::fromUserValue(XmlReadFloat(e, "height", 0.0), unit); + tqlayout.ptLeft = KoUnit::fromUserValue(XmlReadFloat(e, "marginLeft", 0.0), unit); + tqlayout.ptRight = KoUnit::fromUserValue(XmlReadFloat(e, "marginRight", 0.0), unit); + tqlayout.ptTop = KoUnit::fromUserValue(XmlReadFloat(e, "marginTop", 0.0), unit); + tqlayout.ptBottom = KoUnit::fromUserValue(XmlReadFloat(e, "marginBottom", 0.0), unit); + Kivio::setFormatOrientation(tqlayout); kdDebug(43000) << "Ready." << endl; } else { - layout.ptWidth = XmlReadFloat(e, "width", 0.0); - layout.ptHeight = XmlReadFloat(e, "height", 0.0); - layout.ptLeft = XmlReadFloat(e, "marginLeft", 0.0); - layout.ptRight = XmlReadFloat(e, "marginRight", 0.0); - layout.ptTop = XmlReadFloat(e, "marginTop", 0.0); - layout.ptBottom = XmlReadFloat(e, "marginBottom", 0.0); - layout.format = KoPageFormat::formatFromString(XmlReadString(e, "format", pageSizeString(KGlobal::locale()->pageSize()))); - layout.orientation = Kivio::orientationFromString(XmlReadString(e, "orientation", "Portrait")); + tqlayout.ptWidth = XmlReadFloat(e, "width", 0.0); + tqlayout.ptHeight = XmlReadFloat(e, "height", 0.0); + tqlayout.ptLeft = XmlReadFloat(e, "marginLeft", 0.0); + tqlayout.ptRight = XmlReadFloat(e, "marginRight", 0.0); + tqlayout.ptTop = XmlReadFloat(e, "marginTop", 0.0); + tqlayout.ptBottom = XmlReadFloat(e, "marginBottom", 0.0); + tqlayout.format = KoPageFormat::formatFromString(XmlReadString(e, "format", pageSizeString(KGlobal::locale()->pageSize()))); + tqlayout.orientation = Kivio::orientationFromString(XmlReadString(e, "orientation", "Portrait")); } - return layout; + return tqlayout; } KoUnit::Unit Kivio::convToKoUnit(int tkUnit) @@ -114,7 +114,7 @@ KoUnit::Unit Kivio::convToKoUnit(int tkUnit) return KoUnit::U_PT; } -QString Kivio::orientationString(KoOrientation o) +TQString Kivio::orientationString(KoOrientation o) { if(o == PG_LANDSCAPE) { return "Landscape"; @@ -123,7 +123,7 @@ QString Kivio::orientationString(KoOrientation o) return "Portrait"; } -KoOrientation Kivio::orientationFromString(const QString& s) +KoOrientation Kivio::orientationFromString(const TQString& s) { if(s == "Landscape") { return PG_LANDSCAPE; @@ -132,7 +132,7 @@ KoOrientation Kivio::orientationFromString(const QString& s) return PG_PORTRAIT; } -void Kivio::setFormatOrientation(KoPageLayout& layout) +void Kivio::setFormatOrientation(KoPageLayout& tqlayout) { const PaperSizeDef PapersTable[] = { {"A0",841,1189,KoUnit::U_MM}, @@ -166,20 +166,20 @@ void Kivio::setFormatOrientation(KoPageLayout& layout) PaperSizeDef sizeDef = PapersTable[0]; bool found = false; float width, height; - layout.format = PG_CUSTOM; - layout.orientation = PG_PORTRAIT; + tqlayout.format = PG_CUSTOM; + tqlayout.orientation = PG_PORTRAIT; while((sizeDef.unit != -2) && !found) { width = KoUnit::fromUserValue(sizeDef.width, static_cast<KoUnit::Unit>(sizeDef.unit)); height = KoUnit::fromUserValue(sizeDef.height, static_cast<KoUnit::Unit>(sizeDef.unit)); - if((layout.ptWidth == width) && (layout.ptHeight == height)) { - layout.format = KoPageFormat::formatFromString(sizeDef.title); - layout.orientation = PG_PORTRAIT; + if((tqlayout.ptWidth == width) && (tqlayout.ptHeight == height)) { + tqlayout.format = KoPageFormat::formatFromString(sizeDef.title); + tqlayout.orientation = PG_PORTRAIT; found = true; - } else if((layout.ptWidth == height) && (layout.ptHeight == width)) { - layout.format = KoPageFormat::formatFromString(sizeDef.title); - layout.orientation = PG_LANDSCAPE; + } else if((tqlayout.ptWidth == height) && (tqlayout.ptHeight == width)) { + tqlayout.format = KoPageFormat::formatFromString(sizeDef.title); + tqlayout.orientation = PG_LANDSCAPE; found = true; } @@ -187,7 +187,7 @@ void Kivio::setFormatOrientation(KoPageLayout& layout) } } -KoSize Kivio::loadSize(const QDomElement& e, const QString& name, const KoSize& def) +KoSize Kivio::loadSize(const TQDomElement& e, const TQString& name, const KoSize& def) { KoSize size; if(e.hasAttribute(name + "Unit")) { @@ -203,108 +203,108 @@ KoSize Kivio::loadSize(const QDomElement& e, const QString& name, const KoSize& return size; } -void Kivio::saveSize(QDomElement& e, const QString& name, const KoSize& size) +void Kivio::saveSize(TQDomElement& e, const TQString& name, const KoSize& size) { XmlWriteFloat(e, name + "Width", size.width()); XmlWriteFloat(e, name + "Height", size.height()); } -QString Kivio::pageSizeString(int pageSize) +TQString Kivio::pageSizeString(int pageSize) { - QString psStr = "A4"; + TQString psStr = "A4"; switch(pageSize) { - case QPrinter::A0: + case TQPrinter::A0: psStr = "A0"; break; - case QPrinter::A1: + case TQPrinter::A1: psStr = "A1"; break; - case QPrinter::A2: + case TQPrinter::A2: psStr = "A2"; break; - case QPrinter::A3: + case TQPrinter::A3: psStr = "A3"; break; - case QPrinter::A5: + case TQPrinter::A5: psStr = "A5"; break; - case QPrinter::A6: + case TQPrinter::A6: psStr = "A6"; break; - case QPrinter::A7: + case TQPrinter::A7: psStr = "A7"; break; - case QPrinter::A8: + case TQPrinter::A8: psStr = "A8"; break; - case QPrinter::A9: + case TQPrinter::A9: psStr = "A9"; break; - case QPrinter::B0: + case TQPrinter::B0: psStr = "B0"; break; - case QPrinter::B1: + case TQPrinter::B1: psStr = "B1"; break; - case QPrinter::B10: + case TQPrinter::B10: psStr = "B10"; break; - case QPrinter::B2: + case TQPrinter::B2: psStr = "B2"; break; - case QPrinter::B3: + case TQPrinter::B3: psStr = "B3"; break; - case QPrinter::B4: + case TQPrinter::B4: psStr = "B4"; break; - case QPrinter::B5: + case TQPrinter::B5: psStr = "B5"; break; - case QPrinter::B6: + case TQPrinter::B6: psStr = "B6"; break; - case QPrinter::B7: + case TQPrinter::B7: psStr = "B7"; break; - case QPrinter::B8: + case TQPrinter::B8: psStr = "B8"; break; - case QPrinter::B9: + case TQPrinter::B9: psStr = "B9"; break; - case QPrinter::C5E: + case TQPrinter::C5E: psStr = "C5"; break; - case QPrinter::Comm10E: + case TQPrinter::Comm10E: psStr = "Comm10"; break; - case QPrinter::DLE: + case TQPrinter::DLE: psStr = "DL"; break; - case QPrinter::Executive: + case TQPrinter::Executive: psStr = "Executive"; break; - case QPrinter::Folio: + case TQPrinter::Folio: psStr = "Folio"; break; - case QPrinter::Ledger: + case TQPrinter::Ledger: psStr = "Ledger"; break; - case QPrinter::Legal: + case TQPrinter::Legal: psStr = "Legal"; break; - case QPrinter::Letter: + case TQPrinter::Letter: psStr = "Letter"; break; - case QPrinter::Tabloid: + case TQPrinter::Tabloid: psStr = "Tabloid"; break; - case QPrinter::Custom: + case TQPrinter::Custom: psStr = "Custom"; break; - case QPrinter::A4: + case TQPrinter::A4: default: psStr = "A4"; break; @@ -313,7 +313,7 @@ QString Kivio::pageSizeString(int pageSize) return psStr; } -QPixmap Kivio::arrowHeadPixmap() +TQPixmap Kivio::arrowHeadPixmap() { const char* lineends[] = { "50 272 2 1", @@ -1239,10 +1239,10 @@ QPixmap Kivio::arrowHeadPixmap() "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"*/ }; - return QPixmap(lineends); + return TQPixmap(lineends); } -QPixmap Kivio::connectorTargetPixmap() +TQPixmap Kivio::connectorTargetPixmap() { const char * connectorTarget_xpm[] = { "7 7 3 1", @@ -1257,10 +1257,10 @@ QPixmap Kivio::connectorTargetPixmap() ".+. .+.", " . . "}; - return QPixmap(connectorTarget_xpm); + return TQPixmap(connectorTarget_xpm); } -QPixmap Kivio::lockPixmap() +TQPixmap Kivio::lockPixmap() { const char * lock_xpm[] = { "10 10 3 1", @@ -1278,12 +1278,12 @@ QPixmap Kivio::lockPixmap() " .++++++. ", " ...... "}; - return QPixmap(lock_xpm); + return TQPixmap(lock_xpm); } -QString Kivio::systemDefaultUnit() +TQString Kivio::systemDefaultUnit() { - QString defMS = "cm"; + TQString defMS = "cm"; if(KGlobal::locale()->measureSystem() == KLocale::Imperial) { defMS = "in"; @@ -1292,20 +1292,20 @@ QString Kivio::systemDefaultUnit() return defMS; } -QPixmap Kivio::generatePixmapFromStencil(int width, int height, KivioStencil* stencil) +TQPixmap Kivio::generatePixmapFromStencil(int width, int height, KivioStencil* stencil) { KoZoomHandler zoomHandler; - QRect rect = zoomHandler.zoomRect(stencil->rect()); + TQRect rect = zoomHandler.zoomRect(stencil->rect()); double zw = (double)(width - 2) / (double)rect.width(); double zh = (double)(height - 2) / (double)rect.height(); - zoomHandler.setZoomAndResolution(qRound(kMin(zw, zh) * 100.0), KoGlobal::dpiX(), KoGlobal::dpiY()); + zoomHandler.setZoomAndResolution(tqRound(kMin(zw, zh) * 100.0), KoGlobal::dpiX(), KoGlobal::dpiY()); rect = zoomHandler.zoomRect(stencil->rect()); - QPixmap pix(width, height); - pix.fill(Qt::white); + TQPixmap pix(width, height); + pix.fill(TQt::white); KivioScreenPainter kpainter; - kpainter.start(&pix); + kpainter.start(TQT_TQPAINTDEVICE(&pix)); kpainter.translateBy(-rect.x() + ((width - rect.width()) / 2), -rect.y() + ((height - rect.height()) / 2)); KivioIntraStencilData data; data.painter = &kpainter; |