kword

KWDocStruct.cpp

00001 /* This file is part of the KDE project
00002    Copyright (C) 1998, 1999 Reginald Stadlbauer <reggie@kde.org>
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License as published by the Free Software Foundation; either
00007    version 2 of the License, or (at your option) any later version.
00008 
00009    This library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public License
00015    along with this library; see the file COPYING.LIB.  If not, write to
00016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018 */
00019 
00020 // KWord includes.
00021 #include "KWDocument.h"
00022 #include "KWView.h"
00023 #include "KWCanvas.h"
00024 #include "KWDocStruct.h"
00025 #include "KWDocStruct.moc"
00026 #include "KWTableFrameSet.h"
00027 #include "KWPartFrameSet.h"
00028 #include "KWFormulaFrameSet.h"
00029 #include "KWPictureFrameSet.h"
00030 #include "KWTextDocument.h"
00031 
00032 // KOffice includes.
00033 #include <KoParagCounter.h>
00034 #include <KoSpeaker.h>
00035 
00036 // KDE includes.
00037 #include <klocale.h>
00038 #include <kiconloader.h>
00039 #include <kdebug.h>
00040 #include <klistviewsearchline.h>
00041 #include <kglobalsettings.h>
00042 #include <kglobal.h>
00043 #include <kpixmap.h>
00044 #include <ktoolbar.h>
00045 #include <ktoolbarbutton.h>
00046 
00047 #include <qlayout.h>
00048 
00049 /******************************************************************/
00050 /* Class: KWOrderedFrameSet                                       */
00051 /******************************************************************/
00052 
00053 KWOrderedFrameSet::KWOrderedFrameSet(KWFrameSet* fs) :
00054     m_frameset(fs) { }
00055 
00056 KWOrderedFrameSet::KWOrderedFrameSet() :
00057     m_frameset(0) { }
00058 
00059 bool KWOrderedFrameSet::operator<( KWOrderedFrameSet ofs )
00060 {
00061     if (!m_frameset) return false;
00062     KWFrame* frame1 = m_frameset->frame(0);
00063     if (!frame1) return false;
00064     KWFrameSet* frameset2 = ofs.frameSet();
00065     if (!frameset2) return false;
00066     KWFrame* frame2 = frameset2->frame(0);
00067     if (!frame2) return false;
00068     KoPoint p1 = frame1->topLeft();
00069     KoPoint p2 = frame2->topLeft();
00070     return (p1.y() < p2.y() || (p1.y() == p2.y() && p1.x() < p2.x()));
00071 }
00072 
00073 /******************************************************************/
00074 /* Class: KWDocDocListViewItem                                    */
00075 /******************************************************************/
00076 
00077 KWDocListViewItem::KWDocListViewItem(QListViewItem* parent, const QString& text)
00078     : KListViewItem(parent, text)
00079 {
00080 }
00081 
00082 KWDocListViewItem::KWDocListViewItem(QListViewItem* parent, QListViewItem* after, const QString& text )
00083     :KListViewItem(parent, after, text)
00084 {
00085 }
00086 
00087 KWDocListViewItem::KWDocListViewItem(QListView* parent, const QString& text)
00088     :KListViewItem(parent, text)
00089 {
00090 }
00091 
00092 void KWDocListViewItem::deleteAllChildren()
00093 {
00094     if ( childCount() > 0 )
00095     {
00096         QListViewItem *child = firstChild();
00097         QListViewItem *delChild;
00098 
00099         while( child )
00100         {
00101             delChild = child;
00102             child = child->nextSibling();
00103             delete delChild;
00104         }
00105     }
00106 }
00107 
00108 KWDocument* KWDocListViewItem::doc()
00109 {
00110     return dynamic_cast<KWDocStructTree *>(listView())->doc();
00111 }
00112 
00113 KWGUI* KWDocListViewItem::gui()
00114 {
00115     return dynamic_cast<KWDocStructTree *>(listView())->gui();
00116 }
00117 
00118 
00119 /******************************************************************/
00120 /* Class: KWDocStructParagItem                                    */
00121 /******************************************************************/
00122 
00123 KWDocStructParagItem::KWDocStructParagItem(QListViewItem* parent, const QString& text, KWTextParag* parag )
00124     : KWDocListViewItem(parent, text), m_parag(parag)
00125 {
00126 }
00127 
00128 KWDocStructParagItem::KWDocStructParagItem(QListViewItem* parent, QListViewItem* after,
00129     const QString& text, KWTextParag* parag )
00130     : KWDocListViewItem(parent, after, text), m_parag(parag)
00131 {
00132 }
00133 
00134 void KWDocStructParagItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00135 {
00136     if (item == this)
00137     {
00138         KWTextFrameSet* fs = m_parag->kwTextDocument()->textFrameSet();
00139         gui()->getView()->openDocStructurePopupMenu(p, fs, m_parag);
00140     }
00141 }
00142 
00143 void KWDocStructParagItem::selectItem()
00144 {
00145     KWTextFrameSet* fs = m_parag->kwTextDocument()->textFrameSet();
00146     QPoint iPoint = m_parag->rect().topLeft(); // small bug if a paragraph is cut between two pages.
00147     KoPoint dPoint;
00148     fs->internalToDocument(iPoint, dPoint);
00149     QPoint nPoint = fs->kWordDocument()->zoomPoint(dPoint);
00150     gui()->canvasWidget()->scrollToOffset(fs->kWordDocument()->unzoomPoint(nPoint));
00151 
00152 }
00153 
00154 void KWDocStructParagItem::editItem()
00155 {
00156     gui()->canvasWidget()->editTextFrameSet(m_parag->kwTextDocument()->textFrameSet(), m_parag, 0);
00157 }
00158 
00159 void KWDocStructParagItem::deleteItem()
00160 {
00161     // TODO
00162 }
00163 
00164 void KWDocStructParagItem::editProperties()
00165 {
00166     gui()->canvasWidget()->editTextFrameSet(m_parag->kwTextDocument()->textFrameSet(), m_parag, 0);
00167     gui()->getView()->formatParagraph();
00168 }
00169 
00170 void KWDocStructParagItem::speakItem()
00171 {
00172     QString text;
00173     KoParagCounter* tmpCounter = m_parag->counter();
00174     if (tmpCounter)
00175         text = tmpCounter->text(m_parag) + " ";
00176     text += m_parag->toString();
00177     if (!text.isEmpty()) {
00178         kospeaker->queueSpeech(text, m_parag->paragraphFormat()->language(), true);
00179         kospeaker->startSpeech();
00180     }
00181 }
00182 
00183 
00184 /******************************************************************/
00185 /* Class: KWDocStructTextFrameItem                                */
00186 /******************************************************************/
00187 
00188 KWDocStructTextFrameItem::KWDocStructTextFrameItem(QListViewItem* parent, const QString& text,
00189     KWTextFrameSet* frameset, KWFrame* frame)
00190     : KWDocListViewItem(parent, text), m_frame(frame), m_frameset(frameset)
00191 {
00192 }
00193 
00194 KWDocStructTextFrameItem::KWDocStructTextFrameItem(QListViewItem* parent, QListViewItem* after, 
00195     const QString& text, KWTextFrameSet* frameset, KWFrame* frame)
00196     : KWDocListViewItem(parent, after, text), m_frame(frame), m_frameset(frameset)
00197 {
00198 }
00199 
00200 void KWDocStructTextFrameItem::setupTextParags()
00201 {
00202     // Build a list of pointers to paragraphs.
00203     QPtrList<KWTextParag> paragPtrs;
00204     paragPtrs.setAutoDelete(false);
00205     KoTextParag* textParag = 0;
00206     KoTextParag* lastParag = 0;
00207     int index = 0;
00208     // Get upper left corner of the frame and get coordinates just inside it.
00209     KoPoint dPoint = m_frame->topLeft() + KoPoint(2,2);
00210     // Get the first paragraph of the frame.
00211     m_frameset->findPosition(dPoint, textParag, index);
00212     // Get lower right corner of the frame and get coordinate just inside it.
00213     dPoint = m_frame->bottomRight() - KoPoint(2,2);
00214     // Get the last paragraph of the frame.
00215     m_frameset->findPosition(dPoint, lastParag, index);
00216     if (lastParag) {
00217         while (textParag) {
00218             KWTextParag* parag = dynamic_cast<KWTextParag *>(textParag);
00219             if (parag) {
00220                 // Don't display an empty paragraph.
00221                 QString text = parag->toString().stripWhiteSpace();
00222                 if ( text.length() > 0)
00223                     paragPtrs.append(parag);
00224             }
00225             if (textParag == lastParag)
00226                 textParag = 0;
00227             else
00228                 textParag = textParag->next();
00229         }
00230     }
00231 
00232     // Remove deleted paragraphs from the listview.
00233     KWDocStructParagItem* item = dynamic_cast<KWDocStructParagItem *>(firstChild());
00234     KWDocStructParagItem* delItem;
00235     while (item) {
00236         delItem = item;
00237         item = dynamic_cast<KWDocStructParagItem *>(item->nextSibling());
00238         if (paragPtrs.containsRef(delItem->parag()) == 0) delete delItem;
00239     }
00240 
00241     // Add new paragraphs to the list or update existing ones.
00242     KWDocStructParagItem* after = 0;
00243     for (uint j = 0; j < paragPtrs.count(); j++) {
00244         KWTextParag* parag = paragPtrs.at(j);
00245         QString text = parag->toString().stripWhiteSpace();
00246         QString name = text.left(20);
00247         KoParagCounter* tmpCounter = parag->counter();
00248         if (tmpCounter)
00249             name.prepend(tmpCounter->text(parag) + " ");
00250         KWDocStructParagItem* child = findTextParagItem(parag);
00251         if (child)
00252             child->setText(0, name);
00253         else {
00254             if (after)
00255                 child = new KWDocStructParagItem(this, after, name, parag);
00256             else
00257                 child = new KWDocStructParagItem(this, name, parag);
00258         }
00259         after = child;
00260     }
00261 }
00262 
00263 void KWDocStructTextFrameItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00264 {
00265     if (item == this)
00266         gui()->getView()->openDocStructurePopupMenu(p, m_frameset, 0);
00267 }
00268 
00269 void KWDocStructTextFrameItem::selectItem()
00270 {
00271     gui()->canvasWidget()->scrollToOffset(m_frame->topLeft());
00272 }
00273 
00274 void KWDocStructTextFrameItem::editItem()
00275 {
00276     KoTextParag* parag = 0L;
00277     int index = 0;
00278     // Get upperleft corner of the frame and get coordinates just inside it.
00279     KoPoint dPoint = m_frame->topLeft() + KoPoint(2,2);
00280     m_frameset->findPosition(dPoint, parag, index);
00281     gui()->canvasWidget()->editTextFrameSet(m_frameset, parag, 0);
00282 }
00283 
00284 void KWDocStructTextFrameItem::deleteItem()
00285 {
00286     gui()->getView()->deleteFrameSet(m_frameset);
00287 }
00288 
00289 void KWDocStructTextFrameItem::editProperties()
00290 {
00291      gui()->canvasWidget()->editFrameProperties(m_frameset);
00292 }
00293 
00294 void KWDocStructTextFrameItem::speakItem()
00295 {
00296     KoTextParag* textParag = 0;
00297     KoTextParag* lastParag = 0;
00298     int index = 0;
00299     // Get upper left corner of the frame and get coordinates just inside it.
00300     KoPoint dPoint = m_frame->topLeft() + KoPoint(2,2);
00301     // Get the first paragraph of the frame.
00302     m_frameset->findPosition(dPoint, textParag, index);
00303     // Get lower right corner of the frame and get coordinate just inside it.
00304     dPoint = m_frame->bottomRight() - KoPoint(2,2);
00305     // Get the last paragraph of the frame.
00306     m_frameset->findPosition(dPoint, lastParag, index);
00307     bool first = true;
00308     if (textParag && lastParag) {
00309         while (textParag) {
00310             KWTextParag* parag = dynamic_cast<KWTextParag *>(textParag);
00311             if (parag) {
00312                 // Don't speak an empty paragraph.
00313                 QString text = parag->toString().stripWhiteSpace();
00314                 if ( text.length() > 0) {
00315                     kospeaker->queueSpeech(text, parag->paragraphFormat()->language(), first);
00316                     first = false;
00317                 }
00318             }
00319             if (textParag == lastParag)
00320                 textParag = 0;
00321             else
00322                 textParag = textParag->next();
00323         }
00324         kospeaker->startSpeech();
00325     }
00326 }
00327 
00328 KWDocStructParagItem* KWDocStructTextFrameItem::findTextParagItem(const KWTextParag* parag)
00329 {
00330     if ( childCount() > 0 )
00331     {
00332         QListViewItem *child = firstChild();
00333         while( child )
00334         {
00335             if (dynamic_cast<KWDocStructParagItem *>(child)->parag() == parag)
00336                 return dynamic_cast<KWDocStructParagItem *>(child);
00337             child = child->nextSibling();
00338         }
00339     }
00340     return 0;
00341 }
00342 
00343 
00344 /******************************************************************/
00345 /* Class: KWDocStructTextFrameSetItem                             */
00346 /******************************************************************/
00347 
00348 KWDocStructTextFrameSetItem::KWDocStructTextFrameSetItem(QListViewItem* parent, const QString& text,
00349     KWTextFrameSet* frameset)
00350     : KWDocListViewItem(parent, text ), m_frameset(frameset)
00351 {
00352 }
00353 
00354 KWDocStructTextFrameSetItem::KWDocStructTextFrameSetItem(QListViewItem* parent, QListViewItem* after,
00355     const QString& text, KWTextFrameSet* frameset)
00356     : KWDocListViewItem(parent, after, text), m_frameset(frameset)
00357 {
00358 }
00359 
00360 void KWDocStructTextFrameSetItem::setupTextFrames()
00361 {
00362     // TODO: KWTextFrameSet::frame() method returns frames in screen order?
00363     // Build a list of frame pointers.
00364     QPtrList<KWFrame> framePtrs;
00365     framePtrs.setAutoDelete(false);
00366     for (uint j = 0; j < m_frameset->frameCount(); j++)
00367         framePtrs.append(m_frameset->frame(j));
00368 
00369     // Remove deleted frames from the listview.
00370     KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
00371     KWDocStructTextFrameItem* delItem;
00372     while (item) {
00373         delItem = item;
00374         item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
00375         if (framePtrs.containsRef(delItem->frame()) == 0) delete delItem;
00376     }
00377 
00378     // Add new frames to the list or update existing ones.
00379     KWDocument* dok = doc();
00380     KWDocStructTextFrameItem* after = 0;
00381     for (uint j = 0; j < framePtrs.count(); j++)
00382     {
00383         KWFrame* frame = framePtrs.at(j);
00384         QString name;
00385         if ( KListViewItem::parent()->firstChild() == this && dok->processingType() == KWDocument::WP )
00386         {
00387             if ( dok->numColumns() == 1 )
00388                 name=i18n( "Page %1" ).arg(QString::number(j + 1));
00389             else
00390                 name=i18n( "Column %1" ).arg(QString::number(j + 1));
00391         }
00392         else
00393             name=i18n( "Text Frame %1" ).arg(QString::number(j + 1));
00394         KWDocStructTextFrameItem* child = findTextFrameItem(frame);
00395         if (child)
00396             child->setText(0, name);
00397         else {
00398             if (after)
00399                 child = new KWDocStructTextFrameItem(this, after, name, m_frameset, frame);
00400             else
00401                 child = new KWDocStructTextFrameItem(this, name, m_frameset, frame);
00402         }
00403         child->setupTextParags();
00404         after = child;
00405     }
00406 }
00407 
00408 void KWDocStructTextFrameSetItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00409 {
00410     if (item == this)
00411         gui()->getView()->openDocStructurePopupMenu(p, m_frameset, 0);
00412 }
00413 
00414 void KWDocStructTextFrameSetItem::selectItem()
00415 {
00416     KWFrame* frame = m_frameset->frame(0);
00417     if (!frame) return;
00418     gui()->canvasWidget()->scrollToOffset(frame->topLeft());
00419 }
00420 
00421 void KWDocStructTextFrameSetItem::editItem()
00422 {
00423     gui()->canvasWidget()->editTextFrameSet(m_frameset, 0L, 0);
00424 }
00425 
00426 void KWDocStructTextFrameSetItem::deleteItem()
00427 {
00428     gui()->getView()->deleteFrameSet(m_frameset);
00429 }
00430 
00431 void KWDocStructTextFrameSetItem::editProperties()
00432 {
00433     gui()->canvasWidget()->editFrameProperties(m_frameset);
00434 }
00435 
00436 void KWDocStructTextFrameSetItem::speakItem()
00437 {
00438     KoTextParag* parag = m_frameset->textDocument()->firstParag();
00439     kospeaker->queueSpeech(parag->toString(), parag->paragraphFormat()->language(), true);
00440     parag = parag->next();
00441     for ( ; parag ; parag = parag->next() )
00442         kospeaker->queueSpeech(parag->toString(), parag->paragraphFormat()->language(), false);
00443     kospeaker->startSpeech();
00444 }
00445 
00446 KWDocStructTextFrameItem* KWDocStructTextFrameSetItem::findTextFrameItem(const KWFrame* frame)
00447 {
00448     if ( childCount() > 0 )
00449     {
00450         QListViewItem *child = firstChild();
00451         while( child )
00452         {
00453             if (dynamic_cast<KWDocStructTextFrameItem *>(child)->frame() == frame)
00454                 return dynamic_cast<KWDocStructTextFrameItem *>(child);
00455             child = child->nextSibling();
00456         }
00457     }
00458     return 0;
00459 }
00460 
00461 
00462 /******************************************************************/
00463 /* Class: KWDocStructTableItem                                    */
00464 /******************************************************************/
00465 
00466 KWDocStructTableItem::KWDocStructTableItem(QListViewItem* parent, const QString& text,
00467     KWTableFrameSet* table)
00468     :KWDocListViewItem(parent, text), m_table(table)
00469 {
00470 }
00471 
00472 KWDocStructTableItem::KWDocStructTableItem(QListViewItem* parent, QListViewItem* after,
00473     const QString& text, KWTableFrameSet* table)
00474     :KWDocListViewItem(parent, after, text), m_table(table)
00475 {
00476 }
00477 
00478 void KWDocStructTableItem::setupCells()
00479 {
00480     // TODO: KWTableFrameSet::cell() method returns cells in screen order?
00481     // Build a list of cell pointers.
00482     QPtrList<KWTextFrameSet> cellPtrs;
00483     cellPtrs.setAutoDelete(false);
00484     for (uint row = 0; row < m_table->getRows(); ++row)
00485         for (uint col = 0; col < m_table->getColumns(); ++ col) {
00486             KWTextFrameSet* cell = m_table->cell(row, col);
00487             if (cell)
00488                 cellPtrs.append(cell);
00489         }
00490 
00491     // Remove deleted cells from the listview.
00492     KWDocStructTextFrameItem* item = dynamic_cast<KWDocStructTextFrameItem *>(firstChild());
00493     KWDocStructTextFrameItem* delItem;
00494     while (item) {
00495         delItem = item;
00496         item = dynamic_cast<KWDocStructTextFrameItem *>(item->nextSibling());
00497         if (cellPtrs.containsRef(delItem->frameSet()) == 0) delete delItem;
00498     }
00499 
00500     // Add new cells to the list or update existing ones.
00501     // Note we skip over the frameset and add the frame instead,
00502     // as every cell has exactly one frame in the frameset.
00503     KWDocStructTextFrameItem* child;
00504     KWDocStructTextFrameItem* after = 0;
00505     for (uint j = 0; j < cellPtrs.count(); j++)
00506     {
00507         KWTextFrameSet* cell = cellPtrs.at(j);
00508         KWFrame* frame = cell->frame(0);
00509         if (frame) {
00510             QString name = cell->name();
00511             child = findCellItem(cell);
00512             if (child)
00513                 child->setText(0, name);
00514             else {
00515                 if (after)
00516                     child = new KWDocStructTextFrameItem(this, after, name, cell, frame);
00517                 else
00518                     child = new KWDocStructTextFrameItem(this, name, cell, frame);
00519             }
00520             child->setupTextParags();
00521             after = child;
00522         }
00523     }
00524 }
00525 
00526 void KWDocStructTableItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00527 {
00528     if (item == this)
00529         gui()->getView()->openDocStructurePopupMenu(p, m_table, 0);
00530 }
00531 
00532 void KWDocStructTableItem::selectItem()
00533 {
00534     KWFrame* frame = m_table->cell( 0, 0 )->frame( 0 );
00535     gui()->canvasWidget()->scrollToOffset(frame->topLeft());
00536 }
00537 
00538 void KWDocStructTableItem::editItem()
00539 {
00540     //activate the first cell
00541     gui()->canvasWidget()->editTextFrameSet(m_table->cell(0,0), 0L, 0);
00542 }
00543 
00544 void KWDocStructTableItem::deleteItem()
00545 {
00546     // TODO: The following statement isn't working for some reason.
00547     gui()->getView()->deselectAllFrames();
00548     gui()->getView()->deleteFrameSet(m_table);
00549 }
00550 
00551 void KWDocStructTableItem::editProperties()
00552 {
00553      gui()->canvasWidget()->editFrameProperties(m_table);
00554 }
00555 
00556 void KWDocStructTableItem::speakItem()
00557 {
00558     bool first = true;
00559     for (uint row = 0; row < m_table->getRows(); ++row) {
00560         for (uint col = 0; col < m_table->getColumns(); ++ col) {
00561             KoTextParag* parag = m_table->cell(row, col)->textDocument()->firstParag();
00562             kospeaker->queueSpeech(parag->toString(), parag->paragraphFormat()->language(), first);
00563             first = false;
00564             parag = parag->next();
00565             for ( ; parag ; parag = parag->next() )
00566                 kospeaker->queueSpeech(parag->toString(), parag->paragraphFormat()->language(), false);
00567         }
00568     }
00569     kospeaker->startSpeech();
00570 }
00571 
00572 KWDocStructTextFrameItem* KWDocStructTableItem::findCellItem(const KWTextFrameSet* cell)
00573 {
00574     if ( childCount() > 0 )
00575     {
00576         QListViewItem *child = firstChild();
00577         while( child )
00578         {
00579             if (dynamic_cast<KWDocStructTextFrameItem *>(child)->frameSet() == cell)
00580                 return dynamic_cast<KWDocStructTextFrameItem *>(child);
00581             child = child->nextSibling();
00582         }
00583     }
00584     return 0;
00585 }
00586 
00587 
00588 /******************************************************************/
00589 /* Class: KWDocStructPictureItem                                  */
00590 /******************************************************************/
00591 
00592 KWDocStructPictureItem::KWDocStructPictureItem(QListViewItem* parent, const QString& text,
00593     KWPictureFrameSet* pic)
00594     : KWDocListViewItem(parent, text), m_pic(pic)
00595 {
00596 }
00597 
00598 void KWDocStructPictureItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00599 {
00600     if (item == this)
00601         gui()->getView()->openDocStructurePopupMenu(p, m_pic, 0);
00602 }
00603 
00604 
00605 void KWDocStructPictureItem::selectItem()
00606 {
00607     KWFrame *frame = m_pic->frame(0);
00608     gui()->canvasWidget()->scrollToOffset(frame->topLeft() );
00609 
00610 }
00611 
00612 void KWDocStructPictureItem::editItem()
00613 {
00614     // Pictures cannot be edited.  Edit Properties instead.
00615     editProperties();
00616 }
00617 
00618 void KWDocStructPictureItem::deleteItem()
00619 {
00620     gui()->getView()->deleteFrameSet(m_pic);
00621 }
00622 
00623 void KWDocStructPictureItem::editProperties()
00624 {
00625     gui()->canvasWidget()->editFrameProperties(m_pic);
00626 }
00627 
00628 /******************************************************************/
00629 /* Class: KWDocStructFormulaItem                                  */
00630 /******************************************************************/
00631 
00632 KWDocStructFormulaItem::KWDocStructFormulaItem(QListViewItem* parent, const QString& text,
00633     KWFormulaFrameSet* form)
00634     : KWDocListViewItem(parent, text), m_form(form)
00635 {
00636 }
00637 
00638 void KWDocStructFormulaItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00639 {
00640     if (item == this)
00641         gui()->getView()->openDocStructurePopupMenu(p, m_form, 0);
00642 }
00643 
00644 void KWDocStructFormulaItem::selectItem()
00645 {
00646     KWFrame* frame = m_form->frame( 0 );
00647     gui()->canvasWidget()->scrollToOffset(frame->topLeft());
00648 }
00649 
00650 void KWDocStructFormulaItem::editItem()
00651 {
00652     // TODO: Formula has to be selected first to bring it into view. Bug?
00653     selectItem(); 
00654     gui()->canvasWidget()->editFrameSet(m_form);
00655 
00656 }
00657 
00658 void KWDocStructFormulaItem::deleteItem()
00659 {
00660     gui()->getView()->deleteFrameSet(m_form);
00661 }
00662 
00663 void KWDocStructFormulaItem::editProperties()
00664 {
00665     gui()->canvasWidget()->editFrameProperties(m_form);
00666 }
00667 
00668 void KWDocStructFormulaItem::speakItem()
00669 {
00670     // TODO
00671 }
00672 
00673 
00674 /******************************************************************/
00675 /* Class: KWDocStructPartItem                                     */
00676 /******************************************************************/
00677 
00678 KWDocStructPartItem::KWDocStructPartItem(QListViewItem* parent, const QString& text,
00679     KWPartFrameSet* part)
00680     : KWDocListViewItem(parent, text), m_part(part)
00681 {
00682 }
00683 
00684 void KWDocStructPartItem::contextMenu(QListViewItem* item, const QPoint& p, int )
00685 {
00686     if (item == this)
00687         gui()->getView()->openDocStructurePopupMenu(p, m_part, 0);
00688 }
00689 
00690 
00691 void KWDocStructPartItem::selectItem()
00692 {
00693     KWFrame* frame = m_part->frame(0);
00694     gui()->canvasWidget()->scrollToOffset(frame->topLeft());
00695 }
00696 
00697 void KWDocStructPartItem::editItem()
00698 {
00699     // TODO:
00700     // part->startEditing();
00701     editProperties();
00702 }
00703 
00704 void KWDocStructPartItem::deleteItem()
00705 {
00706     gui()->getView()->deleteFrameSet(m_part);
00707 }
00708 
00709 void KWDocStructPartItem::editProperties()
00710 {
00711     gui()->canvasWidget()->editFrameProperties(m_part);
00712 }
00713 
00714 /******************************************************************/
00715 /* Class: KWDocStructRootItem                                     */
00716 /******************************************************************/
00717 
00718 KWDocStructRootItem::KWDocStructRootItem(QListView* parent, const QString& text,
00719     TypeStructDocItem type )
00720     : KWDocListViewItem(parent, text), m_type(type)
00721 {
00722     switch ( type ) {
00723         case Arrangement: {
00724             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "tree_arrange", KIcon::Small ) );
00725         } break;
00726         case TextFrames: {
00727             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "frame_text", KIcon::Small ) );
00728         } break;
00729         case FormulaFrames: {
00730             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "frame_formula", KIcon::Small ) );
00731         }break;
00732         case Tables: {
00733             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "inline_table", KIcon::Small ) );
00734         } break;
00735         case Pictures: {
00736             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "frame_image", KIcon::Small ) );
00737         } break;
00738         case Embedded: {
00739             setPixmap( 0, KGlobal::iconLoader()->loadIcon( "frame_query", KIcon::Small ) );
00740         } break;
00741     }
00742 }
00743 
00744 void KWDocStructRootItem::setOpen(bool o)
00745 {
00746     if ( o )
00747     {
00748         switch (m_type)
00749         {
00750             case Arrangement:
00751                 setupArrangement();
00752                 break;
00753             case TextFrames:
00754                 setupTextFrameSets();
00755                 break;
00756             case FormulaFrames:
00757                 setupFormulaFrames();
00758                 break;
00759             case Tables:
00760                 setupTables();
00761                 break;
00762             case Pictures:
00763                 setupPictures();
00764                 break;
00765             case Embedded:
00766                 setupEmbedded();
00767                 break;
00768         }
00769     }
00770     QListViewItem::setOpen(o);
00771 }
00772 
00773 void KWDocStructRootItem::setupArrangement()
00774 {
00775     deleteAllChildren();
00776 
00777     QIntDict<KWDocStructParagItem> parags;
00778     parags.setAutoDelete( false );
00779 
00780     KWFrameSet* frameset = 0L;
00781     KWTextParag* parag = 0L;
00782     KoTextDocument* textdoc = 0L;
00783 
00784     KWDocument* dok = doc();
00785     KWDocStructTextFrameSetItem *item = 0L;
00786     QString _name;
00787 
00788     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- )
00789     {
00790         frameset = dok->frameSet( i );
00791         if ( frameset->type() == FT_TEXT && frameset->frameSetInfo() == KWFrameSet::FI_BODY && !frameset->groupmanager() && frameset->frameCount()>0)
00792         {
00793             KWTextFrameSet *tmpParag = dynamic_cast<KWTextFrameSet*> (frameset) ;
00794             item = new KWDocStructTextFrameSetItem( this, frameset->name(), tmpParag);
00795             textdoc= tmpParag->textDocument();
00796             parag = static_cast<KWTextParag *>(textdoc->firstParag());
00797             while ( parag )
00798             {
00799                 KoParagCounter *tmpCounter = parag->counter();
00800                 if (tmpCounter !=0  && (tmpCounter->style() != KoParagCounter::STYLE_NONE) &&  (tmpCounter->numbering() == KoParagCounter::NUM_CHAPTER) )
00801                 {
00802                     int _depth = tmpCounter->depth();
00803                     if ( _depth == 0 )
00804                     {
00805                         if ( item->childCount() == 0 )
00806                             parags.replace( _depth, new KWDocStructParagItem( item,QString( tmpCounter->text(parag) + "  " +parag->string()->toString().mid( 0, parag->string()->length() ) ),parag) );
00807                         else
00808                             parags.replace( _depth, new KWDocStructParagItem( item, parags[ _depth ],QString( tmpCounter->text(parag) + "  " +parag->string()->toString().mid( 0, parag->string()->length() ) ),parag) );
00809                     }
00810                     else
00811                     {
00812                         if (parags[ _depth - 1 ]==0)
00813                             parags.replace( _depth, new KWDocStructParagItem( item,QString( tmpCounter->text(parag) + "  " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) );
00814                         else if ( parags[ _depth - 1 ]->childCount() == 0 )
00815                             parags.replace( _depth, new KWDocStructParagItem( parags[ _depth - 1 ],QString( tmpCounter->text(parag) + "  " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) );
00816                         else
00817                             parags.replace( _depth, new KWDocStructParagItem( parags[ _depth - 1 ], parags[ _depth ],QString( tmpCounter->text(parag) + "  " +parag->string()->toString().mid( 0, parag->string()->length() ) ), parag) );
00818                     }
00819                 }
00820                 parag = static_cast<KWTextParag *>(parag->next());
00821             }
00822         }
00823     }
00824 
00825     if ( childCount() == 0 )
00826         ( void )new KListViewItem( this, i18n( "Empty" ) );
00827 
00828 }
00829 
00830 void KWDocStructRootItem::setupTextFrameSets()
00831 {
00832 
00833     // Delete Empty item from list.
00834     QListViewItem* lvItem = firstChild();
00835     if (lvItem && (lvItem->text(0) == i18n("Empty"))) delete lvItem;
00836 
00837     // Build a list of framesets ordered by their screen position (top left corner).
00838     KWDocument* dok = doc();
00839     QValueList<KWOrderedFrameSet> orderedFrameSets;
00840     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- ) {
00841         KWFrameSet* frameset = dok->frameSet(i);
00842         if ( frameset->type() == FT_TEXT && frameset->frameSetInfo() == KWFrameSet::FI_BODY &&
00843             !frameset->groupmanager() && frameset->frameCount()>0)
00844 
00845             orderedFrameSets.append(KWOrderedFrameSet(frameset));
00846     }
00847     qHeapSort(orderedFrameSets);
00848 
00849     // Build a list of frameset pointers from the sorted list.
00850     QPtrList<KWTextFrameSet> frameSetPtrs;
00851     frameSetPtrs.setAutoDelete(false);
00852     for ( uint i = 0; i < orderedFrameSets.count(); i++ )
00853         frameSetPtrs.append(dynamic_cast<KWTextFrameSet *>(orderedFrameSets[i].frameSet()));
00854 
00855     // Remove deleted framesets from the listview.
00856     KWDocStructTextFrameSetItem* item = dynamic_cast<KWDocStructTextFrameSetItem *>(firstChild());
00857     KWDocStructTextFrameSetItem* delItem;
00858     while (item) {
00859         delItem = item;
00860         item = dynamic_cast<KWDocStructTextFrameSetItem *>(item->nextSibling());
00861         if (frameSetPtrs.containsRef(delItem->frameSet()) == 0) delete delItem;
00862     }
00863 
00864     // Add new framesets to the list or update existing ones.
00865     KWDocStructTextFrameSetItem* after = 0L;
00866     for ( uint i = 0; i < orderedFrameSets.count(); i++ )
00867     {
00868         KWTextFrameSet* textFrameset = dynamic_cast<KWTextFrameSet *>(orderedFrameSets[i].frameSet());
00869         item = findTextFrameSetItem(textFrameset);
00870         if (item)
00871             item->setText(0, textFrameset->name());
00872         else {
00873             if (after)
00874                 item = new KWDocStructTextFrameSetItem(
00875                     this, after, textFrameset->name(), textFrameset);
00876             else
00877                 item = new KWDocStructTextFrameSetItem(this, textFrameset->name(), textFrameset);
00878         }
00879         after = item;
00880         item->setupTextFrames();
00881     }
00882 
00883     if ( childCount() == 0 )
00884         ( void )new KListViewItem( this, i18n( "Empty" ) );
00885 }
00886 
00887 void KWDocStructRootItem::setupFormulaFrames()
00888 {
00889     deleteAllChildren();
00890 
00891     KWFrameSet* frameset = 0L;
00892     QString _name;
00893     KWDocStructFormulaItem* child;
00894     KWDocument* dok = doc();
00895 
00896     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- )
00897     {
00898         frameset = dok->frameSet( i );
00899         if ( frameset->type() == FT_FORMULA &&
00900             frameset->frameCount()>0  )
00901         {
00902             _name=i18n("Formula Frame %1").arg(QString::number(i+1));
00903             child = new KWDocStructFormulaItem(this, _name, dynamic_cast<KWFormulaFrameSet*>( frameset ));
00904         }
00905     }
00906 
00907     if ( childCount() == 0 )
00908         ( void )new KListViewItem( this, i18n( "Empty" ) );
00909 }
00910 
00911 void KWDocStructRootItem::setupTables()
00912 {
00913     // Delete Empty item from list.
00914     QListViewItem* lvItem = firstChild();
00915     if (lvItem && (lvItem->text(0) == i18n("Empty"))) delete lvItem;
00916 
00917     // Build a list of framesets ordered by their screen position (top left corner).
00918     KWDocument* dok = doc();
00919     QValueList<KWOrderedFrameSet> orderedFrameSets;
00920     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- ) {
00921         KWFrameSet* frameset = dok->frameSet(i);
00922         if ( frameset->type() == FT_TABLE)
00923             orderedFrameSets.append(KWOrderedFrameSet(frameset));
00924     }
00925     qHeapSort(orderedFrameSets);
00926 
00927     // Build a list of table pointers from the sorted list.
00928     QPtrList<KWTableFrameSet> frameSetPtrs;
00929     frameSetPtrs.setAutoDelete(false);
00930     for ( uint i = 0; i < orderedFrameSets.count(); i++ )
00931         frameSetPtrs.append(dynamic_cast<KWTableFrameSet *>(orderedFrameSets[i].frameSet()));
00932 
00933     // Remove deleted tables from the listview.
00934     KWDocStructTableItem* item = dynamic_cast<KWDocStructTableItem *>(firstChild());
00935     KWDocStructTableItem* delItem;
00936     while (item) {
00937         delItem = item;
00938         item = dynamic_cast<KWDocStructTableItem *>(item->nextSibling());
00939         if (frameSetPtrs.containsRef(delItem->table()) == 0) delete delItem;
00940     }
00941 
00942     // Add new framesets to the list or update existing ones.
00943     KWDocStructTableItem* after = 0L;
00944     for ( uint i = 0; i < orderedFrameSets.count(); i++ )
00945     {
00946         KWTableFrameSet* tableFrameset = dynamic_cast<KWTableFrameSet *>(orderedFrameSets[i].frameSet());
00947         item = findTableItem(tableFrameset);
00948         if (item)
00949             item->setText(0, tableFrameset->name());
00950         else {
00951             if (after)
00952                 item = new KWDocStructTableItem(
00953                     this, after, tableFrameset->name(), tableFrameset);
00954             else
00955                 item = new KWDocStructTableItem(this, tableFrameset->name(), tableFrameset);
00956         }
00957         after = item;
00958         item->setupCells();
00959     }
00960 
00961     if ( childCount() == 0 )
00962         ( void )new KListViewItem( this, i18n( "Empty" ) );
00963 }
00964 
00965 void KWDocStructRootItem::setupPictures()
00966 {
00967     deleteAllChildren();
00968 
00969     KWFrameSet* frameset = 0L;
00970     QString _name;
00971     KWDocStructPictureItem* child;
00972     KWDocument* dok = doc();
00973 
00974     int j = 0;
00975     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- )
00976     {
00977         frameset = dok->frameSet( i );
00978         if ( frameset->type() == FT_PICTURE && frameset->frameCount()>0)
00979         {
00980             _name=i18n("Picture (%1) %2").arg(dynamic_cast<KWPictureFrameSet*>( frameset )->key().filename()).arg(++j);
00981             child = new KWDocStructPictureItem(this, _name, dynamic_cast<KWPictureFrameSet*>( frameset ));
00982         }
00983     }
00984 
00985     if ( childCount() == 0 )
00986         ( void )new KListViewItem( this, i18n( "Empty" ) );
00987 }
00988 
00989 void KWDocStructRootItem::setupEmbedded()
00990 {
00991     deleteAllChildren();
00992 
00993     KWFrameSet* frameset = 0L;
00994     QString _name;
00995     KWDocStructPartItem* child;
00996     KWDocument* dok = doc();
00997 
00998     for ( int i = dok->frameSetCount() - 1; i >= 0; i-- )
00999     {
01000         frameset = dok->frameSet( i );
01001         if ( frameset->type() == FT_PART && frameset->frameCount()>0)
01002         {
01003             // Use the name of the frameset as the entry for the object.
01004             _name=frameset->name();
01005             child = new KWDocStructPartItem(this, _name, dynamic_cast<KWPartFrameSet*>( frameset ));
01006         }
01007     }
01008 
01009     if ( childCount() == 0 )
01010         ( void )new KListViewItem( this, i18n( "Empty" ) );
01011 }
01012 
01013 KWDocStructTextFrameSetItem* KWDocStructRootItem::findTextFrameSetItem(const KWFrameSet* frameset)
01014 {
01015     if ( childCount() > 0 )
01016     {
01017         QListViewItem *child = firstChild();
01018         while( child )
01019         {
01020             if (dynamic_cast<KWDocStructTextFrameSetItem *>(child)->frameSet() == frameset)
01021                 return dynamic_cast<KWDocStructTextFrameSetItem *>(child);
01022             child = child->nextSibling();
01023         }
01024     }
01025     return 0;
01026 }
01027 
01028 KWDocStructTableItem* KWDocStructRootItem::findTableItem(const KWFrameSet* frameset)
01029 {
01030     if ( childCount() > 0 )
01031     {
01032         QListViewItem *child = firstChild();
01033         while( child )
01034         {
01035             if (dynamic_cast<KWDocStructTableItem *>(child)->table() == frameset)
01036                 return dynamic_cast<KWDocStructTableItem *>(child);
01037             child = child->nextSibling();
01038         }
01039     }
01040     return 0;
01041 }
01042 
01043 
01044 
01045 /******************************************************************/
01046 /* Class: KWDocStructTree                                         */
01047 /******************************************************************/
01048 
01049 KWDocStructTree::KWDocStructTree(QWidget* parent, KWDocument* doc, KWGUI* gui)
01050     : KListView(parent), m_doc(doc), m_gui(gui)
01051 {
01052     embedded = new KWDocStructRootItem( this, i18n( "Embedded Objects" ), Embedded);
01053     formulafrms = new KWDocStructRootItem( this, i18n( "Formula Frames" ), FormulaFrames);
01054     tables = new KWDocStructRootItem( this, i18n( "Tables" ), Tables);
01055     pictures = new KWDocStructRootItem( this, i18n( "Pictures" ), Pictures);
01056     textfrms = new KWDocStructRootItem( this, i18n( "Text Frames/Frame Sets" ), TextFrames);
01057     // arrangement = new KWDocStructRootItem( this, i18n( "Arrangement" ), Arrangement);
01058 
01059     addColumn( i18n( "Document Structure" ) );
01060     setFullWidth( true );
01061 
01062     connect( this, SIGNAL( doubleClicked(QListViewItem*) ),
01063         this, SLOT( slotDoubleClicked(QListViewItem*)) );
01064     connect( this, SIGNAL( returnPressed(QListViewItem*) ),
01065         this, SLOT( slotReturnPressed(QListViewItem* )) );
01066     connect( this, SIGNAL(rightButtonClicked(QListViewItem*, const QPoint&,int)),
01067         this, SLOT( slotRightButtonClicked(QListViewItem *, const QPoint&, int)));
01068     connect( this, SIGNAL(contextMenu(KListView*, QListViewItem*, const QPoint&)),
01069         this, SLOT(slotContextMenu(KListView*, QListViewItem*, const QPoint&)) );
01070 }
01071 
01072 KWDocStructTree::~KWDocStructTree()
01073 {
01074     delete embedded;
01075     delete formulafrms;
01076     delete tables;
01077     delete pictures;
01078     delete textfrms;
01079     // delete arrangement;
01080 }
01081 
01082 void KWDocStructTree::setup()
01083 {
01084     setRootIsDecorated( true );
01085     setSorting( -1 );
01086     refreshTree((int)(TextFrames | FormulaFrames | Tables | Pictures | Embedded));
01087 }
01088 
01089 void KWDocStructTree::refreshTree(int type)
01090 {
01091     // TODO: Saving current position by listview item text doesn't work if an item is renamed.
01092     QString curItemText;
01093     if (currentItem()) curItemText = currentItem()->text(0);
01094     // if(((int)Arrangement) & type)
01095     //     arrangement->setupArrangement();
01096     if(((int)TextFrames) & type)
01097         textfrms->setupTextFrameSets();
01098     if(((int)FormulaFrames) & type)
01099         formulafrms->setupFormulaFrames();
01100     if(((int)Tables) & type)
01101         tables->setupTables();
01102     if(((int)Pictures) & type)
01103         pictures->setupPictures();
01104     if(((int)Embedded) & type)
01105         embedded->setupEmbedded();
01106     if (!curItemText.isEmpty()) {
01107         QListViewItem* item = findItem(curItemText, 0);
01108         if (item) setCurrentItem(item);
01109     }
01110 }
01111 
01112 void KWDocStructTree::selectItem()
01113 {
01114     QListViewItem* select = currentItem ();
01115     KWDocListViewItem* tmp = dynamic_cast<KWDocListViewItem *>(select);
01116     if ( tmp )
01117         tmp->selectItem();
01118 }
01119 
01120 void KWDocStructTree::editItem()
01121 {
01122     QListViewItem* select = currentItem();
01123     KWDocListViewItem* tmp = dynamic_cast<KWDocListViewItem *>(select);
01124     if ( tmp )
01125         tmp->editItem();
01126 }
01127 
01128 
01129 void KWDocStructTree::deleteItem()
01130 {
01131     QListViewItem* select = currentItem();
01132     KWDocListViewItem *tmp = dynamic_cast<KWDocListViewItem *>(select);
01133     if ( tmp )
01134         tmp->deleteItem();
01135 }
01136 
01137 void KWDocStructTree::editProperties()
01138 {
01139     QListViewItem* select = currentItem();
01140     KWDocListViewItem* tmp = dynamic_cast<KWDocListViewItem *>(select);
01141     if ( tmp )
01142         tmp->editProperties();
01143 }
01144 
01145 void KWDocStructTree::speakItem()
01146 {
01147     QListViewItem* select = currentItem();
01148     KWDocListViewItem* tmp = dynamic_cast<KWDocListViewItem *>(select);
01149     if ( tmp )
01150         tmp->speakItem();
01151 }
01152 
01153 void KWDocStructTree::slotContextMenu(KListView* lv, QListViewItem* i, const QPoint& p)
01154 {
01155     if (lv != this)
01156         return;
01157     KWDocListViewItem *item = dynamic_cast<KWDocListViewItem *>(i);
01158     if (item)
01159         item->contextMenu(item, p, 0);
01160 }
01161 
01162 void KWDocStructTree::slotRightButtonClicked(QListViewItem* i, const QPoint& p, int)
01163 {
01164     KWDocListViewItem* item = dynamic_cast<KWDocListViewItem *>(i);
01165     if (item)
01166         item->contextMenu(item, p, 0);
01167 }
01168 
01169 void KWDocStructTree::slotDoubleClicked(QListViewItem* i)
01170 {
01171     KWDocListViewItem* item = dynamic_cast<KWDocListViewItem *>(i);
01172     if (item)
01173         item->selectItem();
01174 }
01175 
01176 void KWDocStructTree::slotReturnPressed(QListViewItem* i)
01177 {
01178     KWDocListViewItem* item = dynamic_cast<KWDocListViewItem *>(i);
01179     if (item) {
01180         item->editItem();
01181         //return focus to canvas.
01182         m_gui->canvasWidget()->setFocus();
01183     }
01184 }
01185 
01186 
01187 /******************************************************************/
01188 /* Class: KWDocStruct                                             */
01189 /******************************************************************/
01190 
01191 KWDocStruct::KWDocStruct(QWidget* parent, KWDocument* doc, KWGUI* gui)
01192     : QWidget(parent), m_doc(doc), m_gui(gui)
01193 {
01194     m_layout = new QVBoxLayout( this );
01195 
01196     KToolBar* searchBar = new KToolBar( this );
01197     searchBar->setFlat( true );
01198     searchBar->setMovingEnabled( false );
01199 
01200     KToolBarButton* eraseButton = new KToolBarButton( "locationbar_erase", 0, searchBar );
01201     m_tree = new KWDocStructTree( this, doc, gui );
01202     m_tree->setAlternateBackground( KGlobalSettings::alternateBackgroundColor() );
01203     KListViewSearchLine* searchLine = new KListViewSearchLine( searchBar, m_tree );
01204     searchBar->setStretchableWidget( searchLine );
01205     connect( eraseButton, SIGNAL( clicked() ), searchLine, SLOT( clear() ) );
01206 
01207     m_layout->addWidget(searchBar);
01208     m_layout->addWidget(m_tree);
01209     m_tree->setup();
01210     dirtyTreeTypes = 0;
01211 }
01212 
01213 void KWDocStruct::paintEvent (QPaintEvent* ev)
01214 {
01215     if (dirtyTreeTypes) {
01216         m_tree->refreshTree(dirtyTreeTypes);
01217         dirtyTreeTypes = 0;
01218     }
01219     QWidget::paintEvent(ev);
01220 }
01221 
01222 void KWDocStruct::refreshTree(int type)
01223 {
01224     if ((dirtyTreeTypes | type) != dirtyTreeTypes) {
01225         dirtyTreeTypes |= type;
01226         update();
01227     }
01228 }
01229 
01230 void KWDocStruct::refreshEntireTree()
01231 {
01232     refreshTree((int)(TextFrames | FormulaFrames | Tables | Pictures | Embedded));
01233 }
01234 
01235 void KWDocStruct::setFocusHere()
01236 {
01237     if (m_tree)
01238         if (m_tree->isVisible()) m_tree->setFocus();
01239 }
01240 
01241 void KWDocStruct::selectItem()
01242 {
01243     m_tree->selectItem();
01244 }
01245 
01246 void KWDocStruct::editItem()
01247 {
01248     m_tree->editItem();
01249 }
01250 
01251 void KWDocStruct::deleteItem()
01252 {
01253     m_tree->deleteItem();
01254 }
01255 
01256 void KWDocStruct::editProperties()
01257 {
01258     m_tree->editProperties();
01259 }
01260 
01261 void KWDocStruct::speakItem()
01262 {
01263     m_tree->speakItem();
01264 }
KDE Home | KDE Accessibility Home | Description of Access Keys