Logo Search packages:      
Sourcecode: kdesdk version File versions

umlview.h

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef UMLVIEW_H
#define UMLVIEW_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

// system includes
#include <kurl.h>
#include <qdom.h>
#include <qcanvas.h>

//local includes
#include "umlobjectlist.h"
#include "umlwidgetlist.h"
#include "associationwidgetlist.h"
#include "messagewidgetlist.h"
#include "optionstate.h"
#include "worktoolbar.h"

// forward declarations
class ClassOptionsPage;
class IDChangeLog;
class ListPopupMenu;
class FloatingText;
class SeqLineWidget;
class ObjectWidget;

class UMLApp;
class UMLDoc;

class KPrinter;
class ToolBarStateFactory;

using namespace Uml;

/** The UMLView class provides the view widget for the UMLApp
 * instance.  The View instance inherits QWidget as a base class and
 * represents the view object of a KMainWindow. As UMLView is part of
 * the document-view model, it needs a reference to the document
 * object connected with it by the UMLApp class to manipulate and
 * display the document structure provided by the UMLDoc class.
 *
 * @author Paul Hensgen <phensgen@techie.com>
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
 */
00056 class UMLView : public QCanvasView {
      Q_OBJECT

      friend class ToolBarState;
      friend class ToolBarStateOther; // TODO
      friend class ToolBarStateAssociation; // TODO
      friend class ToolBarStateMessages; // TODO
public:
      /**
       * Constructor for the main view
       */
      UMLView();

      /**
       * Destructor for the main view
       */
      ~UMLView();

      // Accessors and other methods dealing with loaded/saved data

      /**
       * Return the documentation of the diagram.
       */
00079       QString getDoc() const {
            return m_Documentation;
      }

      /**
       * Set the documentation of the diagram.
       */
00086       void setDoc( QString doc ) {
            m_Documentation = doc;
      }

      /**
       * Return the name of the diagram.
       */
00093       QString getName() const {
            return m_Name;
      }

      /**
       * Set the name of the diagram.
       */
00100       void setName( QString name ) {
            m_Name = name;
      }

      /**
       * Returns the type of the diagram.
       */
00107       Uml::Diagram_Type getType() const {
            return m_Type;
      }

      /**
       * Set the type of diagram.
       */
00114       void setType( Uml::Diagram_Type type ) {
            m_Type = type;
      }

      /**
       * Returns the fill color to use.
       */
00121       QColor getFillColor() const {
            return m_Options.uiState.fillColor;
      }

      /**
       * Set the background color.
       *
       * @param color         The color to use.
       */
      void setFillColor( QColor color );

      /**
       * Returns the line color to use.
       */
00135       QColor getLineColor() const {
            return m_Options.uiState.lineColor;
      }

      /**
       * Returns the line width to use.
       */
00142       uint getLineWidth() const {
            return m_Options.uiState.lineWidth;
      }

      /**
       * Sets the line color.
       *
       * @param color         The color to use.
       */
      void setLineColor( QColor color );

      /**
       * Sets the line width.
       *
       * @param width         The width to use.
       */
      void setLineWidth( uint width );

      /**
       * Returns the ID of the diagram.
       */
00163       int getID() const {
            return m_nID;
      }

      /**
       * Sets the ID of the diagram.
       */
00170       void setID( int id ) {
            m_nID = id;
      }

      /**
       * Returns the zoom of the diagram.
       */
00177       int getZoom() const {
            return m_nZoom;
      }

      /**
       * Sets the zoom of the diagram.
       */
      void setZoom(int zoom);

      /**
       * Returns the height of the diagram.
       */
00189       int getCanvasHeight() const {
            return m_nCanvasHeight;
      }

      /**
       * Sets the height of the diagram.
       */
00196       void setCanvasHeight(int height) {
            m_nCanvasHeight = height;
      }

      /**
       * Returns the width of the diagram.
       */
00203       int getCanvasWidth() const {
            return m_nCanvasWidth;
      }

      /**
       * Sets the height of the diagram.
       */
00210       void setCanvasWidth(int width) {
            m_nCanvasWidth = width;
      }

      /**
       * Return whether to use snap to grid.
       */
00217       bool getSnapToGrid() const {
            return m_bUseSnapToGrid;
      }

      /**
       * Return whether to use snap to grid for component size.
       */
00224       bool getSnapComponentSizeToGrid() const {
            return m_bUseSnapComponentSizeToGrid;
      }

      /**
       * Returns the x grid size.
       */
00231       int getSnapX() const {
            return m_nSnapX;
      }

      /**
       * Returns the y grid size.
       */
00238       int getSnapY() const {
            return m_nSnapY;
      }

      /**
       * Returns the input coordinate with possible grid-snap applied.
       */
      int snappedX(int x);

      /**
       * Returns the input coordinate with possible grid-snap applied.
       */
      int snappedY(int y);

      /**
       *  Returns whether to show snap grid or not.
       */
00255       bool getShowSnapGrid() const {
            return m_bShowSnapGrid;
      }

      /**
       * Sets whether to show snap grid.
       */
      void setShowSnapGrid( bool bShow );

      /**
       *  Sets whether to snap to grid.
       */
      void setSnapToGrid( bool bSnap );

      /**
       * Sets whether to snap to grid for component size.
       */
      void setSnapComponentSizeToGrid( bool bSnap );

      /**
       * Sets whether to use the fill/background color
       */

00278       void setUseFillColor( bool ufc ) {
            m_Options.uiState.useFillColor = ufc;
      }

      /**
       * Returns whether to use the fill/background color
       */
00285       bool getUseFillColor() const {
            return m_Options.uiState.useFillColor;
      }

      /**
       * Sets the font for the view and all the widgets on the view.
       */
      void setFont( QFont font );

      /**
       * Returns the font to use
       */
00297       QFont getFont() const {
            return m_Options.uiState.font;
      }

      /**
       * Returns the options being used.
       */
00304       const Settings::OptionState& getOptionState() const {
            return m_Options;
      }

      /**
       * Sets the options to be used.
       */
00311       void setOptionState( const Settings::OptionState& options) {
            m_Options = options;
      }

      /**
       * Returns a reference to the association list.
       */
00318       AssociationWidgetList& getAssociationList() {
            return m_AssociationList;
      }

      /**
       * Returns a reference to the widget list.
       */
00325       const UMLWidgetList& getWidgetList() const {
            return m_WidgetList;
      }

      /**
       * Returns a reference to the message list.
       */
00332       MessageWidgetList& getMessageList() {
            return m_MessageList;
      }

      // End of accessors and methods that only deal with loaded/saved data
      ////////////////////////////////////////////////////////////////////////

      /**
      * return the current zoom factor
      */
      int currentZoom();

      /**
       * contains the implementation for printing functionality
       */
      void print(KPrinter *pPrinter, QPainter & pPainter);

      /**
       * Print the entire diagram in this view to the file 'filename'
       * @param isEPS         The file is an eps file and needs adjusting
       *                of the eps bounding box values.
       */
      void printToFile(QString filename, bool isEPS);

      /**
       * Fix the file 'filename' to be a valid EPS containing the
       * specified area (rect) of the diagram.
       * Corrects the bounding box.
       */
      void fixEPS(QString filename, QRect rect);

      /**
       * Overrides the standard operation.
       */
      void hideEvent(QHideEvent *he);

      /**
       * Overrides the standard operation.
       */
      void showEvent(QShowEvent *se);

      /**
       * Sets an association to include the given widget.  If this is the second
       * widget set for the association it creates the association.
       *
       * @param w The widget to set for the association.
       */
      bool setAssoc(UMLWidget *w);

      /**
       * Sees if a message is relevant to the given widget.  If it does delete it.
       * @param w The widget to check messages against.
       */
      void checkMessages(ObjectWidget * w);

      /**
       * Finds a widget with the given ID.
       *
       * @param id      The ID of the widget to find.
       *
       * @return  Returns the widget found, returns 0 if no widget found.
       */
      UMLWidget * findWidget(int id);

      /**
       * Finds an association widget with the given ID.
       *
       * @param id      The ID of the widget to find.
       *
       * @return  Returns the widget found, returns 0 if no widget found.
       */
      AssociationWidget * findAssocWidget(int id);

      /**
       * Finds an association widget with the given type and widgets.
       *
       * @param at            The Association_Type of the widget to find.
       * @param pWidgetA      Pointer to the UMLWidget of role A.
       * @param pWidgetB      Pointer to the UMLWidget of role B.
       *
       * @return  Returns the widget found, returns 0 if no widget found.
       */
      AssociationWidget * findAssocWidget(Association_Type at,
                                  UMLWidget *pWidgetA, UMLWidget *pWidgetB);
      /**
       * Remove a widget from view.
       *
       * @param o       The widget to remove.
       */
      void removeWidget(UMLWidget * o);

      /**
       * Sets a widget to a selected state and adds it to a list of selected widgets.
       *
       * @param w The widget to set to selected.
       * @param me      The mouse event containing the information about the selection.
       */
      void setSelected(UMLWidget * w, QMouseEvent * me);

      /**
       *  Clear the selected widgets list.
       */
      void clearSelected();

      /**
       * Move all the selected widgets.
       *
       * @param w The widget in the selected list to move in reference to.
       * @param x The distance to move horizontally.
       * @param y The distance to move vertically.
       */
      void moveSelected(UMLWidget * w, int x, int y);

      /**
       * Return the amount of widgets selected.
       *
       * @return Return the amount of widgets selected.
       */
00450       int getSelectCount() const {
            return m_SelectedList.count();
      }

      /**
       * Set the useFillColor variable to all selected widgets
       *
       * @param   useFC The state to set the widget to.
       */
      void selectionUseFillColor(bool useFC);

      /**
       * Set the font for all the currently selected items.
       */
      void selectionSetFont( QFont font );

      /**
       * Set the line color for all the currently selected items.
       */
      void selectionSetLineColor( QColor color );

      /**
       * Set the line width for all the currently selected items.
       */
      void selectionSetLineWidth( uint width );

      /**
       * Set the fill color for all the currently selected items.
       */
      void selectionSetFillColor( QColor color );

      /**
       * Toggles the show setting sel of all selected items.
       */
      void selectionToggleShow(int sel);

      /**
       * Delete the selected widgets list and the widgets in it.
       */
      void deleteSelection();

      /**
       * Selects all widgets
       */
      void selectAll();

      /**
       * Return a unique ID for the diagram.  Used by the @ref ObjectWidget class.
       *
       * @return Return a unique ID for the diagram.
       */
00501       int getLocalID() {
            return --m_nLocalID;
      }

      /**
       * Returns whether a widget is already on the diagram.
       *
       * @param id      The id of the widget to check for.
       *
       * @return  Returns true if the widget is already on the diagram, false if not.
       */
      bool widgetOnDiagram(int id);


      /**
       * Set the pos variable.  Used internally to keep track of the cursor.
       *
       * @param _pos    The position to set to.
       */
00520       void setPos(QPoint _pos) {
            m_Pos = _pos;
      }

      /**
       * Sets the popup menu to use when clicking on a diagram background
       * (rather than a widget or listView).
       */
      void setMenu();

      /**
       * Reset the toolbar.
       */
00533       void resetToolbar() {
            emit sigResetToolBar();
            m_CurrentCursor = WorkToolBar::tbb_Arrow;
      }

      /**
       * Returns the status on whether in a paste state.
       *
       * @return Returns the status on whether in a paste state.
       */
00543       bool getPaste() const {
            return m_bPaste;
      }

      /**
       *   FIXME Gustavo ???
       */
      void updateNoteWidgets();

      /**
       * Returns a List of all the UMLObjects(Use Cases, Concepts and Actors) in the View
       */
      UMLObjectList* getUMLObjects();

      /**
       * Activate all the objects and associations after a load from the clipboard
       */
      bool activate();

      /**
       * Fills the List with all the selected associations from the diagram
       */
      bool getSelectedAssocs(AssociationWidgetList & assocWidgetList);

      /**
       * Fills the List with all the selected widgets from the diagram
       */
      bool getSelectedWidgets(UMLWidgetList& WidgetList);

      /**
       * Activate the view after a load a new file
       *
       * @return Return true if the activate was succesful
       */
      bool activateAfterLoad( bool bUseLog = false );

      /**
       *  FIXME Gustavo ???
       */
      IDChangeLog* getLocalIDChangeLog();

      /**
      * FIXME Gustavo ???
      */
      void endPartialWidgetPaste();
      /**
       * FIXME Gustavo ???
       */
      void beginPartialWidgetPaste();

      /**
       * Removes a AssociationWidget from a diagram
       *
       * @param pAssoc        Pointer to the AssociationWidget.
       */
      void removeAssoc(AssociationWidget* pAssoc);

      /**
       * Removes all the associations related to Widget
       *
       * @param pWidget       Pointer to the widget to remove.
       */
      void removeAssociations(UMLWidget* pWidget);

      /**
       * Sets each association as selected if the widgets it associates are selected
       */
      void selectAssociations(bool bSelect);

      /**
       * Fills Associations with all the associations that includes a widget related to object
       */
      void getWidgetAssocs(UMLObject* Obj, AssociationWidgetList & Associations);

      /**
       * Removes All the associations of the diagram
       */
      void removeAllAssociations();

      /**
       * Removes All the widgets of the diagram
       */
      void removeAllWidgets();

      /**
       *  Calls the same method in the DocWindow.
       */
      void showDocumentation( UMLObject * object, bool overwrite );

      /**
       *  Calls the same method in the DocWindow.
       */
      void showDocumentation( UMLWidget * widget, bool overwrite );

      /**
      *  Calls the same method in the DocWindow.
      */
      void showDocumentation( AssociationWidget * widget, bool overwrite );

      /**
      *  Calls the same method in the DocWindow.
      */
      void updateDocumentation( bool clear );

      /**
       * Returns the PNG picture of the paste operation.
       *
       * @param rect the area of the diagram to copy
       * @param diagram the class to store PNG picture of the paste operation.
       */
      void getDiagram(const QRect &rect, QPixmap & diagram);

      /**
       * Paint diagram to the paint device
       */
      void  getDiagram(const QRect &area, QPainter & painter);

      /**
       * Returns the PNG picture of the paste operation.
       */
      void copyAsImage(QPixmap*& pix);

      /**
       * Saves a png file to the given url.
       */
      void exportImage();

      /**
       * Adds an association to the view from the given data.
       * Use this method when pasting.
       */
      bool addAssociation( AssociationWidget* pAssoc , bool isPasteOperation = false);

      /**
       * Removes an AssociationWidget from the association list
       * and removes the corresponding UMLAssociation from the current UMLDoc.
       */
      void removeAssocInViewAndDoc(AssociationWidget* assoc);

      /**
       * Adds a widget to the view from the given data.
       * Use this method when pasting.
       */
      bool addWidget( UMLWidget * pWidget , bool isPasteOperation = false);

      /**
       * Returns the offset point at which to place the paste from clipboard.
       * Just add the amount to your co-ords.
       * Only call this straight after the event, the value won't stay valid.
       * Should only be called by Assoc widgets at the moment. no one else needs it.
       */
      QPoint getPastePoint();

      /**
       * Called by the view or any of its children when they start a cut
       * operation.
       */
00700       void setStartedCut() {
            m_bStartedCut = true;
      }

      /**
       * Creates automatically any Associations that the given @ref UMLWidget
       * may have on any diagram.  This method is used when you just add the UMLWidget
       * to a diagram.
       */
      void createAutoAssociations( UMLWidget * widget );

      /**
       * Sets the x grid size.
       */
00714       void setSnapX( int x) {
            m_nSnapX = x;
            canvas() -> setAllChanged();
      }

      /**
       * Sets the y grid size.
       */
00722       void setSnapY( int y) {
            m_nSnapY = y;
            canvas() -> setAllChanged();
      }

      /**
       * Shows the properties dialog for the view.
       */
      bool showPropDialog();

      /**
       * Sets some options for all the @ref ClassWidget on the view.
       */
      void setClassWidgetOptions( ClassOptionsPage * page );

      /**
      * Call before copying/cutting selected widgets.  This will make sure
      * any associations/message selected will make sure both the widgets
      * widgets they are connected to are selected.
      */
      void checkSelections();

      /**
       * This function checks if the currently selected items have all the same
       * type (class, interface, ...). If true, the selection is unique and true
       * will be returned.
       * If there are no items selected, the function will return always true.
       */
      bool checkUniqueSelection();

      /**
      * Adds a sequence line to the list.
      */
00755       void addSeqLine( SeqLineWidget * pLine ) {
            m_SeqLineList.append( pLine );
      }

      /**
      * Removes a sequence line from the list.
      */
00762       void removeSeqLine(SeqLineWidget* pLine) {
            m_SeqLineList.remove(pLine);
      }

      /**
       * Asks for confirmation and clears everything on the diagram.
       * Called from menues.
       */
      void clearDiagram();

      /**
       * Changes snap to grid boolean.
       * Called from menues.
       */
      void toggleSnapToGrid();

      /**
       * Changes snap to grid for component size boolean.
       * Called from menues.
       */
      void toggleSnapComponentSizeToGrid();

      /**
       *  Changes show grid boolean.
       * Called from menues.
       */
      void toggleShowGrid();

      /**
       * Changes the zoom to the currently set level (now loaded from file)
       * Called from UMLApp::slotUpdateViews()
       */
      void fileLoaded();

      /**
       * Sets the diagram width and height in pixels
       */
      void setCanvasSize(int width, int height);

      /**
       * Sets the size of the canvas to just fit on all the items
       */
      void resizeCanvasToItems();

      /**
       * The width and height of a diagram canvas in pixels.
       */
00809       static const int defaultCanvasSize;

      // Load/Save interface:

      /**
       * Creates the <diagram> tag and fills it with the contents of the diagram.
       */
      virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );

      /**
       * Loads the <diagram> tag.
       */
      virtual bool loadFromXMI( QDomElement & qElement );

      /**
       * Loads a <widget> element such as <UML:Class>, used by loadFromXMI() and the clipboard.
       */
      UMLWidget* loadWidgetFromXMI(QDomElement& widgetElement);

      /**
       * Add an object to the application, and update the view.
       */
      void addObject(UMLObject *object);

      /**
       * Selects all the widgets within an internally kept rectangle.
       */
      void selectWidgets(int px, int py, int qx, int qy);

      /**
       * Determine whether on a sequence diagram we have clicked on a line of an Object.
       *
       * @returns Returns the widget thats line was clicked on.  Returns 0 if no line was clicked on.
       */
      ObjectWidget * onWidgetLine( QPoint point );

protected:

      // Methods and members related to loading/saving

      bool loadWidgetsFromXMI( QDomElement & qElement );

      bool loadMessagesFromXMI( QDomElement & qElement );

      bool loadAssociationsFromXMI( QDomElement & qElement );

      /**
       * Contains the unique IDs to allocate to and widget that that needs an
       * ID for the view.  @ref ObjectWidgets are an example of this.
       */
00859       int m_nLocalID;

      /**
       * The ID of the view.  Allocated by @ref UMLDoc
       */
00864       int m_nID;

      /**
       * The type of diagram to represent.
       */
00869       Diagram_Type m_Type;

      /**
       * The name of the diagram.
       */
00874       QString m_Name;

      /**
       * The documentation of the diagram.
       */
00879       QString m_Documentation;

      /**
       * Options used by view
       */
00884       Settings::OptionState   m_Options;

      /**
       * Contains all the data items for @ref MessageWidgets on the diagram.
       */
00889       MessageWidgetList m_MessageList;

      /**
       * Contains all the data for @ref UMLWidgets on the diagram.
       */
00894       UMLWidgetList m_WidgetList;

      /**
       * Contains all the data for @ref AssociationWidgets on the diagram.
       */
00899       AssociationWidgetList m_AssociationList;

      /**
       * The snap to grid x size.
       */
00904       int m_nSnapX;

      /**
       * The snap to grid y size.
       */
00909       int m_nSnapY;

      /**
       * Determines whether to use snap to grid.  The default is off.
       */
00914       bool m_bUseSnapToGrid;

      /**
       * Determines whether to use snap to grid for component
       * size.  The default is off.
       */
00920       bool m_bUseSnapComponentSizeToGrid;

      /**
       * Determines whether to show the snap grid.  The default will be on if the grid is on.
       */
00925       bool m_bShowSnapGrid;

      /**
       * The zoom level in percent, default 100
       */
00930       int m_nZoom;

      /**
       * Width of canvas in pixels
       */
00935       int m_nCanvasWidth;

      /**
       * Height of canvas in pixels
       */
00940       int m_nCanvasHeight;

      // End of methods and members related to loading/saving
      ////////////////////////////////////////////////////////////////////////

      /**
       * Override standard method.
       */
      void closeEvent ( QCloseEvent * e );

      /**
       * Override standard method.
       */
      void contentsDragEnterEvent(QDragEnterEvent* mouseEvent);

      /**
       * Override standard method.
       */
      void contentsDropEvent(QDropEvent* mouseEvent);


      /**
       * Adds an AssociationWidget to the association list
       * and creates the corresponding UMLAssociation in the current UMLDoc.
       */
      void addAssocInViewAndDoc(AssociationWidget* assoc);

      /**
       * Initializes key variables.
       */
      void init();

      /**
       * Initialize and announce a newly created widget.
       * Auxiliary to contentsMouseReleaseEvent().
       */
      void setupNewWidget(UMLWidget *w);

      /**
       * Overrides the standard operation.
       */
      void contentsMouseReleaseEvent(QMouseEvent* mouseEvent);

      /**
       * Overrides the standard operation.
       */
      void contentsMouseMoveEvent(QMouseEvent* mouseEvent);

      /**
       * Override standard method.
       */
      void contentsMouseDoubleClickEvent(QMouseEvent* mouseEvent);

      /**
       * Override standard method.
       */
      void contentsMousePressEvent(QMouseEvent* mouseEvent);

      /**
       * Gets the smallest area to print.
       *
       * @return  Returns the smallest area to print.
       */
      QRect getDiagramRect();


      /**
       * Selects all the widgets of the given association widget.
       */
      void selectWidgetsOfAssoc (AssociationWidget * a);

      /**
       * Calls setSelected on the given UMLWidget and enters
       * it into the m_SelectedList while making sure it is
       * there only once.
       */
      void makeSelected (UMLWidget * uw);

      /**
       * Updates the size of all components in this view.
       */
      void updateComponentSizes();

      /**
       * Find the maximum bounding rectangle of FloatingText widgets.
       * Auxiliary to copyAsImage().
       *
       * @param ft      Pointer to the FloatingText widget to consider.
       * @param px      X coordinate of lower left corner. This value will be
       *          updated if the X coordinate of the lower left corner
       *          of ft is smaller than the px value passed in.
       * @param py      Y coordinate of lower left corner. This value will be
       *          updated if the Y coordinate of the lower left corner
       *          of ft is smaller than the py value passed in.
       * @param qx      X coordinate of upper right corner. This value will be
       *          updated if the X coordinate of the upper right corner
       *          of ft is larger than the qx value passed in.
       * @param qy      Y coordinate of upper right corner. This value will be
       *          updated if the Y coordinate of the upper right corner
       *          of ft is larger than the qy value passed in.
       */
      void findMaxBoundingRectangle(const FloatingText* ft,
                              int& px, int& py, int& qx, int& qy);

      void forceUpdateWidgetFontMetrics(QPainter *painter);

      QPoint m_Pos, m_LineToPos;
      bool m_bCreateObject, m_bDrawRect, m_bDrawSelectedOnly, m_bPaste;
      ListPopupMenu * m_pMenu;
      UMLWidgetList m_SelectedList;
      AssociationWidget * m_pMoveAssoc;

      /**
       *  Flag if view/children started cut operation.
       */
01055       bool m_bStartedCut;

public:
      WorkToolBar::ToolBar_Buttons getCurrentCursor() const;

private:

      ToolBarStateFactory* m_pToolBarStateFactory;
      ToolBarState* m_pToolBarState;

      WorkToolBar::ToolBar_Buttons m_CurrentCursor;

      /**
       * converts toolbar button enums to association type enums
       */
      Uml::Association_Type convert_TBB_AT(WorkToolBar::ToolBar_Buttons tbb);

      /**
       * LocalID Changes Log for paste actions
       */
01075       IDChangeLog * m_pIDChangesLog;

      /**
       *
       * True if the view was activated after the serialization(load)
       */
01081       bool m_bActivated;

      /**
       * It holds a pointer the the first selected widget when creating an Association
       */
01086       UMLWidget* m_pFirstSelectedWidget;

      /**
       * Status of a popupmenu on view.
       * true - a popup is on view
       */
01092       bool m_bPopupShowing;

      /**
       * The current @ref UMLWidget we are on. A reference is
       * kept so we can monitor for a leave event.
       */
01098       UMLWidget * m_pOnWidget;

      /**
       * Holds the Canvas lines for the selection rectangle.
       */
01103       QPtrList<QCanvasLine> m_SelectionRect;

      /**
       * The Line used to show a join between objects as an association is being made.
       */
01108       QCanvasLine * m_pAssocLine;

      /**
       * The offset at which to paste the clipboard.
       */
01113       QPoint m_PastePoint;

      /**
       * Holds a list of all the sequence lines on a sequence diagram.
       */
01118       QPtrList<SeqLineWidget> m_SeqLineList;

      /**
       * Pointer to the UMLDoc
       */
01123       UMLDoc* m_pDoc;

      /**
       * The url of the last saved image
       */
01128       KURL m_ImageURL;

      /**
       * Used by @ref contentsMouseMoveEvent() to know if a mouse button is pressed.
       */
01133       bool m_bMouseButtonPressed;

public slots:

      void zoomIn();
      void zoomOut();

      void slotToolBarChanged(int c);
      void slotObjectCreated(UMLObject * o);
      void slotObjectRemoved(UMLObject * o);

      /**
       * When a menu selection has been made on the menu
       * that this view created, this method gets called.
       */
      void slotMenuSelection(int sel);

      /**
       * This slot is entered when an event has occurred on the views display,
       * most likely a mouse event.  Before it sends out that mouse event everyone
       * that displays a menu on the views surface (widgets and this ) thould remove any
       * menu.  This stops more then one menu bieing diplayed.
       */
      void slotRemovePopupMenu();

      /**
       * makes this view the active view by asking the document to show us
       */
      void slotActivate();

      /**
       * Connects to the signal that @ref UMLApp emits when a cut operation
       * is successful.
       * If the view or a child started the operation the flag m_bStartedCut will
       * be set and we can carry out any operation that is needed, like deleting the selected
       * widgets for the cut operation.
       */
      void slotCutSuccessful();

      /**
       * Called by menu when to show the instance of the view.
       */
      void slotShowView();

      /**
       * Overrides standard method from QWidget to resize canvas when
       * it's shown.
       */
      void show();

signals:
      void sigResetToolBar();
      void sigColorChanged( int );
      void sigRemovePopupMenu();
      void sigClearAllSelected();
      void sigLineColorChanged( int );
      void sigLineWidthChanged( int );
      void sigSnapToGridToggled(bool);
      void sigSnapComponentSizeToGridToggled(bool);
      void sigShowGridToggled(bool);
};

#endif // UMLVIEW_H

Generated by  Doxygen 1.6.0   Back to index