summaryrefslogtreecommitdiffstats
path: root/kivio/kiviopart/kivio_page.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kivio/kiviopart/kivio_page.cpp')
-rw-r--r--kivio/kiviopart/kivio_page.cpp176
1 files changed, 88 insertions, 88 deletions
diff --git a/kivio/kiviopart/kivio_page.cpp b/kivio/kiviopart/kivio_page.cpp
index 5a4ee2c5..4a8fd51b 100644
--- a/kivio/kiviopart/kivio_page.cpp
+++ b/kivio/kiviopart/kivio_page.cpp
@@ -21,23 +21,23 @@
#include <ctype.h>
#include <math.h>
-#include <qpainter.h>
-#include <qdrawutil.h>
-#include <qkeycode.h>
-#include <qregexp.h>
-#include <qpoint.h>
-#include <qcursor.h>
-#include <qptrstack.h>
-#include <qbuffer.h>
-#include <qmessagebox.h>
-#include <qclipboard.h>
-#include <qpicture.h>
-#include <qdom.h>
-#include <qtextstream.h>
-#include <qdragobject.h>
-#include <qmime.h>
-#include <qsortedlist.h>
-#include <qvaluelist.h>
+#include <tqpainter.h>
+#include <tqdrawutil.h>
+#include <tqkeycode.h>
+#include <tqregexp.h>
+#include <tqpoint.h>
+#include <tqcursor.h>
+#include <tqptrstack.h>
+#include <tqbuffer.h>
+#include <tqmessagebox.h>
+#include <tqclipboard.h>
+#include <tqpicture.h>
+#include <tqdom.h>
+#include <tqtextstream.h>
+#include <tqdragobject.h>
+#include <tqmime.h>
+#include <tqsortedlist.h>
+#include <tqvaluelist.h>
#include <kdebug.h>
#include <klocale.h>
@@ -78,14 +78,14 @@
#include <fixx11h.h> // for None
int KivioPage::s_id = 0L;
-QIntDict<KivioPage>* KivioPage::s_mapPages;
+TQIntDict<KivioPage>* KivioPage::s_mapPages;
-KivioPage::KivioPage( KivioMap *_map, const QString &pageName, const char *_name )
-: QObject( _map, _name ),
+KivioPage::KivioPage( KivioMap *_map, const TQString &pageName, const char *_name )
+: TQObject( _map, _name ),
m_pCurLayer(NULL)
{
if ( s_mapPages == 0L )
- s_mapPages = new QIntDict<KivioPage>;
+ s_mapPages = new TQIntDict<KivioPage>;
m_id = s_id++;
s_mapPages->insert( m_id, this );
@@ -107,7 +107,7 @@ KivioPage::KivioPage( KivioMap *_map, const QString &pageName, const char *_name
setHidden(false);
// Get a unique name so that we can offer scripting
if ( !_name ) {
- QCString s;
+ TQCString s;
s.sprintf("Page%i", s_id );
setName( s.data() );
}
@@ -130,7 +130,7 @@ KivioPage::~KivioPage()
delete m_dcop;
}
-KivioPage* KivioPage::find( int _id )
+KivioPage* KivioPage::tqfind( int _id )
{
if ( !s_mapPages )
return 0L;
@@ -138,27 +138,27 @@ KivioPage* KivioPage::find( int _id )
return (*s_mapPages)[ _id ];
}
-void KivioPage::print( QPainter &/*painter*/, KPrinter */*_printer*/ )
+void KivioPage::print( TQPainter &/*painter*/, KPrinter */*_printer*/ )
{
}
-void KivioPage::printPage( QPainter &/*_painter*/, const QRect& /*page_range*/, const QRect& /*view*/ )
+void KivioPage::printPage( TQPainter &/*_painter*/, const TQRect& /*page_range*/, const TQRect& /*view*/ )
{
}
-QDomElement KivioPage::save( QDomDocument& doc )
+TQDomElement KivioPage::save( TQDomDocument& doc )
{
// Write the name and 'hide' flag first as attributes
- QDomElement page = doc.createElement( "KivioPage" );
+ TQDomElement page = doc.createElement( "KivioPage" );
page.setAttribute( "name", m_strName );
page.setAttribute( "hide", (int)m_bPageHide );
- // Create a child element for the page layout
- QDomElement layoutE = saveLayout( doc );
- page.appendChild( layoutE );
+ // Create a child element for the page tqlayout
+ TQDomElement tqlayoutE = saveLayout( doc );
+ page.appendChild( tqlayoutE );
// Save guides
- QDomElement guidesElement = doc.createElement("GuidesLayout");
+ TQDomElement guidesElement = doc.createElement("GuidesLayout");
page.appendChild(guidesElement);
saveGuideLines(guidesElement);
@@ -166,7 +166,7 @@ QDomElement KivioPage::save( QDomDocument& doc )
KivioLayer *pLayer = m_lstLayers.first();
while( pLayer )
{
- QDomElement layerE = pLayer->saveXML(doc);
+ TQDomElement layerE = pLayer->saveXML(doc);
if( layerE.isNull() )
{
kdDebug(43000) << "KivioPage::save() - Oh shit. KivioLayer::saveXML() returned a bad element!" << endl;
@@ -191,20 +191,20 @@ void KivioPage::saveOasis(KoStore* /*store*/, KoXmlWriter* docWriter, KoGenStyle
docWriter->addAttribute("draw:master-page-name", "Standard");
} else {
KoGenStyle pageLayout = m_pPageLayout.saveOasis();
- QString layoutName = styles->lookup(pageLayout, "PL");
+ TQString tqlayoutName = styles->lookup(pageLayout, "PL");
KoGenStyle masterPage(KoGenStyle::STYLE_MASTER);
- masterPage.addAttribute("style:page-layout-name", layoutName);
- QString masterName = styles->lookup(masterPage, "MP");
+ masterPage.addAttribute("style:page-tqlayout-name", tqlayoutName);
+ TQString masterName = styles->lookup(masterPage, "MP");
docWriter->addAttribute("draw:master-page-name", masterName);
}
// TODO OASIS: Save guidelines!
- QBuffer layerBuffer;
+ TQBuffer layerBuffer;
layerBuffer.open(IO_WriteOnly);
- KoXmlWriter layerWriter(&layerBuffer);
+ KoXmlWriter layerWriter(TQT_TQIODEVICE(&layerBuffer));
layerWriter.startElement("draw:layer-set");
// Iterate through all layers
@@ -216,24 +216,24 @@ void KivioPage::saveOasis(KoStore* /*store*/, KoXmlWriter* docWriter, KoGenStyle
}
layerWriter.endElement(); // draw:layer-set
- QString layerSet = QString::fromUtf8(layerBuffer.buffer(), layerBuffer.buffer().size());
+ TQString layerSet = TQString::fromUtf8(layerBuffer.buffer(), layerBuffer.buffer().size());
KoGenStyle pageStyle(Kivio::STYLE_PAGE, "drawing-page");
pageStyle.addChildElement("draw:layer-set", layerSet);
- QString styleName = styles->lookup(pageStyle, "PS");
+ TQString styleName = styles->lookup(pageStyle, "PS");
docWriter->addAttribute("draw:style-name", styleName);
docWriter->endElement(); // draw:page
}
-QDomElement KivioPage::saveLayout( QDomDocument &doc )
+TQDomElement KivioPage::saveLayout( TQDomDocument &doc )
{
- QDomElement e = doc.createElement("PageLayout");
+ TQDomElement e = doc.createElement("PageLayout");
Kivio::savePageLayout(e, m_pPageLayout);
return e;
}
-bool KivioPage::loadLayout( const QDomElement &e )
+bool KivioPage::loadLayout( const TQDomElement &e )
{
m_pPageLayout = Kivio::loadPageLayout(e);
return true;
@@ -244,7 +244,7 @@ bool KivioPage::isLoading()
return m_pDoc->isLoading();
}
-bool KivioPage::loadXML( const QDomElement& pageE )
+bool KivioPage::loadXML( const TQDomElement& pageE )
{
m_strName = pageE.attribute("name");
if (m_strName.isEmpty())
@@ -257,7 +257,7 @@ bool KivioPage::loadXML( const QDomElement& pageE )
KivioLayer *pLayer;
m_lstLayers.clear();
- QDomNode node = pageE.firstChild();
+ TQDomNode node = pageE.firstChild();
while( !node.isNull() )
{
if( node.nodeName() == "KivioLayer" )
@@ -306,7 +306,7 @@ bool KivioPage::loadXML( const QDomElement& pageE )
kdDebug(43000) << "KivioLayer::loadXML() - loading layer connections" << endl;
pLayer->searchForConnections(this);
- m_lstLayers.find( pLayerBak );
+ m_lstLayers.tqfind( pLayerBak );
pLayer = m_lstLayers.next();
}
@@ -314,39 +314,39 @@ bool KivioPage::loadXML( const QDomElement& pageE )
return true;
}
-bool KivioPage::loadOasis(const QDomElement& page, KoOasisStyles& oasisStyles)
+bool KivioPage::loadOasis(const TQDomElement& page, KoOasisStyles& oasisStyles)
{
- m_strName = page.attributeNS( KoXmlNS::draw, "name", QString::null);
- QDomElement* masterPage = oasisStyles.masterPages()[page.attributeNS( KoXmlNS::draw, "master-page-name", QString::null)];
+ m_strName = page.attributeNS( KoXmlNS::draw, "name", TQString());
+ TQDomElement* masterPage = oasisStyles.masterPages()[page.attributeNS( KoXmlNS::draw, "master-page-name", TQString())];
if(!masterPage) {
- kdDebug(430000) << "Couldn't find the master page! " << page.attributeNS( KoXmlNS::draw, "master-page-name", QString::null) << endl;
+ kdDebug(430000) << "Couldn't find the master page! " << page.attributeNS( KoXmlNS::draw, "master-page-name", TQString()) << endl;
return false;
}
- const QDomElement *pageLayout = oasisStyles.findStyle(masterPage->attributeNS( KoXmlNS::style, "page-layout-name", QString::null ) );
+ const TQDomElement *pageLayout = oasisStyles.findStyle(masterPage->attributeNS( KoXmlNS::style, "page-tqlayout-name", TQString() ) );
if(!pageLayout) {
- kdDebug(430000) << "Couldn't find the pagelayout!" << endl;
+ kdDebug(430000) << "Couldn't find the pagetqlayout!" << endl;
return false;
}
m_pPageLayout.loadOasis(*pageLayout);
if(m_pPageLayout.ptWidth <= 1e-13 || m_pPageLayout.ptHeight <= 1e-13) {
- kdDebug(430000) << "Non valid pagelayout!" << endl;
+ kdDebug(430000) << "Non valid pagetqlayout!" << endl;
return false;
}
- const QDomElement* style = oasisStyles.findStyle(page.attributeNS( KoXmlNS::draw, "style-name", QString::null) ); // Find the page style
+ const TQDomElement* style = oasisStyles.findStyle(page.attributeNS( KoXmlNS::draw, "style-name", TQString()) ); // Find the page style
if(!style) {
return false;
}
- QDomNode styleNode = KoDom::namedItemNS( *style, KoXmlNS::style, "properties");
+ TQDomNode styleNode = KoDom::namedItemNS( *style, KoXmlNS::style, "properties");
styleNode = KoDom::namedItemNS( styleNode, KoXmlNS::draw, "layer-set");
- QDomNode currentNode = styleNode.firstChild();
+ TQDomNode currentNode = styleNode.firstChild();
// Load the layers
while(!currentNode.isNull()) {
@@ -366,7 +366,7 @@ void KivioPage::update()
{
}
-KivioPage* KivioPage::findPage( const QString& name )
+KivioPage* KivioPage::findPage( const TQString& name )
{
if (!m_pMap)
return 0L;
@@ -374,7 +374,7 @@ KivioPage* KivioPage::findPage( const QString& name )
return m_pMap->findPage(name);
}
-bool KivioPage::setPageName( const QString& name, bool init )
+bool KivioPage::setPageName( const TQString& name, bool init )
{
if ( map()->findPage( name ) )
return false;
@@ -382,7 +382,7 @@ bool KivioPage::setPageName( const QString& name, bool init )
if ( m_strName == name )
return true;
- QString old_name = m_strName;
+ TQString old_name = m_strName;
m_strName = name;
if (init)
@@ -399,8 +399,8 @@ bool KivioPage::setPageName( const QString& name, bool init )
* An important note is that layers are drawn first to last. So the last layer is the
* most visible.
*/
-void KivioPage::paintContent( KivioPainter& painter, const QRect& rect, bool transparent,
- QPoint p0, KoZoomHandler* zoom, bool drawConnectorTargets, bool drawSelection )
+void KivioPage::paintContent( KivioPainter& painter, const TQRect& rect, bool transparent,
+ TQPoint p0, KoZoomHandler* zoom, bool drawConnectorTargets, bool drawSelection )
{
KivioLayer *pLayer = m_lstLayers.first();
while( pLayer )
@@ -560,7 +560,7 @@ void KivioPage::selectStencil( KivioStencil *pStencil )
}
// Don't allow reselection
- if(m_lstSelection.findRef(pStencil) != -1) {
+ if(m_lstSelection.tqfindRef(pStencil) != -1) {
return;
}
@@ -631,7 +631,7 @@ void KivioPage::unselectAllStencils()
bool KivioPage::isStencilSelected(KivioStencil *pStencil)
{
- return m_lstSelection.findRef( pStencil ) == -1;
+ return m_lstSelection.tqfindRef( pStencil ) == -1;
}
/**
@@ -769,8 +769,8 @@ void KivioPage::groupSelectedStencils()
void KivioPage::ungroupSelectedStencils()
{
KivioStencil *pSelStencil, *pStencil;
- QPtrList<KivioStencil> *pList;
- QPtrList<KivioStencil> *pSelectThese = new QPtrList<KivioStencil>;
+ TQPtrList<KivioStencil> *pList;
+ TQPtrList<KivioStencil> *pSelectThese = new TQPtrList<KivioStencil>;
KMacroCommand* macro = new KMacroCommand(i18n("Ungroup"));
bool ungrouped = false;
@@ -842,7 +842,7 @@ void KivioPage::bringToFront()
KivioStencil *pStencil, *pMove;
KivioLayer *pLayer;
- QPtrList <KivioStencil> newList;
+ TQPtrList <KivioStencil> newList;
pLayer = m_pCurLayer;
@@ -889,7 +889,7 @@ void KivioPage::sendToBack()
KivioStencil *pStencil, *pMove;
KivioLayer *pLayer;
- QPtrList <KivioStencil> newList;
+ TQPtrList <KivioStencil> newList;
pLayer = m_pCurLayer;
@@ -941,7 +941,7 @@ void KivioPage::copy()
KivioDragObject* kdo = new KivioDragObject();
kdo->setStencilList(m_lstSelection);
kdo->setStencilRect(getRectForAllSelectedStencils());
- QApplication::clipboard()->setData(kdo, QClipboard::Clipboard);
+ TQApplication::tqclipboard()->setData(kdo, TQClipboard::Clipboard);
}
void KivioPage::cut()
@@ -983,11 +983,11 @@ void KivioPage::cut()
void KivioPage::paste(KivioView* view)
{
- QPtrList<KivioStencil> list;
+ TQPtrList<KivioStencil> list;
list.setAutoDelete(false);
KivioDragObject kdo;
- if(kdo.decode(QApplication::clipboard()->data(QClipboard::Clipboard), list, this)) {
+ if(kdo.decode(TQApplication::tqclipboard()->data(TQClipboard::Clipboard), list, this)) {
unselectAllStencils();
KivioStencil* stencil = list.first();
@@ -1049,7 +1049,7 @@ bool KivioPage::removeCurrentLayer()
if( pLayer != m_pCurLayer )
{
- if( m_lstLayers.find( m_pCurLayer )==false )
+ if( m_lstLayers.tqfind( m_pCurLayer )==false )
{
kdDebug(43000) << "KivioLayer::removeCurrentLayer() - Couldn't find current layer in the list. Bad!" << endl;
return false;
@@ -1069,7 +1069,7 @@ bool KivioPage::removeCurrentLayer()
return false;
}
- KivioRemoveLayerCommand * cmd = new KivioRemoveLayerCommand( i18n("Remove Layer"), this , m_pCurLayer , m_lstLayers.findRef(m_pCurLayer) );
+ KivioRemoveLayerCommand * cmd = new KivioRemoveLayerCommand( i18n("Remove Layer"), this , m_pCurLayer , m_lstLayers.tqfindRef(m_pCurLayer) );
doc()->addCommand( cmd );
takeLayer( m_pCurLayer );
/*
@@ -1087,7 +1087,7 @@ bool KivioPage::removeCurrentLayer()
void KivioPage::takeLayer( KivioLayer *pLayer )
{
- int pos=m_lstLayers.findRef(pLayer);
+ int pos=m_lstLayers.tqfindRef(pLayer);
m_lstLayers.take( pos );
}
@@ -1183,13 +1183,13 @@ void KivioPage::alignStencils(AlignData d)
}
}
-class XYSortedStencilList : public QPtrList<KivioStencil>
+class XYSortedStencilList : public TQPtrList<KivioStencil>
{
public:
XYSortedStencilList(bool sortX) :xsort(sortX) {};
protected:
- int compareItems(QPtrCollection::Item i1, QPtrCollection::Item i2)
+ int compareItems(TQPtrCollection::Item i1, TQPtrCollection::Item i2)
{
KivioStencil* s1 = (KivioStencil*)i1;
KivioStencil* s2 = (KivioStencil*)i2;
@@ -1225,7 +1225,7 @@ void KivioPage::distributeStencils(DistributeData d)
XYSortedStencilList xSortList(true);
XYSortedStencilList ySortList(false);
- QValueList<KoRect> oldRects;
+ TQValueList<KoRect> oldRects;
while( pStencil )
{
@@ -1252,10 +1252,10 @@ void KivioPage::distributeStencils(DistributeData d)
y1 = y + pStencil->h();
while( pStencil )
{
- x = QMIN(x,pStencil->x());
- y = QMIN(y,pStencil->y());
- x1 = QMAX(x1,pStencil->x() + pStencil->w());
- y1 = QMAX(y1,pStencil->y() + pStencil->h());
+ x = TQMIN(x,pStencil->x());
+ y = TQMIN(y,pStencil->y());
+ x1 = TQMAX(x1,pStencil->x() + pStencil->w());
+ y1 = TQMAX(y1,pStencil->y() + pStencil->h());
pStencil = m_lstSelection.next();
}
break;
@@ -1414,7 +1414,7 @@ void KivioPage::distributeStencils(DistributeData d)
if(d.v != DistributeData::None || d.h != DistributeData::None) {
KMacroCommand *macro = new KMacroCommand(i18n("Move Stencil"));
- QValueListIterator<KoRect> it;
+ TQValueListIterator<KoRect> it;
pStencil = m_lstSelection.first();
for(it = oldRects.begin(); it != oldRects.end(); ++it) {
@@ -1624,19 +1624,19 @@ bool KivioPage::checkForTextBoxesInSelection()
return false;
}
-void KivioPage::setGuideLines(const QValueList<double> hGuideLines, const QValueList<double> vGuideLines)
+void KivioPage::setGuideLines(const TQValueList<double> hGuideLines, const TQValueList<double> vGuideLines)
{
m_hGuideLines = hGuideLines;
m_vGuideLines = vGuideLines;
}
-void KivioPage::saveGuideLines(QDomElement& element)
+void KivioPage::saveGuideLines(TQDomElement& element)
{
- QValueList<double>::iterator it;
- QValueList<double>::iterator itEnd = m_hGuideLines.end();
+ TQValueList<double>::iterator it;
+ TQValueList<double>::iterator itEnd = m_hGuideLines.end();
for(it = m_hGuideLines.begin(); it != itEnd; ++it) {
- QDomElement e = element.ownerDocument().createElement("Guideline");
+ TQDomElement e = element.ownerDocument().createElement("Guideline");
element.appendChild(e);
XmlWriteDouble(e, "pos", *it);
XmlWriteInt(e, "orient", (int)Qt::Horizontal);
@@ -1645,19 +1645,19 @@ void KivioPage::saveGuideLines(QDomElement& element)
itEnd = m_vGuideLines.end();
for(it = m_vGuideLines.begin(); it != itEnd; ++it) {
- QDomElement e = element.ownerDocument().createElement("Guideline");
+ TQDomElement e = element.ownerDocument().createElement("Guideline");
element.appendChild(e);
XmlWriteDouble(e, "pos", *it);
XmlWriteInt(e, "orient", (int)Qt::Vertical);
}
}
-void KivioPage::loadGuideLines(const QDomElement& element)
+void KivioPage::loadGuideLines(const TQDomElement& element)
{
m_hGuideLines.clear();
m_vGuideLines.clear();
- QDomElement e = element.firstChild().toElement();
+ TQDomElement e = element.firstChild().toElement();
for( ; !e.isNull(); e = e.nextSibling().toElement() )
{