Back to index

scribus-ng  1.3.4.dfsg+svn20071115
tree.cpp
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 #include "tree.h"
00008 #include "tree.moc"
00009 #include <qheader.h>
00010 #include <qlayout.h>
00011 #include <qvariant.h>
00012 #include <qtooltip.h>
00013 #include <qimage.h>
00014 #include <qpixmap.h>
00015 #include <qmessagebox.h>
00016 
00017 #include "commonstrings.h"
00018 #include "page.h"
00019 #include "scribus.h"
00020 #include "mpalette.h"
00021 #include "actionmanager.h"
00022 #include "util.h"
00023 #include "selection.h"
00024 #include "undomanager.h"
00025 #include "dynamictip.h"
00026 
00027 extern QPixmap loadIcon(QString nam);
00028 
00029 TreeItem::TreeItem(TreeItem* parent, TreeItem* after) : QListViewItem(parent, after)
00030 {
00031        PageObject = NULL;
00032        PageItemObject = NULL;
00033        type = -1;
00034 }
00035 
00036 TreeItem::TreeItem(QListView* parent, TreeItem* after) : QListViewItem(parent, after)
00037 {
00038        PageObject = NULL;
00039        PageItemObject = NULL;
00040        type = -1;
00041 }
00042 
00043 Tree::Tree( QWidget* parent) : ScrPaletteBase( parent, "Tree", false, 0 )
00044 {
00045        resize( 220, 240 );
00046        setMinimumSize( QSize( 220, 240 ) );
00047        setMaximumSize( QSize( 800, 600 ) );
00048 
00049        reportDisplay = new QListView( this, "ListView1" );
00050 
00051        reportDisplay->setGeometry( QRect( 0, 0, 220, 240 ) );
00052        reportDisplay->setMinimumSize( QSize( 220, 240 ) );
00053        reportDisplay->setRootIsDecorated( true );
00054        idElemCol=reportDisplay->addColumn("Element"); //Use width from initial untranslated string, translation is set with languageChange()
00055        reportDisplay->header()->setClickEnabled( false, reportDisplay->header()->count() - 1 );
00056        reportDisplay->header()->setResizeEnabled( false, reportDisplay->header()->count() - 1 );
00057        reportDisplay->setSorting(-1);
00058        reportDisplay->setSelectionMode(QListView::Single);
00059        reportDisplay->setDefaultRenameAction(QListView::Accept);
00060        unsetDoc();
00061        imageIcon = loadIcon("22/insert-image.png");
00062        lineIcon = loadIcon("Stift.xpm");
00063        textIcon = loadIcon("22/insert-text-frame.png");
00064        polylineIcon = loadIcon("22/draw-path.png");
00065        polygonIcon = loadIcon("22/draw-polygon.png");
00066        groupIcon = loadIcon("u_group.png");
00067        buttonIcon = loadIcon("22/insert-button.png");
00068        textFieldIcon = loadIcon("22/text-field.png");
00069        checkBoxIcon = loadIcon("22/checkbox.png");
00070        comboBoxIcon = loadIcon("22/combobox.png");
00071        listBoxIcon = loadIcon("22/list-box.png");
00072        annotTextIcon = loadIcon("22/pdf-annotations.png");
00073        annotLinkIcon = loadIcon("goto.png");
00074        selectionTriggered = false;
00075        freeObjects = 0;
00076        languageChange();
00077        dynTip = new DynamicTip(reportDisplay);
00078        // signals and slots connections
00079        connect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00080        connect(reportDisplay, SIGNAL(itemRenamed(QListViewItem*, int)), this, SLOT(slotDoRename(QListViewItem*, int)));
00081        connect(reportDisplay, SIGNAL(rightButtonClicked(QListViewItem *, const QPoint &, int)), this, SLOT(slotRightClick(QListViewItem*, const QPoint &, int)));
00082 }
00083 
00084 void Tree::setMainWindow(ScribusMainWindow *mw)
00085 {
00086        m_MainWindow=mw;
00087        if (m_MainWindow==NULL)
00088               clearPalette();
00089 }
00090 
00091 void Tree::setDoc(ScribusDoc *newDoc)
00092 {
00093        if (m_MainWindow==NULL)
00094               currDoc=NULL;
00095        else
00096               currDoc=newDoc;
00097        if (currDoc==NULL)
00098               clearPalette();
00099 }
00100 
00101 void Tree::unsetDoc()
00102 {
00103        currDoc=NULL;
00104        clearPalette();
00105 }
00106 
00107 void Tree::setPaletteShown(bool visible)
00108 {
00109        ScrPaletteBase::setPaletteShown(visible);
00110        if ((visible) && (currDoc != NULL))
00111               BuildTree();
00112 }
00113 
00114 void Tree::slotRightClick(QListViewItem *ite, const QPoint &, int col)
00115 {
00116        if (ite == NULL)
00117               return;
00118        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00119               return;
00120        TreeItem *item = (TreeItem*)ite;
00121        if (item != NULL)
00122        {
00123               if ((item->type == 0) || (item->type == 2))
00124               {
00125                      QPopupMenu *pmen = new QPopupMenu();
00126                      m_MainWindow->scrActions["viewShowMargins"]->addTo(pmen);
00127                      m_MainWindow->scrActions["viewShowFrames"]->addTo(pmen);
00128                      m_MainWindow->scrActions["viewShowLayerMarkers"]->addTo(pmen);
00129                      m_MainWindow->scrActions["viewShowImages"]->addTo(pmen);
00130                      m_MainWindow->scrActions["viewShowGrid"]->addTo(pmen);
00131                      m_MainWindow->scrActions["viewShowGuides"]->addTo(pmen);
00132                      m_MainWindow->scrActions["viewShowBaseline"]->addTo(pmen);
00133                      m_MainWindow->scrActions["viewShowTextChain"]->addTo(pmen);
00134                      m_MainWindow->scrActions["viewRulerMode"]->addTo(pmen);
00135                      pmen->insertSeparator();
00136                      m_MainWindow->scrActions["viewSnapToGrid"]->addTo(pmen);
00137                      m_MainWindow->scrActions["viewSnapToGuides"]->addTo(pmen);
00138                      m_MainWindow->scrActions["pageManageGuides"]->addTo(pmen);
00139                      m_MainWindow->scrActions["pageManageMargins"]->addTo(pmen);
00140                      if (item->type == 2)
00141                      {
00142                             m_MainWindow->scrActions["pageApplyMasterPage"]->addTo(pmen);
00143                             pmen->insertSeparator();
00144                             m_MainWindow->scrActions["pageDelete"]->addTo(pmen);
00145                      }
00146                      pmen->exec(QCursor::pos());
00147                      delete pmen;
00148                      pmen=NULL;
00149               }
00150               else if ((item->type == 1) || (item->type == 3) || (item->type == 4))
00151               {
00152                      currentObject = ite;
00153                      currentColumn = col;
00154                      PageItem *currItem = item->PageItemObject;
00155                      QPopupMenu *pmen = new QPopupMenu();
00156                      QPopupMenu *pmen2 = new QPopupMenu();
00157                      QPopupMenu *pmen3 = new QPopupMenu();
00158                      qApp->setOverrideCursor(QCursor(ArrowCursor), true);
00159                      QPopupMenu *pmen4 = new QPopupMenu();
00160                      QPopupMenu *pmenEditContents = new QPopupMenu();
00161                      QPopupMenu *pmenLevel = new QPopupMenu();
00162                      QPopupMenu *pmenPDF = new QPopupMenu();
00163                      QPopupMenu *pmenResolution = new QPopupMenu();
00164                      bool _isGlobalMode = currDoc->view()->undoManager->isGlobalMode();
00165                      m_MainWindow->scrActions["editActionMode"]->setOn(true);
00166                      uint docSelectionCount = currDoc->m_Selection->count();
00167                      if (docSelectionCount == 1)
00168                             currDoc->view()->undoManager->showObject(currDoc->m_Selection->itemAt(0)->getUId());
00169                      else if (docSelectionCount > 1)
00170                             currDoc->view()->undoManager->showObject(Um::NO_UNDO_STACK);
00171                      else if (docSelectionCount == 0)
00172                             currDoc->view()->undoManager->showObject(currDoc->currentPage()->getUId());
00173                      if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::PathText))
00174                      {
00175                             QButtonGroup *InfoGroup = new QButtonGroup( this, "InfoGroup" );
00176                             InfoGroup->setFrameShape( QButtonGroup::NoFrame );
00177                             InfoGroup->setFrameShadow( QButtonGroup::Plain );
00178                             InfoGroup->setTitle("");
00179                             InfoGroup->setExclusive( true );
00180                             InfoGroup->setColumnLayout(0, Qt::Vertical );
00181                             InfoGroup->layout()->setSpacing( 0 );
00182                             InfoGroup->layout()->setMargin( 0 );
00183                             QGridLayout *InfoGroupLayout = new QGridLayout( InfoGroup->layout() );
00184                             InfoGroupLayout->setAlignment( Qt::AlignTop );
00185                             InfoGroupLayout->setSpacing( 2 );
00186                             InfoGroupLayout->setMargin( 0 );
00187                             QString txtC, txtC2;
00188                             QLabel *InfoT = new QLabel(InfoGroup, "ct");
00189                             QLabel *LinCT = new QLabel(InfoGroup, "lt");
00190                             QLabel *LinC = new QLabel(InfoGroup, "lc");
00191                             QLabel *ParCT = new QLabel(InfoGroup, "pt");
00192                             QLabel *ParC = new QLabel(InfoGroup, "pc");
00193                             QLabel *WordCT = new QLabel(InfoGroup, "wt");
00194                             QLabel *WordC = new QLabel(InfoGroup, "wc");
00195                             QLabel *CharCT = new QLabel(InfoGroup, "ct");
00196                             QLabel *CharC = new QLabel(InfoGroup, "cc");
00197                             QLabel *ColCT = new QLabel(InfoGroup, "ct");
00198                             QLabel *ColC = new QLabel(InfoGroup, "cc");
00199                             QLabel *PrintCT = new QLabel(InfoGroup, "nt"); // <a.l.e>
00200                             QLabel *PrintC = new QLabel(InfoGroup, "nc"); // </a.l.e>
00201                             if (currItem->itemType() == PageItem::ImageFrame)
00202                             {
00203                                    LinC->hide();
00204                                    LinCT->hide();
00205                                    if (currItem->PicAvail)
00206                                    {
00207                                           QFileInfo fi = QFileInfo(currItem->Pfile);
00208                                           InfoT->setText( tr("Picture"));
00209                                           InfoGroupLayout->addMultiCellWidget( InfoT, 0, 0, 0, 1, Qt::AlignHCenter );
00210                                           ParCT->setText( tr("File: "));
00211                                           InfoGroupLayout->addWidget( ParCT, 1, 0, Qt::AlignRight );
00212                                           ParC->setText(fi.fileName());
00213                                           InfoGroupLayout->addWidget( ParC, 1, 1 );
00214                                           WordCT->setText( tr("Original PPI: "));
00215                                           InfoGroupLayout->addWidget( WordCT, 2, 0, Qt::AlignRight );
00216                                           WordC->setText(txtC.setNum(qRound(currItem->pixm.imgInfo.xres))+" x "+txtC2.setNum(qRound(currItem->pixm.imgInfo.yres)));
00217                                           InfoGroupLayout->addWidget( WordC, 2, 1 );
00218                                           CharCT->setText( tr("Actual PPI: "));
00219                                           InfoGroupLayout->addWidget( CharCT, 3, 0, Qt::AlignRight );
00220                                           CharC->setText(txtC.setNum(qRound(72.0 / currItem->imageXScale()))+" x "+ txtC2.setNum(qRound(72.0 / currItem->imageYScale())));
00221                                           InfoGroupLayout->addWidget( CharC, 3, 1 );
00222                                           ColCT->setText( tr("Colorspace: "));
00223                                           InfoGroupLayout->addWidget( ColCT, 4, 0, Qt::AlignRight );
00224                                           QString cSpace;
00225                                           QString ext = fi.extension(false).lower();
00226                                           if (((ext == "pdf") || (ext == "eps") || (ext == "epsi") || (ext == "ps")) && (currItem->pixm.imgInfo.type != 7))
00227                                                  cSpace = tr("Unknown");
00228                                           else
00229                                           {
00230                                                  switch (currItem->pixm.imgInfo.colorspace)
00231                                                  {
00232                                                         case 0:
00233                                                                cSpace = tr("RGB");
00234                                                                break;
00235                                                         case 1:
00236                                                                cSpace = tr("CMYK");
00237                                                                break;
00238                                                         case 2:
00239                                                                cSpace = tr("Grayscale");
00240                                                                break;
00241                                                         case 3:
00242                                                                cSpace = tr("Duotone");
00243                                                                break;
00244                                                  }
00245                                           }
00246                                           ColC->setText(cSpace);
00247                                           InfoGroupLayout->addWidget( ColC, 4, 1 );
00248                                    }
00249                                    else
00250                                    {
00251                                           InfoT->setText( tr("Picture"));
00252                                           InfoGroupLayout->addMultiCellWidget( InfoT, 0, 0, 0, 1, Qt::AlignHCenter );
00253                                           ParCT->setText( tr("No Image Loaded"));
00254                                           InfoGroupLayout->addMultiCellWidget( ParCT, 1, 1, 0, 1, Qt::AlignHCenter );
00255                                           ParC->hide();
00256                                           WordCT->hide();
00257                                           WordC->hide();
00258                                           CharCT->hide();
00259                                           CharC->hide();
00260                                           ColCT->hide();
00261                                           ColC->hide();
00262                                    }
00263                             }
00264                             if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
00265                             {
00266                                    int Parag = 0;
00267                                    int Words = 0;
00268                                    int Chara = 0;
00269                                    int ParagN = 0;
00270                                    int WordsN = 0;
00271                                    int CharaN = 0;
00272                                    ColC->hide();
00273                                    ColCT->hide();
00274                                    if (currItem->itemType() == PageItem::TextFrame)
00275                                    {
00276                                           if ((currItem->nextInChain() != 0) || (currItem->prevInChain() != 0))
00277                                                  InfoT->setText( tr("Linked Text"));
00278                                           else
00279                                                  InfoT->setText( tr("Text Frame"));
00280                                    }
00281                                    else
00282                                           InfoT->setText( tr("Text on a Path"));
00283                                    InfoGroupLayout->addMultiCellWidget( InfoT, 0, 0, 0, 1, Qt::AlignCenter );
00284                                    WordAndPara(currItem, &Words, &Parag, &Chara, &WordsN, &ParagN, &CharaN);
00285                                    ParCT->setText( tr("Paragraphs: "));
00286                                    InfoGroupLayout->addWidget( ParCT, 1, 0, Qt::AlignRight );
00287                                    if (ParagN != 0)
00288                                           ParC->setText(txtC.setNum(Parag+ParagN)+" ("+txtC2.setNum(ParagN)+")");
00289                                    else
00290                                           ParC->setText(txtC.setNum(Parag));
00291                                    InfoGroupLayout->addWidget( ParC, 1, 1 );
00292                                    LinCT->setText( tr("Lines: "));
00293                                    InfoGroupLayout->addWidget( LinCT, 2, 0, Qt::AlignRight );
00294                                    LinC->setText(txtC.setNum(currItem->itemText.lines()));
00295                                    InfoGroupLayout->addWidget( LinC, 2, 1 );
00296                                    WordCT->setText( tr("Words: "));
00297                                    InfoGroupLayout->addWidget( WordCT, 3, 0, Qt::AlignRight );
00298                                    if (WordsN != 0)
00299                                           WordC->setText(txtC.setNum(Words+WordsN)+" ("+txtC2.setNum(WordsN)+")");
00300                                    else
00301                                           WordC->setText(txtC.setNum(Words));
00302                                    InfoGroupLayout->addWidget( WordC, 3, 1 );
00303                                    CharCT->setText( tr("Chars: "));
00304                                    InfoGroupLayout->addWidget( CharCT, 4, 0, Qt::AlignRight );
00305                                    if (CharaN != 0)
00306                                           CharC->setText(txtC.setNum(Chara+CharaN)+" ("+txtC2.setNum(CharaN)+")");
00307                                    else
00308                                           CharC->setText(txtC.setNum(Chara));
00309                                    InfoGroupLayout->addWidget( CharC, 4, 1 );
00310                             }
00311                             int row = InfoGroupLayout->numRows(); // <a.l.e>
00312                             PrintCT->setText( tr("Print: "));
00313                             InfoGroupLayout->addWidget( PrintCT, row, 0, Qt::AlignRight );
00314                             if (currItem->printEnabled())
00315                                    PrintC->setText( tr("Enabled"));
00316                             else
00317                                    PrintC->setText( tr("Disabled"));
00318                             InfoGroupLayout->addWidget( PrintC, row, 1 ); // </a.l.e>
00319                             pmen4->insertItem(InfoGroup);
00320                             if ((currItem->itemType() == PageItem::ImageFrame) && (currItem->pixm.imgInfo.exifDataValid))
00321                                    m_MainWindow->scrActions["itemImageInfo"]->addTo(pmen4);
00322                             pmen->insertItem( tr("In&fo"), pmen4);
00323                      }
00324                      pmen->insertSeparator();
00325                      m_MainWindow->scrActions["editUndoAction"]->addTo(pmen);
00326                      m_MainWindow->scrActions["editRedoAction"]->addTo(pmen);
00327                      if (currItem->itemType() == PageItem::ImageFrame ||
00328                             currItem->itemType() == PageItem::TextFrame ||
00329                             currItem->itemType() == PageItem::PathText)
00330                      {
00331                             pmen->insertSeparator();
00332                             if (currItem->itemType() == PageItem::ImageFrame)
00333                             {
00334                                    m_MainWindow->scrActions["fileImportImage"]->addTo(pmen);
00335                                    if (currItem->PicAvail)
00336                                    {
00337                                           if (!currItem->isTableItem)
00338                                                  m_MainWindow->scrActions["itemAdjustFrameToImage"]->addTo(pmen);
00339                                           if (currItem->pixm.imgInfo.valid)
00340                                                  m_MainWindow->scrActions["itemExtendedImageProperties"]->addTo(pmen);
00341                                           m_MainWindow->scrActions["itemUpdateImage"]->addTo(pmen);
00342                                    }
00343                                    pmen->insertItem( tr("Preview Settings"), pmenResolution);
00344                                    m_MainWindow->scrActions["itemImageIsVisible"]->addTo(pmenResolution);
00345                                    pmenResolution->insertSeparator();
00346                                    m_MainWindow->scrActions["itemPreviewLow"]->addTo(pmenResolution);
00347                                    m_MainWindow->scrActions["itemPreviewNormal"]->addTo(pmenResolution);
00348                                    m_MainWindow->scrActions["itemPreviewFull"]->addTo(pmenResolution);
00349                                    if (currItem->PicAvail && currItem->isRaster)
00350                                    {
00351                                           m_MainWindow->scrActions["styleImageEffects"]->addTo(pmen);
00352                                           m_MainWindow->scrActions["editEditWithImageEditor"]->addTo(pmen);
00353                                    }
00354                             }
00355                             if (currItem->itemType() == PageItem::TextFrame)
00356                             {
00357                                    m_MainWindow->scrActions["fileImportText"]->addTo(pmen);
00358                                    m_MainWindow->scrActions["fileImportAppendText"]->addTo(pmen);
00359                                    m_MainWindow->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
00360                                    m_MainWindow->scrActions["insertSampleText"]->addTo(pmen);
00361                             }
00362                             if (currItem->itemType() == PageItem::PathText)
00363                                    m_MainWindow->scrActions["toolsEditWithStoryEditor"]->addTo(pmen);
00364                      }
00365                      if (currDoc->m_Selection->count() == 1)
00366                      {
00367                             pmen->insertSeparator();
00368                             m_MainWindow->scrActions["itemAttributes"]->addTo(pmen);
00369                      }      
00370                      if (currItem->itemType() == PageItem::TextFrame)
00371                      {
00372                             if (currDoc->currentPage()->pageName().isEmpty())
00373                             {
00374                                    m_MainWindow->scrActions["itemPDFIsAnnotation"]->addTo(pmenPDF);
00375                                    m_MainWindow->scrActions["itemPDFIsBookmark"]->addTo(pmenPDF);
00376                                    if (currItem->isAnnotation())
00377                                    {
00378                                           if ((currItem->annotation().Type() == 0) || (currItem->annotation().Type() == 1) || (currItem->annotation().Type() > 9))
00379                                                  m_MainWindow->scrActions["itemPDFAnnotationProps"]->addTo(pmenPDF);
00380                                           else
00381                                                  m_MainWindow->scrActions["itemPDFFieldProps"]->addTo(pmenPDF);
00382                                    }
00383                             }
00384                             pmen->insertItem( tr("&PDF Options"), pmenPDF);
00385                      }
00386                      pmen->insertSeparator();
00387                      m_MainWindow->scrActions["itemLock"]->addTo(pmen);
00388                      m_MainWindow->scrActions["itemLockSize"]->addTo(pmen);
00389                      if (!currItem->isSingleSel)
00390                      {
00391                             m_MainWindow->scrActions["itemSendToScrapbook"]->addTo(pmen);
00392                             m_MainWindow->scrActions["itemSendToPattern"]->addTo(pmen);
00393                             if (currDoc->layerCount() > 1)
00394                             {
00395                                    QMap<int,int> layerMap;
00396                                    for (QValueList<Layer>::iterator it = currDoc->Layers.begin(); it != currDoc->Layers.end(); ++it)
00397                                           layerMap.insert((*it).Level, (*it).LNr);
00398                                    int i=layerMap.count()-1;
00399                                    while (i>=0)
00400                                    {
00401                                           if (currDoc->layerLocked(layerMap[i]))
00402                                                  m_MainWindow->scrLayersActions[QString::number(layerMap[i])]->setEnabled(false);
00403                                           else
00404                                                  m_MainWindow->scrLayersActions[QString::number(layerMap[i])]->setEnabled(true);
00405                                           m_MainWindow->scrLayersActions[QString::number(layerMap[i--])]->addTo(pmen3);
00406                                    }
00407 
00408                                    pmen->insertItem( tr("Send to La&yer"), pmen3);
00409                             }
00410                      }
00411                      if ((currItem->Groups.count() != 0) && (currItem->isGroupControl))
00412                             m_MainWindow->scrActions["itemUngroup"]->addTo(pmen);
00413                      if (!currItem->locked())
00414                      {
00415                             if ((!currItem->isTableItem) && (!currItem->isSingleSel))
00416                             {
00417                                    pmen->insertItem( tr("Le&vel"), pmenLevel);
00418                                    m_MainWindow->scrActions["itemRaiseToTop"]->addTo(pmenLevel);
00419                                    m_MainWindow->scrActions["itemRaise"]->addTo(pmenLevel);
00420                                    m_MainWindow->scrActions["itemLower"]->addTo(pmenLevel);
00421                                    m_MainWindow->scrActions["itemLowerToBottom"]->addTo(pmenLevel);
00422                             }
00423                      }
00424                      if (currDoc->appMode != modeEdit && currDoc->m_Selection->itemsAreSameType()) //Create convertTo Menu
00425                      {
00426                             bool insertConvertToMenu=false;
00427                             if ((currItem->itemType() == PageItem::TextFrame) || (currItem->itemType() == PageItem::PathText))
00428                             {
00429                                    insertConvertToMenu=true;
00430                                    if (currItem->itemType() == PageItem::PathText)
00431                                           m_MainWindow->scrActions["itemConvertToOutlines"]->addTo(pmen2);
00432                                    else
00433                                    {
00434                                           if (currItem->isTableItem)
00435                                                  m_MainWindow->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
00436                                           if (!currItem->isTableItem)
00437                                           {
00438                                                  if ((currItem->prevInChain() == 0) && (currItem->nextInChain() == 0))
00439                                                         m_MainWindow->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
00440                                                  m_MainWindow->scrActions["itemConvertToOutlines"]->addTo(pmen2);
00441                                                  if ((currItem->prevInChain() == 0) && (currItem->nextInChain() == 0))
00442                                                         m_MainWindow->scrActions["itemConvertToPolygon"]->addTo(pmen2);
00443                                           }
00444                                    }
00445                             }
00446                             if (currItem->itemType() == PageItem::ImageFrame)
00447                             {
00448                                    insertConvertToMenu=true;
00449                                    m_MainWindow->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
00450                                    if (!currItem->isTableItem)
00451                                           m_MainWindow->scrActions["itemConvertToPolygon"]->addTo(pmen2);
00452                             }
00453                             if (currItem->itemType() == PageItem::Polygon)
00454                             {
00455                                    insertConvertToMenu=true;
00456                                    m_MainWindow->scrActions["itemConvertToBezierCurve"]->addTo(pmen2);
00457                                    m_MainWindow->scrActions["itemConvertToImageFrame"]->addTo(pmen2);
00458                                    m_MainWindow->scrActions["itemConvertToTextFrame"]->addTo(pmen2);
00459                             }
00460                             bool insertedMenusEnabled = false;
00461                             for (uint pc = 0; pc < pmen2->count(); pc++)
00462                             {
00463                                    if (pmen2->isItemEnabled(pmen2->idAt(pc)))
00464                                           insertedMenusEnabled = true;
00465                             }
00466                             if ((insertConvertToMenu) && (insertedMenusEnabled))
00467                                    pmen->insertItem( tr("Conve&rt to"), pmen2);
00468                      }
00469                      pmen->insertSeparator();
00470                      pmen->insertItem( tr("Rename") , this, SLOT(slotRenameItem()));
00471                      if (!currItem->locked() && !(currItem->isSingleSel))
00472                             m_MainWindow->scrActions["editCut"]->addTo(pmen);
00473                      if (!(currItem->isSingleSel))
00474                             m_MainWindow->scrActions["editCopy"]->addTo(pmen);
00475                      if ((currDoc->appMode == modeEdit) && (m_MainWindow->Buffer2.startsWith("<SCRIBUSTEXT")) && (currItem->itemType() == PageItem::TextFrame))
00476                             m_MainWindow->scrActions["editPaste"]->addTo(pmen);
00477                      if (!currItem->locked() && (currDoc->appMode != modeEdit) && (!(currItem->isSingleSel)))
00478                             pmen->insertItem( tr("&Delete"), currDoc, SLOT(itemSelection_DeleteItem()));
00479                      if ((currItem->itemType() == PageItem::ImageFrame) || (currItem->itemType() == PageItem::TextFrame))
00480                      {
00481                             if (currItem->itemType() == PageItem::ImageFrame)
00482                             {
00483                                    if (currItem->PicAvail)
00484                                           m_MainWindow->scrActions["editCopyContents"]->addTo(pmenEditContents);
00485                                    if (m_MainWindow->contentsBuffer.sourceType==PageItem::ImageFrame)
00486                                    {
00487                                           m_MainWindow->scrActions["editPasteContents"]->addTo(pmenEditContents);
00488                                           m_MainWindow->scrActions["editPasteContentsAbs"]->addTo(pmenEditContents);
00489                                    }
00490                                    if (currItem->PicAvail)
00491                                           m_MainWindow->scrActions["editClearContents"]->addTo(pmenEditContents);
00492                                    if ((currItem->PicAvail) || (m_MainWindow->contentsBuffer.sourceType==PageItem::ImageFrame))
00493                                           pmen->insertItem( tr("Contents"), pmenEditContents);
00494                             }
00495                             else
00496                             {
00497                                    if (currItem->itemText.lines() != 0)
00498                                    {
00499                                           m_MainWindow->scrActions["editClearContents"]->addTo(pmenEditContents);
00500                                           pmen->insertItem( tr("Contents"), pmenEditContents);
00501                                    }
00502                             }
00503                      }
00504                      pmen->exec(QCursor::pos());
00505                      m_MainWindow->scrActions["editActionMode"]->setOn(!_isGlobalMode);
00506                      if (_isGlobalMode)
00507                             currDoc->view()->undoManager->showObject(Um::GLOBAL_UNDO_MODE);
00508                      else
00509                      {
00510                             docSelectionCount = currDoc->m_Selection->count();
00511                             if (docSelectionCount == 1)
00512                                    currDoc->view()->undoManager->showObject(currDoc->m_Selection->itemAt(0)->getUId());
00513                             else if (docSelectionCount > 1)
00514                                    currDoc->view()->undoManager->showObject(Um::NO_UNDO_STACK);
00515                             else if (docSelectionCount == 0)
00516                                    currDoc->view()->undoManager->showObject(currDoc->currentPage()->getUId());
00517                      }
00518                      delete pmen;
00519                      delete pmen2;
00520                      delete pmen3;
00521                      delete pmen4;
00522                      delete pmenEditContents;
00523                      delete pmenLevel;
00524                      delete pmenPDF;
00525                      delete pmenResolution;
00526                      pmen=NULL;
00527                      pmen2=NULL;
00528                      pmen3=NULL;
00529                      pmen4=NULL;
00530                      pmenEditContents=NULL;
00531                      pmenLevel=NULL;
00532                      pmenPDF=NULL;
00533                      pmenResolution=NULL;
00534               }
00535        }
00536 }
00537 
00538 void Tree::slotRenameItem()
00539 {
00540        currentObject->startRename(currentColumn);
00541 }
00542 
00543 void Tree::slotDoRename(QListViewItem *ite , int col)
00544 {
00545        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00546               return;
00547        disconnect(reportDisplay, SIGNAL(itemRenamed(QListViewItem*, int)), this, SLOT(slotDoRename(QListViewItem*, int)));
00548        TreeItem *item = (TreeItem*)ite;
00549        if (item != NULL)
00550        {
00551               if ((item->type == 1) || (item->type == 3) || (item->type == 4))
00552               {
00553                      QString NameOld = item->PageItemObject->itemName();
00554                      QString NameNew = ite->text(col);
00555                      if (NameOld != NameNew)
00556                      {
00557                             if (NameNew == "")
00558                                    ite->setText(col, NameOld);
00559                             else
00560                             {
00561                                    bool found = false;
00562                                    for (uint b = 0; b < currDoc->Items->count(); ++b)
00563                                    {
00564                                           if ((NameNew == currDoc->Items->at(b)->itemName()) && (currDoc->Items->at(b) != item->PageItemObject))
00565                                           {
00566                                                  found = true;
00567                                                  break;
00568                                           }
00569                                    }
00570                                    if (found)
00571                                    {
00572                                           QMessageBox::warning(this, CommonStrings::trWarning, "<qt>"+ tr("Name \"%1\" isn't unique.<br/>Please choose another.").arg(NameNew)+"</qt>", CommonStrings::tr_OK);
00573                                           ite->setText(col, NameOld);
00574                                    }
00575                                    else
00576                                    {
00577                                           item->PageItemObject->setItemName(NameNew);
00578                                           item->PageItemObject->AutoName = false;
00579                                           m_MainWindow->propertiesPalette->SetCurItem(item->PageItemObject);
00580                                           currDoc->setModified(true);
00581                                           reportDisplay->setSelected(ite, true);
00582                                    }
00583                             }
00584                      }
00585               }
00586        }
00587        connect(reportDisplay, SIGNAL(itemRenamed(QListViewItem*, int)), this, SLOT(slotDoRename(QListViewItem*, int)));
00588 }
00589 
00590 QListViewItem* Tree::getListItem(uint SNr, int Nr)
00591 {
00592        TreeItem *item = 0;
00593        QListViewItem *retVal = 0;
00594        if (currDoc->masterPageMode())
00595        {
00596               if (Nr == -1)
00597               {
00598                      QListViewItemIterator it( reportDisplay );
00599                      while ( it.current() )
00600                      {
00601                             item = (TreeItem*)it.current();
00602                             if ((item->type == 0) && (item->PageObject->pageNr() == SNr))
00603                             {
00604                                    retVal = it.current();
00605                                    break;
00606                             }
00607                             ++it;
00608                      }
00609               }
00610               else
00611               {
00612                      QListViewItemIterator it( reportDisplay );
00613                      while ( it.current() )
00614                      {
00615                             item = (TreeItem*)it.current();
00616                             if ((item->type == 1) && (static_cast<int>(item->PageItemObject->ItemNr) == Nr))
00617                             {
00618                                    retVal = it.current();
00619                                    break;
00620                             }
00621                             ++it;
00622                      }
00623               }
00624        }
00625        else
00626        {
00627               if (Nr == -1)
00628               {
00629                      QListViewItemIterator it( reportDisplay );
00630                      while ( it.current() )
00631                      {
00632                             item = (TreeItem*)it.current();
00633                             if ((item->type == 2) && (item->PageObject->pageNr() == SNr))
00634                             {
00635                                    retVal = it.current();
00636                                    break;
00637                             }
00638                             ++it;
00639                      }
00640               }
00641               else
00642               {
00643                      QListViewItemIterator it( reportDisplay );
00644                      while ( it.current() )
00645                      {
00646                             item = (TreeItem*)it.current();
00647                             if (((item->type == 3) || (item->type == 4)) && (static_cast<int>(item->PageItemObject->ItemNr) == Nr))
00648                             {
00649                                    retVal = it.current();
00650                                    break;
00651                             }
00652                             ++it;
00653                      }
00654               }
00655        }
00656        return retVal;
00657 }
00658 
00659 void Tree::slotShowSelect(uint SNr, int Nr)
00660 {
00661        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00662               return;
00663        if (currDoc==NULL)
00664               return;
00665        if (currDoc->isLoading())
00666               return;
00667        if (selectionTriggered)
00668               return;
00669        disconnect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00670        reportDisplay->clearSelection();
00671        QListViewItem *retVal = getListItem(SNr, Nr);
00672        if (retVal != 0)
00673               reportDisplay->setSelected(retVal, true);
00674        connect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00675 }
00676 
00677 void Tree::setItemIcon(QListViewItem *item, PageItem *pgItem)
00678 {
00679        switch (pgItem->itemType())
00680        {
00681        case PageItem::ImageFrame:
00682               item->setPixmap( 0, imageIcon );
00683               break;
00684        case PageItem::TextFrame:
00685               switch (pgItem->annotation().Type())
00686               {
00687                      case 2:
00688                             item->setPixmap( 0, buttonIcon );
00689                             break;
00690                      case 3:
00691                             item->setPixmap( 0, textFieldIcon );
00692                             break;
00693                      case 4:
00694                             item->setPixmap( 0, checkBoxIcon );
00695                             break;
00696                      case 5:
00697                             item->setPixmap( 0, comboBoxIcon );
00698                             break;
00699                      case 6:
00700                             item->setPixmap( 0, listBoxIcon );
00701                             break;
00702                      case 10:
00703                             item->setPixmap( 0, annotTextIcon );
00704                             break;
00705                      case 11:
00706                             item->setPixmap( 0, annotLinkIcon );
00707                             break;
00708                      default:
00709                             item->setPixmap( 0, textIcon );
00710                             break;
00711               }
00712               break;
00713        case PageItem::Line:
00714               item->setPixmap( 0, lineIcon );
00715               break;
00716        case PageItem::Polygon:
00717               item->setPixmap( 0, polygonIcon );
00718               break;
00719        case PageItem::PolyLine:
00720               item->setPixmap( 0, polylineIcon );
00721               break;
00722        case PageItem::PathText:
00723               item->setPixmap( 0, textIcon );
00724               break;
00725        default:
00726               break;
00727        }
00728 }
00729 
00730 void Tree::reopenTree()
00731 {
00732        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00733               return;
00734        if (currDoc->OpenNodes.count() == 0)
00735               return;
00736        TreeItem *item = 0;
00737        QListViewItemIterator it( reportDisplay );
00738        while ( it.current() )
00739        {
00740               item = (TreeItem*)it.current();
00741               for (uint olc = 0; olc < currDoc->OpenNodes.count(); olc++)
00742               {
00743                      if (item->type == currDoc->OpenNodes[olc].type)
00744                      {
00745                             if ((item->type == -3) || (item->type == -2))
00746                                    reportDisplay->setOpen(it.current(), true);
00747                             else if ((item->type == 0) || (item->type == 2))
00748                             {
00749                                    if (item->PageObject == currDoc->OpenNodes[olc].page)
00750                                           reportDisplay->setOpen(it.current(), true);
00751                             }
00752                             else if ((item->type == 2) || (item->type == 3) || (item->type == 4))
00753                             {
00754                                    if (item->PageItemObject == currDoc->OpenNodes[olc].item)
00755                                           reportDisplay->setOpen(it.current(), true);
00756                             }
00757                      }
00758               }
00759               ++it;
00760        }
00761 }
00762 
00763 void Tree::buildReopenVals()
00764 {
00765        ScribusDoc::OpenNodesList ol;
00766        if (reportDisplay->childCount() == 0)
00767               return;
00768        currDoc->OpenNodes.clear();
00769        TreeItem *item = 0;
00770        QListViewItemIterator it( reportDisplay );
00771        while ( it.current() )
00772        {
00773               item = (TreeItem*)it.current();
00774               if (item->isOpen())
00775               {
00776                      ol.type = item->type;
00777                      ol.page = item->PageObject;
00778                      ol.item = item->PageItemObject;
00779                      currDoc->OpenNodes.append(ol);
00780               }
00781               ++it;
00782        }
00783 }
00784 
00785 void Tree::slotSelect(QListViewItem* ite)
00786 {
00787        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00788               return;
00789        disconnect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00790        selectionTriggered = true;
00791        TreeItem *item = (TreeItem*)ite;
00792        uint pg = 0;
00793        PageItem *pgItem = NULL;
00794        switch (item->type)
00795        {
00796               case 0:
00797                      emit selectMasterPage(item->PageObject->pageName());
00798                      break;
00799               case 1:
00800                      if (!currDoc->masterPageMode())
00801                             emit selectMasterPage(item->PageItemObject->OnMasterPage);
00802                      if (item->PageItemObject->Groups.count() == 0)
00803                             emit selectElement(-1, item->PageItemObject->ItemNr, false);
00804                      else
00805                      {
00806                             if (item->PageItemObject->isGroupControl)
00807                                    emit selectElement(-1, item->PageItemObject->ItemNr, false);
00808                             else
00809                                    emit selectElement(-1, item->PageItemObject->ItemNr, true);
00810                      }
00811                      break;
00812               case 2:
00813                      pg = item->PageObject->pageNr();
00814                      m_MainWindow->closeActiveWindowMasterPageEditor();
00815                      emit selectPage(pg);
00816                      break;
00817               case 3:
00818               case 4:
00819                      pgItem = item->PageItemObject;
00820                      m_MainWindow->closeActiveWindowMasterPageEditor();
00821                      if (pgItem->Groups.count() == 0)
00822                             emit selectElement(pgItem->OwnPage, pgItem->ItemNr, false);
00823                      else
00824                      {
00825                             if (pgItem->isGroupControl)
00826                                    emit selectElement(pgItem->OwnPage, pgItem->ItemNr, false);
00827                             else
00828                                    emit selectElement(pgItem->OwnPage, pgItem->ItemNr, true);
00829                      }
00830                      break;
00831               default:
00832                      break;
00833        }
00834        selectionTriggered = false;
00835        connect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00836 }
00837 
00838 void Tree::resizeEvent(QResizeEvent *r)
00839 {
00840        reportDisplay->resize(r->size());
00841 }
00842 
00843 void Tree::BuildTree(bool storeVals)
00844 {
00845        if (!m_MainWindow || m_MainWindow->ScriptRunning)
00846               return;
00847        if (currDoc==NULL)
00848               return;
00849        if (selectionTriggered)
00850               return;
00851        disconnect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
00852        setUpdatesEnabled(false);
00853        if (storeVals)
00854               buildReopenVals();
00855        clearPalette();
00856        QPtrList<PageItem> subGroupList;
00857        TreeItem * item = new TreeItem( reportDisplay, 0 );
00858        rootObject = item;
00859        item->setText( 0, currDoc->DocName.section( '/', -1 ) );
00860        item->type = -2;
00861        TreeItem * pagep = 0;
00862        freeObjects = 0;
00863        PageItem* pgItem;
00864        QString tmp;
00865        for (uint b = 0; b < currDoc->MasterItems.count(); ++b)
00866        {
00867               currDoc->MasterItems.at(b)->Dirty = false;
00868        }
00869        for (int a = 0; a < static_cast<int>(currDoc->MasterPages.count()); ++a)
00870        {
00871               TreeItem *page = new TreeItem( item, pagep );
00872               page->PageObject = currDoc->MasterPages.at(a);
00873               page->type = 0;
00874               QString pageNam = currDoc->MasterPages.at(a)->pageName();
00875               pagep = page;
00876               for (uint b = 0; b < currDoc->MasterItems.count(); ++b)
00877               {
00878                      pgItem = currDoc->MasterItems.at(b);
00879                      if ((pgItem->OwnPage == a) || (pgItem->OnMasterPage == pageNam))
00880                      {
00881                             if (pgItem->Groups.count() == 0)
00882                             {
00883                                    TreeItem *object = new TreeItem( page, 0 );
00884                                    object->PageItemObject = pgItem;
00885                                    object->type = 1;
00886                                    object->setText(0, pgItem->itemName());
00887                                    setItemIcon(object, pgItem);
00888                                    object->setRenameEnabled(0, true);
00889                                    pgItem->Dirty = true;
00890                             }
00891                             else
00892                             {
00893                                    TreeItem * object = new TreeItem( page, 0 );
00894                                    object->PageItemObject = pgItem;
00895                                    object->type = 1;
00896                                    if (pgItem->isGroupControl)
00897                                           object->setText(0, pgItem->itemName());
00898                                    else
00899                                           object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
00900                                    object->setPixmap( 0, groupIcon );
00901                                    object->setRenameEnabled(0, true);
00902                                    pgItem->Dirty = true;
00903                                    subGroupList.clear();
00904                                    for (uint ga = 0; ga < currDoc->MasterItems.count(); ++ga)
00905                                    {
00906                                           PageItem* pgItem2 = currDoc->MasterItems.at(ga);
00907                                           if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
00908                                                  subGroupList.append(pgItem2);
00909                                    }
00910                                    parseSubGroup(1, object, &subGroupList, 1);
00911                             }
00912                      }
00913               }
00914               page->setText(0, currDoc->MasterPages.at(a)->pageName());
00915        }
00916        for (uint b = 0; b < currDoc->DocItems.count(); ++b)
00917        {
00918               currDoc->DocItems.at(b)->Dirty = false;
00919        }
00920        for (int a = 0; a < static_cast<int>(currDoc->DocPages.count()); ++a)
00921        {
00922               TreeItem *page = new TreeItem( item, pagep );
00923               page->PageObject = currDoc->DocPages.at(a);
00924               page->type = 2;
00925               pagep = page;
00926               for (uint b = 0; b < currDoc->DocItems.count(); ++b)
00927               {
00928                      pgItem = currDoc->DocItems.at(b);
00929                      if ((pgItem->OwnPage == a) && (!pgItem->Dirty))
00930                      {
00931                             if (pgItem->Groups.count() == 0)
00932                             {
00933                                    TreeItem *object = new TreeItem( page, 0 );
00934                                    object->PageItemObject = pgItem;
00935                                    object->type = 3;
00936                                    object->setText(0, pgItem->itemName());
00937                                    setItemIcon(object, pgItem);
00938                                    object->setRenameEnabled(0, true);
00939                                    pgItem->Dirty = true;
00940                             }
00941                             else
00942                             {
00943                                    TreeItem *object = new TreeItem( page, 0 );
00944                                    object->PageItemObject = pgItem;
00945                                    object->type = 3;
00946                                    if (pgItem->isGroupControl)
00947                                           object->setText(0, pgItem->itemName());
00948                                    else
00949                                           object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
00950                                    object->setPixmap( 0, groupIcon );
00951                                    object->setRenameEnabled(0, true);
00952                                    pgItem->Dirty = true;
00953                                    subGroupList.clear();
00954                                    for (uint ga = 0; ga < currDoc->DocItems.count(); ++ga)
00955                                    {
00956                                           PageItem* pgItem2 = currDoc->DocItems.at(ga);
00957                                           if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
00958                                                  subGroupList.append(pgItem2);
00959                                    }
00960                                    parseSubGroup(1, object, &subGroupList, 3);
00961                             }
00962                      }
00963               }
00964               page->setText(0, tr("Page ")+tmp.setNum(a+1));
00965        }
00966        bool hasfreeItems = false;
00967        for (uint b = 0; b < currDoc->DocItems.count(); ++b)
00968        {
00969               if (currDoc->DocItems.at(b)->OwnPage == -1)
00970               {
00971                      hasfreeItems = true;
00972                      break;
00973               }
00974        }
00975        if (hasfreeItems)
00976        {
00977               TreeItem *page = new TreeItem( item, pagep );
00978               pagep = page;
00979               freeObjects = page;
00980               page->type = -3;
00981               for (uint b = 0; b < currDoc->DocItems.count(); ++b)
00982               {
00983                      pgItem = currDoc->DocItems.at(b);
00984                      if ((pgItem->OwnPage == -1) && (!pgItem->Dirty))
00985                      {
00986                             if (pgItem->Groups.count() == 0)
00987                             {
00988                                    TreeItem *object = new TreeItem( page, 0 );
00989                                    object->PageItemObject = pgItem;
00990                                    object->type = 4;
00991                                    object->setText(0, pgItem->itemName());
00992                                    setItemIcon(object, pgItem);
00993                                    object->setRenameEnabled(0, true);
00994                                    pgItem->Dirty = true;
00995                             }
00996                             else
00997                             {
00998                                    TreeItem *object = new TreeItem( page, 0 );
00999                                    object->PageItemObject = pgItem;
01000                                    object->type = 4;
01001                                    if (pgItem->isGroupControl)
01002                                           object->setText(0, pgItem->itemName());
01003                                    else
01004                                           object->setText(0, tr("Group ")+tmp.setNum(pgItem->Groups.top()));
01005                                    object->setPixmap( 0, groupIcon );
01006                                    object->setRenameEnabled(0, true);
01007                                    pgItem->Dirty = true;
01008                                    subGroupList.clear();
01009                                    for (uint ga = 0; ga < currDoc->DocItems.count(); ++ga)
01010                                    {
01011                                           PageItem* pgItem2 = currDoc->DocItems.at(ga);
01012                                           if ((pgItem2->Groups.count() != 0) && (pgItem2->Groups.top() == pgItem->Groups.top()) && (pgItem2 != pgItem))
01013                                                  subGroupList.append(pgItem2);
01014                                    }
01015                                    parseSubGroup(1, object, &subGroupList, 4);
01016                             }
01017                      }
01018               }
01019               page->setText(0, tr("Free Objects"));
01020        }
01021        if (storeVals)
01022               reopenTree();
01023        setUpdatesEnabled(true);
01024        repaint();
01025        connect(reportDisplay, SIGNAL(selectionChanged(QListViewItem*)), this, SLOT(slotSelect(QListViewItem*)));
01026 }
01027 
01028 void Tree::parseSubGroup(int level, TreeItem* object, QPtrList<PageItem> *subGroupList, int itemType)
01029 {
01030        QPtrList<PageItem> *subGroup;
01031        PageItem *pgItem;
01032        QString tmp;
01033        for (uint b = 0; b < subGroupList->count(); ++b)
01034        {
01035               pgItem = subGroupList->at(b);
01036               if (!pgItem->Dirty)
01037               {
01038                      if (static_cast<int>(pgItem->Groups.count()) <= level)
01039                      {
01040                             TreeItem *grp = new TreeItem( object, 0 );
01041                             grp->PageItemObject = pgItem;
01042                             grp->type = itemType;
01043                             grp->setText(0, pgItem->itemName());
01044                             setItemIcon(grp, pgItem);
01045                             grp->setRenameEnabled(0, true);
01046                             pgItem->Dirty = true;
01047                      }
01048                      else
01049                      {
01050                             TreeItem *grp = new TreeItem( object, 0 );
01051                             grp->PageItemObject = pgItem;
01052                             grp->type = itemType;
01053                             if (pgItem->isGroupControl)
01054                                    grp->setText(0, pgItem->itemName());
01055                             else
01056                             grp->setText(0, tr("Group ")+tmp.setNum(*pgItem->Groups.at(pgItem->Groups.count()-level-1)));
01057                             grp->setPixmap( 0, groupIcon );
01058                             grp->setRenameEnabled(0, true);
01059                             pgItem->Dirty = true;
01060                             subGroup = new QPtrList<PageItem>;
01061                             subGroup->clear();
01062                             for (uint ga = 0; ga < subGroupList->count(); ++ga)
01063                             {
01064                                    PageItem* pgItem2 = subGroupList->at(ga);
01065                                    if ((static_cast<int>(pgItem2->Groups.count()) > level) && 
01066                                           (*(pgItem2->Groups.at(pgItem2->Groups.count()-level-1)) == (*pgItem->Groups.at(pgItem->Groups.count()-level-1))) && (pgItem2 != pgItem))
01067                                           subGroup->append(pgItem2);
01068                             }
01069                             parseSubGroup(level+1, grp, subGroup, itemType);
01070                             delete subGroup;
01071                      }
01072               }
01073        }
01074 }
01075 
01076 void Tree::languageChange()
01077 {
01078        setCaption( tr("Outline"));
01079        reportDisplay->setColumnText(idElemCol, tr("Element"));
01080 }
01081 
01082 void Tree::clearPalette()
01083 {
01084        reportDisplay->clear();
01085 }