umbrello API Documentation

umllistview.h

00001 /***************************************************************************
00002  *                                                                         *
00003  *   This program is free software; you can redistribute it and/or modify  *
00004  *   it under the terms of the GNU General Public License as published by  *
00005  *   the Free Software Foundation; either version 2 of the License, or     *
00006  *   (at your option) any later version.                                   *
00007  *                                                                         *
00008  *   copyright (C) 2002-2006                                               *
00009  *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
00010  ***************************************************************************/
00011 
00012 #ifndef UMLLISTVIEW_H
00013 #define UMLLISTVIEW_H
00014 
00015 #include <qdom.h>
00016 #include <qpixmap.h>
00017 #include <klistview.h>
00018 #include "umlnamespace.h"
00019 #include "umllistviewitemlist.h"
00020 
00032 class QMouseEvent;
00033 class QContextMenuEvent;
00034 class QKeyEvent;
00035 class IDChangeLog;
00036 class ListPopupMenu;
00037 class UMLClassifier;
00038 class UMLDoc;
00039 class UMLListViewItem;
00040 class UMLView;
00041 class UMLObject;
00042 class UMLClassifierListItem;
00043 
00044 class UMLListView : public KListView {
00045     Q_OBJECT
00046 public:
00047 
00054     UMLListView(QWidget *parent,const char *name);
00055 
00059     ~UMLListView();
00060 
00067     void setDocument(UMLDoc * d);
00068 
00072     void init();
00073 
00079     void setView(UMLView* v);
00080 
00087     int getSelectedItems(UMLListViewItemList &ItemList);
00088 
00095     int getSelectedItemsRoot(UMLListViewItemList &ItemList);
00096 
00102     UMLListViewItem* createDiagramItem(UMLView *v);
00103 
00111     UMLListViewItem* createItem(UMLListViewItem& Data, IDChangeLog& IDChanges,
00112                                 UMLListViewItem* parent = 0);
00113 
00126     UMLListViewItem *findFolderForDiagram(Uml::Diagram_Type dt);
00127 
00135     UMLListViewItem* determineParentItem(UMLObject* object) const;
00136 
00144     UMLListViewItem* determineParentItem(Uml::ListView_Type lvt) const;
00145 
00151     static bool mayHaveChildItems(Uml::Object_Type type);
00152 
00156     int getSelectedCount();
00157 
00161     QPixmap & getPixmap( Uml::Icon_Type type );
00162 
00166     UMLDoc * getDocument() {
00167         return m_doc;
00168     }
00169 
00175     void addNewItem(UMLListViewItem * parent, Uml::ListView_Type type);
00176 
00183     UMLListViewItem * findUMLObject(const UMLObject *p) const;
00184 
00190     UMLListViewItem * findView(UMLView *v);
00191 
00198     UMLListViewItem * findItem(Uml::IDType id);
00199 
00204     UMLListViewItem *rootView(Uml::ListView_Type type);
00205 
00209     void changeIconOf(UMLObject *o, Uml::Icon_Type to);
00210 
00214     UMLObject *createUMLObject( UMLListViewItem * item, Uml::Object_Type type );
00215 
00219     bool createChildUMLObject( UMLListViewItem * item, Uml::Object_Type type );
00220 
00224     void createDiagram( UMLListViewItem * item, Uml::Diagram_Type type );
00225 
00229     QString getUniqueDiagramName( Uml::Diagram_Type type );
00230 
00234     bool isUnique( UMLListViewItem * item, const QString &name );
00235 
00239     void  cancelRename( QListViewItem * item );
00240 
00246     void setStartedCut(bool startedCut);
00247 
00253     void setStartedCopy(bool startedCopy);
00254 
00258     bool startedCopy() const;
00259 
00265     UMLListViewItem * moveObject(Uml::IDType srcId, Uml::ListView_Type srcType,
00266                                  UMLListViewItem *newParent);
00267 
00271     bool itemRenamed(QListViewItem* item , int col);
00272 
00273     void closeDatatypesFolder();
00274 
00275     UMLListViewItem *theRootView() { return m_rv; }
00276     UMLListViewItem *theLogicalView() { return m_lv[Uml::mt_Logical]; }
00277     UMLListViewItem *theUseCaseView() { return m_lv[Uml::mt_UseCase]; }
00278     UMLListViewItem *theComponentView() { return m_lv[Uml::mt_Component]; }
00279     UMLListViewItem *theDeploymentView() { return m_lv[Uml::mt_Deployment]; }
00280     UMLListViewItem *theDatatypeFolder() { return m_datatypeFolder; }
00281 
00291     Uml::ListView_Type rootViewType(UMLListViewItem *item);
00292 
00293     void saveToXMI( QDomDocument & qDoc, QDomElement & qElement);
00294 
00295     bool loadFromXMI( QDomElement & element );
00296 
00297     bool loadChildrenFromXMI( UMLListViewItem * parent, QDomElement & element );
00298 
00299 protected:
00300     UMLListViewItem* m_rv;    // root view (home)
00301     UMLListViewItem* m_lv[Uml::N_MODELTYPES];    // predefined list view roots
00302     UMLListViewItem* m_datatypeFolder;
00303     ListPopupMenu * m_pMenu;
00304     QString oldText, message;
00305     UMLDoc *m_doc;
00306     bool m_bStartedCut, m_bStartedCopy, m_bIgnoreCancelRename;
00307 
00311     bool m_bCreatingChildObject;
00312 
00313     QPixmap m_Pixmaps[Uml::N_ICONTYPES];
00314 
00315     bool eventFilter(QObject *o, QEvent *e);
00316     void contentsMouseReleaseEvent(QMouseEvent * me);
00317     void contentsMousePressEvent(QMouseEvent *me);
00318     void contentsMouseDoubleClickEvent(QMouseEvent * me);
00319     void focusOutEvent ( QFocusEvent * fe);
00320     QDragObject* dragObject();
00321     void startDrag();
00322     bool acceptDrag (QDropEvent* event) const;
00323     void keyPressEvent(QKeyEvent *);
00324 
00332     UMLListViewItem * findUMLObjectInFolder(UMLListViewItem *item, UMLObject *o);
00333 
00337     static bool isExpandable(Uml::ListView_Type lvt);
00338 
00342     void loadPixmaps();
00343 
00347     void deleteChildrenOf( QListViewItem *parent );
00348 
00355     bool deleteItem( UMLListViewItem *temp );
00356 
00363     void childObjectAdded(UMLClassifierListItem* child, UMLClassifier* parent);
00364 
00370     void addAtContainer(UMLListViewItem *item, UMLListViewItem *parent);
00371 
00372 public slots:
00373 
00378     void slotDiagramCreated(Uml::IDType id);
00379 
00384     void slotDiagramRenamed(Uml::IDType id);
00385 
00390     void slotObjectCreated(UMLObject* object);
00391 
00395     void connectNewObjectsSlots(UMLObject* object);
00396 
00401     void childObjectAdded(UMLClassifierListItem* obj);
00402 
00407     void slotObjectRemoved(UMLObject* object);
00408 
00413     void childObjectRemoved(UMLClassifierListItem* obj);
00414 
00419     void slotObjectChanged();
00420 
00425     void slotDiagramRemoved(Uml::IDType id);
00426 
00430     void popupMenuSel(int sel);
00431 
00435     void slotDropped(QDropEvent* de, QListViewItem* parent, QListViewItem* item);
00436 
00440     void slotExpanded(QListViewItem* item);
00441 
00445     void slotCollapsed(QListViewItem* item);
00446 
00450     void expandAll(QListViewItem *item);
00451 
00455     void collapseAll(QListViewItem *item);
00456 
00461     void slotCutSuccessful();
00462 
00463 private:
00468     UMLListViewItem* recursiveSearchForView(UMLListViewItem* folder,
00469                                             Uml::ListView_Type type, Uml::IDType id);
00470 
00471 };
00472 
00473 #endif
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:01 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003