summaryrefslogtreecommitdiffstats
path: root/karbon/karbon_part.cc
diff options
context:
space:
mode:
Diffstat (limited to 'karbon/karbon_part.cc')
-rw-r--r--karbon/karbon_part.cc144
1 files changed, 72 insertions, 72 deletions
diff --git a/karbon/karbon_part.cc b/karbon/karbon_part.cc
index deab6739..88c06de3 100644
--- a/karbon/karbon_part.cc
+++ b/karbon/karbon_part.cc
@@ -18,10 +18,10 @@
*/
-#include <qdom.h>
-#include <qfileinfo.h>
-#include <qpainter.h>
-#include <qpaintdevicemetrics.h>
+#include <tqdom.h>
+#include <tqfileinfo.h>
+#include <tqpainter.h>
+#include <tqpaintdevicemetrics.h>
#include <kconfig.h>
#include <kdebug.h>
@@ -57,9 +57,9 @@
// Make sure an appropriate DTD is available in www/koffice/DTD if changing this value
// static const char * CURRENT_DTD_VERSION = "1.2";
-KarbonPart::KarbonPart( QWidget* parentWidget, const char* widgetName,
- QObject* parent, const char* name, bool singleViewMode )
- : KoDocument( parentWidget, widgetName, parent, name, singleViewMode )
+KarbonPart::KarbonPart( TQWidget* tqparentWidget, const char* widgetName,
+ TQObject* tqparent, const char* name, bool singleViewMode )
+ : KoDocument( tqparentWidget, widgetName, tqparent, name, singleViewMode )
{
setInstance( KarbonFactory::instance(), false );
setTemplateType( "karbon_template" );
@@ -67,8 +67,8 @@ KarbonPart::KarbonPart( QWidget* parentWidget, const char* widgetName,
dcop = 0L;
m_commandHistory = new VCommandHistory( this );
- connect( m_commandHistory, SIGNAL( documentRestored() ), this, SLOT( slotDocumentRestored() ) );
- connect( m_commandHistory, SIGNAL( commandExecuted( VCommand * ) ), this, SLOT( slotCommandExecuted( VCommand * ) ) );
+ connect( m_commandHistory, TQT_SIGNAL( documentRestored() ), this, TQT_SLOT( slotDocumentRestored() ) );
+ connect( m_commandHistory, TQT_SIGNAL( commandExecuted( VCommand * ) ), this, TQT_SLOT( slotCommandExecuted( VCommand * ) ) );
initConfig();
@@ -109,22 +109,22 @@ DCOPObject* KarbonPart::dcopObject()
}
void
-KarbonPart::setPageLayout( KoPageLayout& layout, KoUnit::Unit _unit )
+KarbonPart::setPageLayout( KoPageLayout& tqlayout, KoUnit::Unit _unit )
{
- m_pageLayout = layout;
+ m_pageLayout = tqlayout;
m_doc.setUnit( _unit );
m_doc.setWidth( m_pageLayout.ptWidth );
m_doc.setHeight( m_pageLayout.ptHeight );
}
bool
-KarbonPart::initDoc(InitDocFlags flags, QWidget* parentWidget)
+KarbonPart::initDoc(InitDocFlags flags, TQWidget* tqparentWidget)
{
if (flags==KoDocument::InitDocEmpty)
{
return true;
}
- QString file;
+ TQString file;
KoTemplateChooseDia::ReturnType result;
KoTemplateChooseDia::DialogType dlgtype;
@@ -133,7 +133,7 @@ KarbonPart::initDoc(InitDocFlags flags, QWidget* parentWidget)
else
dlgtype = KoTemplateChooseDia::OnlyTemplates;
- result = KoTemplateChooseDia::choose( KarbonFactory::instance(), file, dlgtype, "karbon_template", parentWidget );
+ result = KoTemplateChooseDia::choose( KarbonFactory::instance(), file, dlgtype, "karbon_template", tqparentWidget );
if( result == KoTemplateChooseDia::Template )
{
@@ -158,9 +158,9 @@ KarbonPart::initDoc(InitDocFlags flags, QWidget* parentWidget)
}
KoView*
-KarbonPart::createViewInstance( QWidget* parent, const char* name )
+KarbonPart::createViewInstance( TQWidget* tqparent, const char* name )
{
- KarbonView *result = new KarbonView( this, parent, name );
+ KarbonView *result = new KarbonView( this, tqparent, name );
return result;
}
@@ -171,30 +171,30 @@ KarbonPart::removeView( KoView *view )
KoDocument::removeView( view );
}
-double getAttribute(QDomElement &element, const char *attributeName, double defaultValue)
+double getAttribute(TQDomElement &element, const char *attributeName, double defaultValue)
{
- QString value;
- if ( ( value = element.attribute( attributeName ) ) != QString::null )
+ TQString value;
+ if ( ( value = element.attribute( attributeName ) ) != TQString() )
return value.toDouble();
else
return defaultValue;
}
-int getAttribute(QDomElement &element, const char *attributeName, int defaultValue)
+int getAttribute(TQDomElement &element, const char *attributeName, int defaultValue)
{
- QString value;
- if ( ( value = element.attribute( attributeName ) ) != QString::null )
+ TQString value;
+ if ( ( value = element.attribute( attributeName ) ) != TQString() )
return value.toInt();
else
return defaultValue;
}
bool
-KarbonPart::loadXML( QIODevice*, const QDomDocument& document )
+KarbonPart::loadXML( TQIODevice*, const TQDomDocument& document )
{
bool success = false;
- QDomElement doc = document.documentElement();
+ TQDomElement doc = document.documentElement();
if( m_merge )
{
@@ -207,7 +207,7 @@ KarbonPart::loadXML( QIODevice*, const QDomDocument& document )
//m_pageLayout = KoPageLayout::standardLayout();
// <PAPER>
- QDomElement paper = doc.namedItem( "PAPER" ).toElement();
+ TQDomElement paper = doc.namedItem( "PAPER" ).toElement();
if ( !paper.isNull() )
{
m_pageLayout.format = static_cast<KoFormat>( getAttribute( paper, "format", 0 ) );
@@ -232,7 +232,7 @@ KarbonPart::loadXML( QIODevice*, const QDomDocument& document )
kdDebug() << " ptWidth=" << m_pageLayout.ptWidth << endl;
kdDebug() << " ptHeight=" << m_pageLayout.ptHeight << endl;
- QDomElement borders = paper.namedItem( "PAPERBORDERS" ).toElement();
+ TQDomElement borders = paper.namedItem( "PAPERBORDERS" ).toElement();
if( !borders.isNull() )
{
if( borders.hasAttribute( "ptLeft" ) )
@@ -250,12 +250,12 @@ KarbonPart::loadXML( QIODevice*, const QDomDocument& document )
return success;
}
-QDomDocument
+TQDomDocument
KarbonPart::saveXML()
{
- QDomDocument doc = m_doc.saveXML();
- QDomElement me = doc.documentElement();
- QDomElement paper = doc.createElement( "PAPER" );
+ TQDomDocument doc = m_doc.saveXML();
+ TQDomElement me = doc.documentElement();
+ TQDomElement paper = doc.createElement( "PAPER" );
me.appendChild( paper );
paper.setAttribute( "format", static_cast<int>( m_pageLayout.format ) );
paper.setAttribute( "pages", pageCount() );
@@ -263,7 +263,7 @@ KarbonPart::saveXML()
paper.setAttribute( "height", m_pageLayout.ptHeight );
paper.setAttribute( "orientation", static_cast<int>( m_pageLayout.orientation ) );
- QDomElement paperBorders = doc.createElement( "PAPERBORDERS" );
+ TQDomElement paperBorders = doc.createElement( "PAPERBORDERS" );
paperBorders.setAttribute( "ptLeft", m_pageLayout.ptLeft );
paperBorders.setAttribute( "ptTop", m_pageLayout.ptTop );
paperBorders.setAttribute( "ptRight", m_pageLayout.ptRight );
@@ -274,16 +274,16 @@ KarbonPart::saveXML()
}
bool
-KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDomDocument &settings, KoStore *store )
+KarbonPart::loadOasis( const TQDomDocument &doc, KoOasisStyles &styles, const TQDomDocument &settings, KoStore *store )
{
kdDebug(38000) << "Start loading OASIS document..." << doc.toString() << endl;
- QDomElement contents = doc.documentElement();
+ TQDomElement contents = doc.documentElement();
kdDebug(38000) << "Start loading OASIS document..." << contents.text() << endl;
kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().localName() << endl;
kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().namespaceURI() << endl;
kdDebug(38000) << "Start loading OASIS contents..." << contents.lastChild().isElement() << endl;
- QDomElement body( KoDom::namedItemNS( contents, KoXmlNS::office, "body" ) );
+ TQDomElement body( KoDom::namedItemNS( contents, KoXmlNS::office, "body" ) );
kdDebug(38000) << "Start loading OASIS document..." << body.text() << endl;
if( body.isNull() )
{
@@ -300,7 +300,7 @@ KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDo
return false;
}
- QDomElement page( KoDom::namedItemNS( body, KoXmlNS::draw, "page" ) );
+ TQDomElement page( KoDom::namedItemNS( body, KoXmlNS::draw, "page" ) );
if(page.isNull())
{
kdDebug(38000) << "No office:drawing found!" << endl;
@@ -308,18 +308,18 @@ KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDo
return false;
}
- QString masterPageName = "Standard"; // use default layout as fallback
- QDomElement *master = styles.masterPages()[ masterPageName ];
+ TQString masterPageName = "Standard"; // use default tqlayout as fallback
+ TQDomElement *master = styles.masterPages()[ masterPageName ];
if ( !master ) //last test...
master = styles.masterPages()[ "Default" ];
// last resort, use the first found master page style
if ( ! master )
{
- QDictIterator<QDomElement> it( styles.masterPages() );
+ TQDictIterator<TQDomElement> it( styles.masterPages() );
master = it.current();
}
Q_ASSERT( master );
- const QDomElement *style = master ? styles.findStyle( master->attributeNS( KoXmlNS::style, "page-layout-name", QString::null ) ) : 0;
+ const TQDomElement *style = master ? styles.findStyle( master->attributeNS( KoXmlNS::style, "page-tqlayout-name", TQString() ) ) : 0;
if( style )
{
m_pageLayout.loadOasis( *style );
@@ -332,7 +332,7 @@ KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDo
KoOasisLoadingContext context( this, styles, store );
m_doc.loadOasis( page, context );
// do y-mirroring here
- QWMatrix mat;
+ TQWMatrix mat;
mat.scale( 1, -1 );
mat.translate( 0, -m_doc.height() );
VTransformCmd trafo( 0L, mat );
@@ -344,7 +344,7 @@ KarbonPart::loadOasis( const QDomDocument &doc, KoOasisStyles &styles, const QDo
}
void
-KarbonPart::loadOasisSettings( const QDomDocument&settingsDoc )
+KarbonPart::loadOasisSettings( const TQDomDocument&settingsDoc )
{
if ( settingsDoc.isNull() )
return ; // not an error if some file doesn't have settings.xml
@@ -369,15 +369,15 @@ KarbonPart::saveOasis( KoStore *store, KoXmlWriter *manifestWriter )
KoGenStyles mainStyles;
KoGenStyle pageLayout = m_pageLayout.saveOasis();
- QString layoutName = mainStyles.lookup( pageLayout, "PL" );
+ TQString tqlayoutName = mainStyles.lookup( pageLayout, "PL" );
KoGenStyle masterPage( KoGenStyle::STYLE_MASTER );
- masterPage.addAttribute( "style:page-layout-name", layoutName );
+ masterPage.addAttribute( "style:page-tqlayout-name", tqlayoutName );
mainStyles.lookup( masterPage, "Default", KoGenStyles::DontForceNumbering );
KTempFile contentTmpFile;
contentTmpFile.setAutoDelete( true );
- QFile* tmpFile = contentTmpFile.file();
- KoXmlWriter contentTmpWriter( tmpFile, 1 );
+ TQFile* tmpFile = contentTmpFile.file();
+ KoXmlWriter contentTmpWriter( TQT_TQIODEVICE(tmpFile), 1 );
contentTmpWriter.startElement( "office:body" );
contentTmpWriter.startElement( "office:drawing" );
@@ -389,8 +389,8 @@ KarbonPart::saveOasis( KoStore *store, KoXmlWriter *manifestWriter )
docWriter->startElement( "office:automatic-styles" );
- QValueList<KoGenStyles::NamedStyle> styles = mainStyles.styles( VDocument::STYLE_GRAPHICAUTO );
- QValueList<KoGenStyles::NamedStyle>::const_iterator it = styles.begin();
+ TQValueList<KoGenStyles::NamedStyle> styles = mainStyles.styles( VDocument::STYLE_GRAPHICAUTO );
+ TQValueList<KoGenStyles::NamedStyle>::const_iterator it = styles.begin();
for( ; it != styles.end() ; ++it )
(*it).style->writeStyle( docWriter, mainStyles, "style:style", (*it).name , "style:graphic-properties" );
@@ -398,7 +398,7 @@ KarbonPart::saveOasis( KoStore *store, KoXmlWriter *manifestWriter )
// And now we can copy over the contents from the tempfile to the real one
tmpFile->close();
- docWriter->addCompleteElement( tmpFile );
+ docWriter->addCompleteElement( TQT_TQIODEVICE(tmpFile) );
contentTmpFile.close();
docWriter->endElement(); // Root element
@@ -431,11 +431,11 @@ KarbonPart::saveOasis( KoStore *store, KoXmlWriter *manifestWriter )
styleWriter->startElement( "office:automatic-styles" );
- QValueList<KoGenStyles::NamedStyle> styleList = mainStyles.styles( KoGenStyle::STYLE_PAGELAYOUT );
+ TQValueList<KoGenStyles::NamedStyle> styleList = mainStyles.styles( KoGenStyle::STYLE_PAGELAYOUT );
it = styleList.begin();
for( ; it != styleList.end(); ++it )
- (*it).style->writeStyle( styleWriter, mainStyles, "style:page-layout", (*it).name, "style:page-layout-properties" );
+ (*it).style->writeStyle( styleWriter, mainStyles, "style:page-tqlayout", (*it).name, "style:page-tqlayout-properties" );
styleWriter->endElement(); // office:automatic-styles
@@ -495,20 +495,20 @@ KarbonPart::saveOasisSettings( KoXmlWriter &/*settingsWriter*/ )
void
KarbonPart::insertObject( VObject* object )
{
- // don't repaint here explicitly. some commands might want to insert many
+ // don't tqrepaint here explicitly. some commands might want to insert many
// objects.
m_doc.append( object );
setModified( true );
}
void
-KarbonPart::addCommand( VCommand* cmd, bool repaint )
+KarbonPart::addCommand( VCommand* cmd, bool tqrepaint )
{
m_commandHistory->addCommand( cmd );
setModified( true );
- if( repaint )
- repaintAllViews();
+ if( tqrepaint )
+ tqrepaintAllViews();
}
void
@@ -530,56 +530,56 @@ KarbonPart::clearHistory()
}
void
-KarbonPart::repaintAllViews( bool repaint )
+KarbonPart::tqrepaintAllViews( bool tqrepaint )
{
- QPtrListIterator<KoView> itr( views() );
+ TQPtrListIterator<KoView> itr( views() );
for( ; itr.current() ; ++itr )
- static_cast<KarbonView*>( itr.current() )->canvasWidget()->repaintAll( repaint );
+ static_cast<KarbonView*>( itr.current() )->canvasWidget()->tqrepaintAll( tqrepaint );
}
void
-KarbonPart::repaintAllViews( const KoRect &rect )
+KarbonPart::tqrepaintAllViews( const KoRect &rect )
{
- QPtrListIterator<KoView> itr( views() );
+ TQPtrListIterator<KoView> itr( views() );
for( ; itr.current() ; ++itr )
- static_cast<KarbonView*>( itr.current() )->canvasWidget()->repaintAll( rect );
+ static_cast<KarbonView*>( itr.current() )->canvasWidget()->tqrepaintAll( rect );
}
void
-KarbonPart::paintContent( QPainter& painter, const QRect& rect,
+KarbonPart::paintContent( TQPainter& painter, const TQRect& rect,
bool /*transparent*/, double /*zoomX*/, double /*zoomY*/ )
{
kdDebug(38000) << "**** part->paintContent()" << endl;
- KoRect r = KoRect::fromQRect( rect );
+ KoRect r = KoRect::fromTQRect( rect );
double zoomFactorX = double( r.width() ) / double( document().width() );
double zoomFactorY = double( r.height() ) / double( document().height() );
double zoomFactor = kMin( zoomFactorX, zoomFactorY );
painter.eraseRect( rect );
VPainterFactory *painterFactory = new VPainterFactory;
- //QPaintDeviceMetrics metrics( painter.device() );
- painterFactory->setPainter( painter.device(), rect.width(), rect.height() );
+ //TQPaintDeviceMetrics metrics( painter.device() );
+ painterFactory->setPainter( painter.tqdevice(), rect.width(), rect.height() );
VPainter *p = painterFactory->painter();
//VPainter *p = new VKoPainter( painter.device() );
p->begin();
p->setZoomFactor( zoomFactor );
- kdDebug(38000) << "painter.worldMatrix().dx() : " << painter.worldMatrix().dx() << endl;
- kdDebug(38000) << "painter.worldMatrix().dy() : " << painter.worldMatrix().dy() << endl;
+ kdDebug(38000) << "painter.tqworldMatrix().dx() : " << painter.tqworldMatrix().dx() << endl;
+ kdDebug(38000) << "painter.tqworldMatrix().dy() : " << painter.tqworldMatrix().dy() << endl;
kdDebug(38000) << "rect.x() : "<< rect.x() << endl;
kdDebug(38000) << "rect.y() : "<< rect.y() << endl;
kdDebug(38000) << "rect.width() : "<< rect.width() << endl;
kdDebug(38000) << "rect.height() : "<< rect.height() << endl;
r = document().boundingBox();
- QWMatrix mat = painter.worldMatrix();
+ TQWMatrix mat = painter.tqworldMatrix();
mat.scale( 1, -1 );
mat.translate( 0, -r.height() * zoomFactor );
p->setWorldMatrix( mat );
m_doc.selection()->clear();
- QPtrListIterator<VLayer> itr( m_doc.layers() );
+ TQPtrListIterator<VLayer> itr( m_doc.layers() );
for( ; itr.current(); ++itr )
{
@@ -599,7 +599,7 @@ KarbonPart::setShowStatusBar( bool b )
void
KarbonPart::reorganizeGUI()
{
- QPtrListIterator<KoView> itr( views() );
+ TQPtrListIterator<KoView> itr( views() );
for( ; itr.current(); ++itr )
{
@@ -633,7 +633,7 @@ KarbonPart::initConfig()
{
config->setGroup( "Misc" );
undos = config->readNumEntry( "UndoRedo", -1 );
- QString defaultUnit = "cm";
+ TQString defaultUnit = "cm";
if( KGlobal::locale()->measureSystem() == KLocale::Imperial )
defaultUnit = "in";
@@ -646,7 +646,7 @@ KarbonPart::initConfig()
}
bool
-KarbonPart::mergeNativeFormat( const QString &file )
+KarbonPart::mergeNativeFormat( const TQString &file )
{
m_merge = true;
bool result = loadNativeFormat( file );
@@ -659,7 +659,7 @@ KarbonPart::mergeNativeFormat( const QString &file )
void
KarbonPart::addShell( KoMainWindow *shell )
{
- connect( shell, SIGNAL( documentSaved() ), m_commandHistory, SLOT( documentSaved() ) );
+ connect( shell, TQT_SIGNAL( documentSaved() ), m_commandHistory, TQT_SLOT( documentSaved() ) );
KoDocument::addShell( shell );
}