Source: ./clipboard/umlclipboard.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 UMLCLIPBOARD_H
#define UMLCLIPBOARD_H
//QT Includes
#include
#include "../mylistviewitemdatalist.h"
#include "../associationwidgetdatalist.h"
#include "../umlwidgetdata.h"
#include "../umlobjectlist.h"
#include "../umlviewlist.h"
#include "../umlwidgetlist.h"
class UMLDrag;
class QMimeSource;
class IDChangeLog;
/**
* This class manages the uml's interaction with the KDE
* Clipboard. It makes possible to copy stuff from one uml
* instance to another one.
*
* @author Gustavo Madrigal
*/
class UMLClipboard : public QObject {
//Q_OBJECT
public:
/**
* Constructor
*/
UMLClipboard();
/**
* Deconstructor
*/
virtual ~UMLClipboard();
/**
* Inserts the clipboard's contents into an UML Document
*/
bool paste(UMLDoc * Doc, QMimeSource* Data);
/**
* Copies the selected stuff from an UMLDocument to a
* QMimeSource ready to be put in the clipboard
*/
QMimeSource* copy(UMLDoc * Doc, bool fromView = false);
enum UMLCopyType
{
clip1 = 1, //UMLObjects MyListViewItems (not diagrams)
clip2 = 2, //UMLObjects MyListViewItems (not diagrams) and diagrams
clip3 = 3, //MyListViewItems (not diagrams)
clip4 = 4, ////UMLObjects MyListViewItems, Associations and UMLWidgets
clip5 = 5 //Only Attributes and Operations
};
private:
/**
* Cleans the list of associations taking out the ones
* that point to an object not in m_pObjectList
*/
void CleanAssociations(AssociationWidgetDataList& AssociationDatas);
/**
* If clipboard has mime type application/x-uml-clip1,
* Pastes the data from the clipboard into the current
* Doc
*/
bool pasteClip1(UMLDoc * Doc, QMimeSource* Data);
/**
* If clipboard has mime type application/x-uml-clip2,
* Pastes the data from the clipboard into the current
* Doc
*/
bool pasteClip2(UMLDoc * Doc, QMimeSource* Data);
/**
* If clipboard has mime type application/x-uml-clip3,
* Pastes the data from the clipboard into the current
* Doc
*/
bool pasteClip3(UMLDoc * Doc, QMimeSource* Data);
/**
* If clipboard has mime type application/x-uml-clip4,
* Pastes the data from the clipboard into the current
* Doc
*/
bool pasteClip4(UMLDoc * Doc, QMimeSource* Data);
/**
* If clipboard has mime type application/x-uml-clip5,
* Pastes the data from the clipboard into the current
* Doc
*/
bool pasteClip5(UMLDoc * Doc, QMimeSource* Data);
/**
* When pasting widgets see if they can be pasted on
* different diagram types. Will return true if all the
* widgets to be pasted can be. At the moment this only
* includes NoteWidgets and lines of text.
*/
bool checkPasteWidgets(UMLWidgetDataList & widgetList);
UMLObjectList* m_pObjectList;
MyListViewItemDataList* m_pItemDataList;
UMLWidgetDataList* m_pWidgetDataList;
AssociationWidgetDataList* m_pAssociationDataList;
UMLViewDataList* m_pViewDataList;
UMLCopyType m_type; //Type of copy operation to perform
private:
/**
* Fills the member lists with all the objects and other
* stuff to be copied to the clipboard
*/
bool FillSelectionLists(MyListViewItemList& SelectedItems);
/**
* Checks the whole list to determine the copy action
* type to be * performed, sets the type in the m_type
* member variable
*/
void SetCopyType(MyListViewItemList& SelectedItems, UMLDoc* Doc);
/**
* Searches the child items of a MyListViewItem to
* establish * with Copy type is to be perfomed
*/
void CheckItemForCopyType(MyListViewItem* Item, bool & WithDiagrams, bool &WithObjects, bool &OnlyAttsOps, UMLDoc* Doc);
/**
* Adds the children of a MyListViewItem to m_pItemList
*/
bool InsertItemChildren(MyListViewItem * Item, MyListViewItemList& SelectedItems);
/**
* Inserts the data of the children of the given item
* into the item data list. Used for clip type 4. Used
* to make * sure classes have all the attributes and
* operations saved.
*/
bool insertItemDataChildren( MyListViewItem * item );
/**
* Pastes the children of a MyListViewItem (The Parent)
*/
bool pasteChildren(MyListViewItem* Parent, MyListViewItemDataListIt* It,
IDChangeLog& ChangeLog, UMLDoc * Doc);
};
#endif
| Generated by: jr on radge on Wed Sep 25 00:11:47 2002, using kdoc 2.0a54. |