summaryrefslogtreecommitdiffstats
path: root/kword/KWFrameViewManager.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 /kword/KWFrameViewManager.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 'kword/KWFrameViewManager.cpp')
-rw-r--r--kword/KWFrameViewManager.cpp137
1 files changed, 64 insertions, 73 deletions
diff --git a/kword/KWFrameViewManager.cpp b/kword/KWFrameViewManager.cpp
index 2e09ff5f..168a5d7c 100644
--- a/kword/KWFrameViewManager.cpp
+++ b/kword/KWFrameViewManager.cpp
@@ -23,12 +23,12 @@
#include <kdebug.h>
#include <kcursor.h>
-#include <qcursor.h>
-#include <qtimer.h>
-#include "qpopupmenu.h"
+#include <tqcursor.h>
+#include <tqtimer.h>
+#include "tqpopupmenu.h"
#include <algorithm>
-KWFrameViewManager::KWFrameViewManager() : QObject() {
+KWFrameViewManager::KWFrameViewManager() : TQObject() {
setName("KWFrameViewManager");
m_queueRequested = false;
m_blockEvents = false;
@@ -37,19 +37,19 @@ KWFrameViewManager::KWFrameViewManager() : QObject() {
KWFrameViewManager::KWFrameViewManager(KWDocument *doc) {
m_queueRequested = false;
m_blockEvents = true;
- QPtrListIterator<KWFrameSet> frameSets = doc->framesetsIterator();
+ TQPtrListIterator<KWFrameSet> frameSets = doc->framesetsIterator();
while(frameSets.current()) {
slotFrameSetAdded(*frameSets);
++frameSets;
}
m_blockEvents = false;
- connect(doc, SIGNAL( sigFrameSetAdded(KWFrameSet*)), SLOT( slotFrameSetAdded(KWFrameSet*)));
- connect(doc, SIGNAL( sigFrameSetRemoved(KWFrameSet*)), SLOT( slotFrameSetRemoved(KWFrameSet*)));
+ connect(doc, TQT_SIGNAL( sigFrameSetAdded(KWFrameSet*)), TQT_SLOT( slotFrameSetAdded(KWFrameSet*)));
+ connect(doc, TQT_SIGNAL( sigFrameSetRemoved(KWFrameSet*)), TQT_SLOT( slotFrameSetRemoved(KWFrameSet*)));
recalculateFrameCache();
}
KWFrameViewManager::~KWFrameViewManager() {
- QValueListIterator<FrameEvent *> events = m_frameEvents.begin();
+ TQValueListIterator<FrameEvent *> events = m_frameEvents.begin();
while(events != m_frameEvents.end()) {
delete (*events);
++events;
@@ -66,10 +66,10 @@ void KWFrameViewManager::removeKWFramesListener(KWFramesListener *listener) {
void KWFrameViewManager::slotFrameSetAdded(KWFrameSet *fs) {
if(! m_blockEvents)
m_frameEvents.append(new FrameEvent(FrameEvent::FrameSetAdded, fs));
- connect(fs, SIGNAL( sigFrameAdded(KWFrame*)), SLOT( slotFrameAdded(KWFrame *)));
- connect(fs, SIGNAL( sigFrameRemoved(KWFrame*)), SLOT( slotFrameRemoved(KWFrame *)));
- connect(fs, SIGNAL( sigNameChanged(KWFrameSet*)), SLOT( slotFrameSetRenamed(KWFrameSet *)));
- QPtrListIterator<KWFrame> frames = fs->frameIterator();
+ connect(fs, TQT_SIGNAL( sigFrameAdded(KWFrame*)), TQT_SLOT( slotFrameAdded(KWFrame *)));
+ connect(fs, TQT_SIGNAL( sigFrameRemoved(KWFrame*)), TQT_SLOT( slotFrameRemoved(KWFrame *)));
+ connect(fs, TQT_SIGNAL( sigNameChanged(KWFrameSet*)), TQT_SLOT( slotFrameSetRenamed(KWFrameSet *)));
+ TQPtrListIterator<KWFrame> frames = fs->frameIterator();
while(frames.current()) {
KWFrame *f = frames.current();
slotFrameAdded(f);
@@ -80,10 +80,10 @@ void KWFrameViewManager::slotFrameSetAdded(KWFrameSet *fs) {
void KWFrameViewManager::slotFrameSetRemoved(KWFrameSet *fs) {
if(! m_blockEvents)
m_frameEvents.append(new FrameEvent(FrameEvent::FrameSetRemoved, fs));
- disconnect(fs, SIGNAL( sigFrameAdded(KWFrame*)), this, SLOT( slotFrameAdded(KWFrame *)));
- disconnect(fs, SIGNAL( sigFrameRemoved(KWFrame*)), this, SLOT( slotFrameRemoved(KWFrame *)));
- disconnect(fs, SIGNAL( sigNameChanged(KWFrameSet*)), this, SLOT( slotFrameSetRenamed(KWFrameSet *)));
- QPtrListIterator<KWFrame> frames = fs->frameIterator();
+ disconnect(fs, TQT_SIGNAL( sigFrameAdded(KWFrame*)), this, TQT_SLOT( slotFrameAdded(KWFrame *)));
+ disconnect(fs, TQT_SIGNAL( sigFrameRemoved(KWFrame*)), this, TQT_SLOT( slotFrameRemoved(KWFrame *)));
+ disconnect(fs, TQT_SIGNAL( sigNameChanged(KWFrameSet*)), this, TQT_SLOT( slotFrameSetRenamed(KWFrameSet *)));
+ TQPtrListIterator<KWFrame> frames = fs->frameIterator();
while(frames.current()) {
KWFrame *f = frames.current();
slotFrameRemoved(f);
@@ -100,7 +100,7 @@ void KWFrameViewManager::slotFrameAdded(KWFrame *f) {
void KWFrameViewManager::slotFrameRemoved(KWFrame *f) {
if(! m_blockEvents)
m_frameEvents.append(new FrameEvent(FrameEvent::FrameRemoved, f));
- QValueListIterator<KWFrameView *> frames = m_frames.begin();
+ TQValueListIterator<KWFrameView *> frames = m_frames.begin();
while(frames != m_frames.end()) {
KWFrameView *fv = *frames;
if(fv->frame() == f) {
@@ -145,7 +145,7 @@ void KWFrameViewManager::requestFireEvents() {
if(m_queueRequested && !m_blockEvents)
return;
m_queueRequested = true;
- QTimer::singleShot ( 0, this, SLOT(fireEvents()) );
+ TQTimer::singleShot ( 0, this, TQT_SLOT(fireEvents()) );
}
void KWFrameViewManager::fireEvents() {
@@ -154,15 +154,15 @@ void KWFrameViewManager::fireEvents() {
return;
recalculateFrameCache();
- QValueList<FrameEvent *> copy(m_frameEvents);
+ TQValueList<FrameEvent *> copy(m_frameEvents);
m_frameEvents.clear();
- QValueList<KWFrame*> resizedFrames;
- QValueList<KWFrame*> movedFrames;
- QValueList<KWFramesListener *> listenersCopy(m_framesListener);
+ TQValueList<KWFrame*> resizedFrames;
+ TQValueList<KWFrame*> movedFrames;
+ TQValueList<KWFramesListener *> listenersCopy(m_framesListener);
bool selectionChangedFired=false;
- QValueListIterator<FrameEvent *> events = copy.begin();
+ TQValueListIterator<FrameEvent *> events = copy.begin();
while(events != copy.end()) {
FrameEvent *event = *events;
@@ -171,7 +171,7 @@ void KWFrameViewManager::fireEvents() {
emit sigFrameSelectionChanged();
selectionChangedFired = true; // only fire ones.
} else if(event->m_action == FrameEvent::FrameSetRenamed) {
- QPtrListIterator<KWFrame> frames = event->m_frameSet->frameIterator();
+ TQPtrListIterator<KWFrame> frames = event->m_frameSet->frameIterator();
for(;frames.current();++frames) {
if(view(frames.current())->selected()) {
emit sigFrameSetRenamed();
@@ -185,7 +185,7 @@ void KWFrameViewManager::fireEvents() {
}
// listener based
- QValueListIterator<KWFramesListener *> listeners = listenersCopy.begin();
+ TQValueListIterator<KWFramesListener *> listeners = listenersCopy.begin();
while(listeners != listenersCopy.end()) {
if(event->m_action == FrameEvent::FrameRemoved)
(*listeners)->frameRemoved(event->m_frame);
@@ -214,9 +214,9 @@ void KWFrameViewManager::recalculateFrameCache() {
}
KWFrameView *KWFrameViewManager::view(const KoPoint &point, SelectionType selected, bool borderOnly) const {
- QValueVector<KWFrameView*> framesThatAreHit = framesAt(point, borderOnly);
+ TQValueVector<KWFrameView*> framesThatAreHit = framesAt(point, borderOnly);
bool foundCycleFrame = false;
- QValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
+ TQValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
while(sortedFrames != framesThatAreHit.end()) {
if(selected == nextUnselected) {
if((*sortedFrames)->selected() )
@@ -237,15 +237,15 @@ KWFrameView *KWFrameViewManager::view(const KoPoint &point, SelectionType select
return 0;
}
-QValueVector<KWFrameView*> KWFrameViewManager::framesAt(const KoPoint &point, bool borderOnly) const {
- QValueVector<KWFrameView*> framesThatAreHit;
+TQValueVector<KWFrameView*> KWFrameViewManager::framesAt(const KoPoint &point, bool borderOnly) const {
+ TQValueVector<KWFrameView*> framesThatAreHit;
// This is probably the slowest and worst way to do it, mark this for optimalisation!
- for(QValueListConstIterator<KWFrameView*> frames = m_frames.begin();
+ for(TQValueListConstIterator<KWFrameView*> frames = m_frames.begin();
frames != m_frames.end(); ++frames) {
if(! (*frames)->frame()->frameSet()->isVisible())
continue;
if(borderOnly && (*frames)->isBorderHit(point) ||
- !borderOnly && (*frames)->contains(point))
+ !borderOnly && (*frames)->tqcontains(point))
framesThatAreHit.append(*frames);
}
// sort on z-ordering; top on first
@@ -255,7 +255,7 @@ QValueVector<KWFrameView*> KWFrameViewManager::framesAt(const KoPoint &point, bo
KWFrameView *KWFrameViewManager::view(const KWFrame *frame) const {
// This is probably the slowest and worst way to do it, mark this for optimalisation!
- QValueListConstIterator<KWFrameView*> frames = m_frames.begin();
+ TQValueListConstIterator<KWFrameView*> frames = m_frames.begin();
while(frames != m_frames.end()) {
if((*frames)->frame() == frame)
return *frames;
@@ -268,10 +268,10 @@ bool KWFrameViewManager::compareFrameViewZOrder(KWFrameView *f1, KWFrameView *f2
return f1->frame()->zOrder() >= f2->frame()->zOrder();
}
-QCursor KWFrameViewManager::mouseCursor( const KoPoint &point, int keyState ) const {
+TQCursor KWFrameViewManager::mouseCursor( const KoPoint &point, int keyState ) const {
KWFrameView *view = 0;
- QValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
- QValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
+ TQValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
+ TQValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
MouseMeaning meaning;
while(sortedFrames != framesThatAreHit.end()) {
meaning = (*sortedFrames)->mouseMeaning(point, keyState);
@@ -283,65 +283,56 @@ QCursor KWFrameViewManager::mouseCursor( const KoPoint &point, int keyState ) co
}
if(view == 0)
- return QCursor(); // default arrow shape
+ return TQCursor(); // default arrow tqshape
KWFrameSet*frameSet = view->frame()->frameSet();
switch ( meaning ) {
case MEANING_NONE:
- return Qt::ibeamCursor; // default cursor in margins
+ return TQt::ibeamCursor; // default cursor in margins
case MEANING_MOUSE_INSIDE:
- return QCursor(); // default arrow shape
+ return TQCursor(); // default arrow tqshape
case MEANING_MOUSE_INSIDE_TEXT:
- return Qt::ibeamCursor;
+ return TQt::ibeamCursor;
case MEANING_MOUSE_OVER_LINK:
- return Qt::PointingHandCursor;
+ return TQt::PointingHandCursor;
case MEANING_MOUSE_OVER_FOOTNOTE:
- return Qt::PointingHandCursor;
+ return TQt::PointingHandCursor;
case MEANING_MOUSE_MOVE:
- return Qt::sizeAllCursor;
+ return TQt::sizeAllCursor;
case MEANING_MOUSE_SELECT:
return KCursor::handCursor();
case MEANING_ACTIVATE_PART:
return KCursor::handCursor();
case MEANING_TOPLEFT:
case MEANING_BOTTOMRIGHT:
- return Qt::sizeFDiagCursor;
+ return TQt::sizeFDiagCursor;
case MEANING_LEFT:
case MEANING_RIGHT:
- return Qt::sizeHorCursor;
+ return TQt::sizeHorCursor;
case MEANING_BOTTOMLEFT:
case MEANING_TOPRIGHT:
- return Qt::sizeBDiagCursor;
+ return TQt::sizeBDiagCursor;
case MEANING_TOP:
case MEANING_BOTTOM:
if ( frameSet->isProtectSize() || frameSet->isMainFrameset())
- return Qt::forbiddenCursor;
- return Qt::sizeVerCursor;
+ return TQt::forbiddenCursor;
+ return TQt::sizeVerCursor;
case MEANING_RESIZE_COLUMN:
- // Bug in Qt up to Qt-3.1.1 : Qt::splitVCursor and Qt::splitHCursor are swapped!
-#if QT_VERSION <= 0x030101
- return Qt::splitVCursor;
-#else
- return Qt::splitHCursor;
-#endif
+ return TQt::splitHCursor;
case MEANING_RESIZE_ROW:
-#if QT_VERSION <= 0x030101
- return Qt::splitHCursor;
-#else
- return Qt::splitVCursor;
-#endif
+ return TQt::splitVCursor;
case MEANING_SELECT_RANGE:
case MEANING_SELECT_COLUMN:
case MEANING_SELECT_ROW:
case MEANING_FORBIDDEN:
return KCursor::handCursor();
}
- return QCursor(); // default arrow shape
+ return TQCursor(); // default arrow tqshape
}
MouseMeaning KWFrameViewManager::mouseMeaning( const KoPoint &point, int keyState) const {
- QValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
- QValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
+ TQValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
+ TQValueVector<KWFrameView*>::iterator sortedFrames = framesThatAreHit.begin();
while(sortedFrames != framesThatAreHit.end()) {
MouseMeaning answer = (*sortedFrames)->mouseMeaning(point, keyState);
if(answer != MEANING_NONE) {
@@ -353,10 +344,10 @@ MouseMeaning KWFrameViewManager::mouseMeaning( const KoPoint &point, int keyStat
return MEANING_NONE;
}
-QValueList<KWFrameView*> KWFrameViewManager::selectedFrames() const {
- QValueList<KWFrameView*> selectedFrames;
+TQValueList<KWFrameView*> KWFrameViewManager::selectedFrames() const {
+ TQValueList<KWFrameView*> selectedFrames;
- QValueList<KWFrameView*>::const_iterator frames = m_frames.begin();
+ TQValueList<KWFrameView*>::const_iterator frames = m_frames.begin();
for(; frames != m_frames.end(); ++frames )
if( (*frames)->selected() )
selectedFrames.append( *frames );
@@ -364,27 +355,27 @@ QValueList<KWFrameView*> KWFrameViewManager::selectedFrames() const {
}
KWFrameView* KWFrameViewManager::selectedFrame() const {
- QValueList<KWFrameView*>::const_iterator frames = m_frames.begin();
+ TQValueList<KWFrameView*>::const_iterator frames = m_frames.begin();
for(; frames != m_frames.end(); ++frames )
if( (*frames)->selected() )
return *frames;
return 0;
}
-void KWFrameViewManager::showPopup( const KoPoint &point, KWView *view, int keyState, const QPoint &popupPoint) const {
- QValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
+void KWFrameViewManager::showPopup( const KoPoint &point, KWView *view, int keyState, const TQPoint &popupPoint) const {
+ TQValueVector<KWFrameView*> framesThatAreHit = framesAt(point);
if(framesThatAreHit.count() == 0) {
view->popupMenu("action_popup")->popup(popupPoint);
return;
}
- if(keyState == Qt::ControlButton) {
+ if(keyState == TQt::ControlButton) {
// show the border popup of the top most frame.
framesThatAreHit[0]->showPopup(framesThatAreHit[0]->frame()->topLeft(), view, popupPoint);
return;
}
- QValueVector<KWFrameView*>::iterator iter = framesThatAreHit.begin();
+ TQValueVector<KWFrameView*>::iterator iter = framesThatAreHit.begin();
while(iter != framesThatAreHit.end()) {
- if( (*iter)->selected() && keyState == Qt::ControlButton ) {
+ if( (*iter)->selected() && keyState == TQt::ControlButton ) {
(*iter)->showPopup(point, view, popupPoint);
return;
}
@@ -395,18 +386,18 @@ void KWFrameViewManager::showPopup( const KoPoint &point, KWView *view, int keyS
void KWFrameViewManager::selectFrames(const KoPoint &point, int keyState, bool leftClick) {
MouseMeaning mm = mouseMeaning(point, keyState);
- bool multiSelect = mm == MEANING_MOUSE_SELECT || ( keyState & Qt::ControlButton );
+ bool multiSelect = mm == MEANING_MOUSE_SELECT || ( keyState & TQt::ControlButton );
SelectionType se = frameOnTop;
if(leftClick && multiSelect)
se = nextUnselected;
KWFrameView *toBeSelected = view(point, se, !multiSelect);
//kdDebug() << "KWFrameViewManager::selectFrames" << point << " got: " << toBeSelected << endl;
- if(toBeSelected == 0 || (keyState & Qt::ControlButton) == 0 || ( keyState & Qt::ShiftButton ) &&
+ if(toBeSelected == 0 || (keyState & TQt::ControlButton) == 0 || ( keyState & TQt::ShiftButton ) &&
!(leftClick && (mm == MEANING_TOPLEFT || mm == MEANING_TOPRIGHT || mm == MEANING_TOP ||
mm == MEANING_LEFT || mm == MEANING_RIGHT || mm == MEANING_MOUSE_MOVE ||
mm == MEANING_BOTTOMLEFT || mm == MEANING_BOTTOM || mm == MEANING_BOTTOMRIGHT))) {
// unselect all
- for(QValueListConstIterator<KWFrameView*> frames = m_frames.begin();
+ for(TQValueListConstIterator<KWFrameView*> frames = m_frames.begin();
frames != m_frames.end(); ++frames) {
(*frames)->setSelected(false);
}