summaryrefslogtreecommitdiffstats
path: root/lib/kofficecore/KoDocumentChild.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 /lib/kofficecore/KoDocumentChild.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 'lib/kofficecore/KoDocumentChild.cpp')
-rw-r--r--lib/kofficecore/KoDocumentChild.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/lib/kofficecore/KoDocumentChild.cpp b/lib/kofficecore/KoDocumentChild.cpp
index 8157b95a..308493ad 100644
--- a/lib/kofficecore/KoDocumentChild.cpp
+++ b/lib/kofficecore/KoDocumentChild.cpp
@@ -35,7 +35,7 @@
#include <kmessagebox.h>
#include <kdebug.h>
-#include <qapplication.h>
+#include <tqapplication.h>
#include <assert.h>
@@ -67,32 +67,32 @@ public:
bool m_deleted;
};
-KoDocumentChild::KoDocumentChild( KoDocument* parent, KoDocument* doc, const QRect& geometry )
- : KoChild( parent )
+KoDocumentChild::KoDocumentChild( KoDocument* tqparent, KoDocument* doc, const TQRect& tqgeometry )
+ : KoChild( tqparent )
{
d = new KoDocumentChildPrivate;
- d->m_parent = parent;
+ d->m_parent = tqparent;
d->m_doc = doc;
- setGeometry( geometry );
+ setGeometry( tqgeometry );
d->m_deleted = false;
if ( doc )
doc->setStoreInternal( !doc->hasExternURL() );
}
-KoDocumentChild::KoDocumentChild( KoDocument* parent )
- : KoChild( parent )
+KoDocumentChild::KoDocumentChild( KoDocument* tqparent )
+ : KoChild( tqparent )
{
d = new KoDocumentChildPrivate;
- d->m_parent = parent;
+ d->m_parent = tqparent;
d->m_doc = 0L;
d->m_deleted = false;
}
-void KoDocumentChild::setDocument( KoDocument *doc, const QRect &geometry )
+void KoDocumentChild::setDocument( KoDocument *doc, const TQRect &tqgeometry )
{
kdDebug()<<k_funcinfo<<"doc: "<<doc->url().url()<<endl;
d->m_doc = doc;
- setGeometry( geometry );
+ setGeometry( tqgeometry );
updateMatrix();
}
@@ -102,45 +102,45 @@ KoDocument *KoDocumentChild::document() const
return d->m_doc;
}
-KoDocument* KoDocumentChild::parentDocument() const
+KoDocument* KoDocumentChild::tqparentDocument() const
{
return d->m_parent;
}
-KoDocument* KoDocumentChild::hitTest( const QPoint &p, const QWMatrix &_matrix )
+KoDocument* KoDocumentChild::hitTest( const TQPoint &p, const TQWMatrix &_matrix )
{
- if ( !region( _matrix ).contains( p ) || !d->m_doc )
+ if ( !region( _matrix ).tqcontains( p ) || !d->m_doc )
return 0L;
- QWMatrix m( _matrix );
+ TQWMatrix m( _matrix );
m = matrix() * m;
m.scale( xScaling(), yScaling() );
return d->m_doc->hitTest( p, m );
}
-void KoDocumentChild::loadOasis( const QDomElement &frameElement, const QDomElement& objectElement )
+void KoDocumentChild::loadOasis( const TQDomElement &frameElement, const TQDomElement& objectElement )
{
double x, y, w, h;
- x = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "x", QString::null ) );
- y = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "y", QString::null ) );
- w = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "width", QString::null ) );
- h = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "height", QString::null ) );
- m_tmpGeometry = QRect((int)x, (int)y, (int)w, (int)h); // #### double->int conversion
+ x = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "x", TQString() ) );
+ y = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "y", TQString() ) );
+ w = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "width", TQString() ) );
+ h = KoUnit::parseValue( frameElement.attributeNS( KoXmlNS::svg, "height", TQString() ) );
+ m_tmpGeometry = TQRect((int)x, (int)y, (int)w, (int)h); // #### double->int conversion
setGeometry(m_tmpGeometry);
- QString url = objectElement.attributeNS( KoXmlNS::xlink, "href", QString::null );
+ TQString url = objectElement.attributeNS( KoXmlNS::xlink, "href", TQString() );
if ( url[0] == '#' )
url = url.mid( 1 );
if ( url.startsWith( "./" ) )
- m_tmpURL = QString( INTERNAL_PROTOCOL ) + ":/" + url.mid( 2 );
+ m_tmpURL = TQString( INTERNAL_PROTOCOL ) + ":/" + url.mid( 2 );
else
m_tmpURL = url;
kdDebug() << k_funcinfo << m_tmpURL << endl;
}
-bool KoDocumentChild::load( const QDomElement& element, bool uppercase )
+bool KoDocumentChild::load( const TQDomElement& element, bool uppercase )
{
if ( element.hasAttribute( "url" ) )
m_tmpURL = element.attribute("url");
@@ -159,10 +159,10 @@ bool KoDocumentChild::load( const QDomElement& element, bool uppercase )
}
bool brect = FALSE;
- QDomNode n = element.firstChild();
+ TQDomNode n = element.firstChild();
for( ; !n.isNull(); n = n.nextSibling() )
{
- QDomElement e = n.toElement();
+ TQDomElement e = n.toElement();
if ( e.isNull() ) continue;
if ( e.tagName() == "rect" || ( uppercase && e.tagName() == "RECT" ) )
{
@@ -177,7 +177,7 @@ bool KoDocumentChild::load( const QDomElement& element, bool uppercase )
w = e.attribute( "w" ).toInt(&brect);
if ( e.hasAttribute( "h" ) )
h = e.attribute( "h" ).toInt(&brect);
- m_tmpGeometry = QRect(x, y, w, h);
+ m_tmpGeometry = TQRect(x, y, w, h);
setGeometry(m_tmpGeometry);
}
}
@@ -209,11 +209,11 @@ bool KoDocumentChild::loadDocument( KoStore* store )
if ( res )
{
// Try to turn the mimetype name into its comment
- QString mimeName = m_tmpMimeType;
+ TQString mimeName = m_tmpMimeType;
KMimeType::Ptr mime = KMimeType::mimeType( m_tmpMimeType );
if ( mime->name() != KMimeType::defaultMimeType() )
mimeName = mime->comment();
- d->m_doc->setProperty( "unavailReason", i18n( "No handler found for %1" ).arg( mimeName ) );
+ d->m_doc->setProperty( "unavailReason", i18n( "No handler found for %1" ).tqarg( mimeName ) );
}
return res;
}
@@ -221,19 +221,19 @@ bool KoDocumentChild::loadDocument( KoStore* store )
return loadDocumentInternal( store, e, true /*open url*/, false /*not oasis*/ );
}
-bool KoDocumentChild::loadOasisDocument( KoStore* store, const QDomDocument& manifestDoc )
+bool KoDocumentChild::loadOasisDocument( KoStore* store, const TQDomDocument& manifestDoc )
{
- QString path = m_tmpURL;
+ TQString path = m_tmpURL;
if ( m_tmpURL.startsWith( INTERNAL_PROTOCOL ) ) {
path = store->currentDirectory();
if ( !path.isEmpty() )
path += '/';
- QString relPath = KURL( m_tmpURL ).path();
+ TQString relPath = KURL( m_tmpURL ).path();
path += relPath.mid( 1 ); // remove leading '/'
}
if ( !path.endsWith( "/" ) )
path += '/';
- const QString mimeType = KoOasisStore::mimeForPath( manifestDoc, path );
+ const TQString mimeType = KoOasisStore::mimeForPath( manifestDoc, path );
kdDebug() << k_funcinfo << "path for manifest file=" << path << " mimeType=" << mimeType << endl;
if ( mimeType.isEmpty() ) {
kdError(30003) << "Manifest doesn't have media-type for " << path << endl;
@@ -248,11 +248,11 @@ bool KoDocumentChild::loadOasisDocument( KoStore* store, const QDomDocument& man
if ( res )
{
// Try to turn the mimetype name into its comment
- QString mimeName = mimeType;
+ TQString mimeName = mimeType;
KMimeType::Ptr mime = KMimeType::mimeType( mimeType );
if ( mime->name() != KMimeType::defaultMimeType() )
mimeName = mime->comment();
- d->m_doc->setProperty( "unavailReason", i18n( "No handler found for %1" ).arg( mimeName ) );
+ d->m_doc->setProperty( "unavailReason", i18n( "No handler found for %1" ).tqarg( mimeName ) );
}
return res;
}
@@ -284,7 +284,7 @@ bool KoDocumentChild::loadDocumentInternal( KoStore* store, const KoDocumentEntr
if ( oasis ) {
store->pushDirectory();
assert( m_tmpURL.startsWith( INTERNAL_PROTOCOL ) );
- QString relPath = KURL( m_tmpURL ).path().mid( 1 );
+ TQString relPath = KURL( m_tmpURL ).path().mid( 1 );
store->enterDirectory( relPath );
res = d->m_doc->loadOasisFromStore( store );
store->popDirectory();
@@ -303,10 +303,10 @@ bool KoDocumentChild::loadDocumentInternal( KoStore* store, const KoDocumentEntr
KURL url( m_tmpURL );
if ( !url.isLocalFile() )
{
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
// For security reasons we need to ask confirmation if the url is remote
int result = KMessageBox::warningYesNoCancel(
- 0, i18n( "This document contains an external link to a remote document\n%1").arg(m_tmpURL),
+ 0, i18n( "This document contains an external link to a remote document\n%1").tqarg(m_tmpURL),
i18n( "Confirmation Required" ), i18n( "Download" ), i18n( "Skip" ) );
if ( result == KMessageBox::Cancel )
@@ -324,10 +324,10 @@ bool KoDocumentChild::loadDocumentInternal( KoStore* store, const KoDocumentEntr
if ( !res )
{
// Keep the error message from the attempted loading
- QString errorMessage = d->m_doc->errorMessage();
+ TQString errorMessage = d->m_doc->errorMessage();
delete d->m_doc;
d->m_doc = 0;
- QString tmpURL = m_tmpURL; // keep a copy, createUnavailDocument will erase it
+ TQString tmpURL = m_tmpURL; // keep a copy, createUnavailDocument will erase it
// Not found -> use a kounavail instead
res = createUnavailDocument( store, false /* the URL doesn't exist, don't try to open it */, m_tmpMimeType );
if ( res )
@@ -335,40 +335,40 @@ bool KoDocumentChild::loadDocumentInternal( KoStore* store, const KoDocumentEntr
d->m_doc->setProperty( "realURL", tmpURL ); // so that it gets saved correctly
d->m_doc->setStoreInternal( true );
if ( internalURL )
- d->m_doc->setProperty( "unavailReason", i18n( "Could not load embedded object:\n%1" ).arg( errorMessage ) );
+ d->m_doc->setProperty( "unavailReason", i18n( "Could not load embedded object:\n%1" ).tqarg( errorMessage ) );
else
- d->m_doc->setProperty( "unavailReason", i18n( "Could not load external document %1:\n%2" ).arg( tmpURL, errorMessage ) );
+ d->m_doc->setProperty( "unavailReason", i18n( "Could not load external document %1:\n%2" ).tqarg( tmpURL, errorMessage ) );
}
return res;
}
// Still waiting...
- QApplication::setOverrideCursor( waitCursor );
+ TQApplication::setOverrideCursor( waitCursor );
}
- m_tmpURL = QString::null;
+ m_tmpURL = TQString();
// see KoDocument::insertChild for an explanation what's going on
// now :-)
- if ( parentDocument() )
+ if ( tqparentDocument() )
{
- KoDocument *parent = parentDocument();
+ KoDocument *tqparent = tqparentDocument();
- if ( parent->manager() && parent->manager()->parts() )
+ if ( tqparent->manager() && tqparent->manager()->parts() )
{
- KParts::PartManager *manager = parent->manager();
+ KParts::PartManager *manager = tqparent->manager();
- if ( !manager->parts()->containsRef( d->m_doc ) &&
- !parent->isSingleViewMode() )
+ if ( !manager->parts()->tqcontainsRef( d->m_doc ) &&
+ !tqparent->isSingleViewMode() )
manager->addPart( d->m_doc, false );
}
}
- QApplication::restoreOverrideCursor();
+ TQApplication::restoreOverrideCursor();
return res;
}
-bool KoDocumentChild::createUnavailDocument( KoStore* store, bool doOpenURL, const QString& mimeType )
+bool KoDocumentChild::createUnavailDocument( KoStore* store, bool doOpenURL, const TQString& mimeType )
{
// We don't need a trader query here. We're looking for a very specific component.
KService::Ptr serv = KService::serviceByDesktopName( "kounavail" );
@@ -386,7 +386,7 @@ bool KoDocumentChild::createUnavailDocument( KoStore* store, bool doOpenURL, con
bool KoDocumentChild::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
{
- QString path;
+ TQString path;
if ( d->m_doc->isStoredExtern() )
{
kdDebug(30003)<<k_funcinfo<<" external (don't save) url:" << d->m_doc->url().url()<<endl;
@@ -395,9 +395,9 @@ bool KoDocumentChild::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
else
{
// The name comes from KoDocumentChild (which was set while saving the
- // parent document).
+ // tqparent document).
assert( d->m_doc->url().protocol() == INTERNAL_PROTOCOL );
- const QString name = d->m_doc->url().path();
+ const TQString name = d->m_doc->url().path();
kdDebug() << k_funcinfo << "saving " << name << endl;
if ( d->m_doc->nativeOasisMimeType().isEmpty() ) {
@@ -409,7 +409,7 @@ bool KoDocumentChild::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
}
else
{
- // To make the children happy cd to the correct directory
+ // To make the tqchildren happy cd to the correct directory
store->pushDirectory();
store->enterDirectory( name );
@@ -433,7 +433,7 @@ bool KoDocumentChild::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
// OOo uses a trailing slash for the path to embedded objects (== directories)
if ( !path.endsWith( "/" ) )
path += '/';
- QCString mimetype = d->m_doc->nativeOasisMimeType();
+ TQCString mimetype = d->m_doc->nativeOasisMimeType();
if ( mimetype.isEmpty() )
mimetype = d->m_doc->nativeFormatMimeType();
manifestWriter->addManifestEntry( path, mimetype );
@@ -441,7 +441,7 @@ bool KoDocumentChild::saveOasis( KoStore* store, KoXmlWriter* manifestWriter )
return true;
}
-void KoDocumentChild::saveOasisAttributes( KoXmlWriter &xmlWriter, const QString& name )
+void KoDocumentChild::saveOasisAttributes( KoXmlWriter &xmlWriter, const TQString& name )
{
if ( !d->m_doc->isStoredExtern() )
{
@@ -454,21 +454,21 @@ void KoDocumentChild::saveOasisAttributes( KoXmlWriter &xmlWriter, const QString
d->m_doc->setURL( u );
}
- //<draw:object draw:style-name="standard" draw:id="1" draw:layer="layout" svg:width="14.973cm" svg:height="4.478cm" svg:x="11.641cm" svg:y="14.613cm" xlink:href="#./Object 1" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
+ //<draw:object draw:style-name="standard" draw:id="1" draw:layer="tqlayout" svg:width="14.973cm" svg:height="4.478cm" svg:x="11.641cm" svg:y="14.613cm" xlink:href="#./Object 1" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/>
xmlWriter.addAttribute( "xlink:type", "simple" );
xmlWriter.addAttribute( "xlink:show", "embed" );
xmlWriter.addAttribute( "xlink:actuate", "onLoad" );
- const QString ref = d->m_doc->isStoredExtern() ? d->m_doc->url().url() : "./"+ name;
+ const TQString ref = d->m_doc->isStoredExtern() ? d->m_doc->url().url() : "./"+ name;
kdDebug(30003) << "KoDocumentChild::saveOasis saving reference to embedded document as " << ref << endl;
xmlWriter.addAttribute( "xlink:href", /*"#" + */ref );
}
-QDomElement KoDocumentChild::save( QDomDocument& doc, bool uppercase )
+TQDomElement KoDocumentChild::save( TQDomDocument& doc, bool uppercase )
{
if( d->m_doc )
{
- QDomElement e = doc.createElement( ( uppercase ? "OBJECT" : "object" ) );
+ TQDomElement e = doc.createElement( ( uppercase ? "OBJECT" : "object" ) );
if ( d->m_doc->url().protocol() != INTERNAL_PROTOCOL ) {
e.setAttribute( "url", d->m_doc->url().url() );
kdDebug() << "KoDocumentChild::save url=" << d->m_doc->url().url() << endl;
@@ -477,17 +477,17 @@ QDomElement KoDocumentChild::save( QDomDocument& doc, bool uppercase )
e.setAttribute( "url", d->m_doc->url().path().mid( 1 ) );
kdDebug() << "KoDocumentChild::save url=" << d->m_doc->url().path().mid( 1 ) << endl;
}
- e.setAttribute( "mime", d->m_doc->nativeFormatMimeType() );
+ e.setAttribute( "mime", d->m_doc->nativeFormatMimeType().data() );
kdDebug() << "KoDocumentChild::save mime=" << d->m_doc->nativeFormatMimeType() << endl;
- QDomElement rect = doc.createElement( ( uppercase ? "RECT" : "rect" ) );
- rect.setAttribute( "x", geometry().left() );
- rect.setAttribute( "y", geometry().top() );
- rect.setAttribute( "w", geometry().width() );
- rect.setAttribute( "h", geometry().height() );
+ TQDomElement rect = doc.createElement( ( uppercase ? "RECT" : "rect" ) );
+ rect.setAttribute( "x", tqgeometry().left() );
+ rect.setAttribute( "y", tqgeometry().top() );
+ rect.setAttribute( "w", tqgeometry().width() );
+ rect.setAttribute( "h", tqgeometry().height() );
e.appendChild(rect);
return e;
}
- return QDomElement();
+ return TQDomElement();
}
bool KoDocumentChild::isStoredExtern() const