umbrello 2.39.2 Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology

- Main Page
- Related Pages
- Topics
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
UMLDoc Class Reference

`#include <umldoc.h>`

Inheritance diagram for UMLDoc:

## Classes
class | Private

## Public Slots
void | slotRemoveUMLObject (UMLObject *o)
void | slotAutoSave ()
void | slotDiagramPopupMenu (QWidget *umlview, const QPoint &point)

## Signals
void | sigDiagramCreated (Uml::ID::Type id)
void | sigDiagramRemoved (Uml::ID::Type id)
void | sigDiagramRenamed (Uml::ID::Type t)
void | sigDiagramChanged (Uml::DiagramType::Enum)
void | sigObjectCreated (UMLObject *)
void | sigObjectRemoved (UMLObject *)
void | sigResetStatusbarProgress ()
void | sigSetStatusbarProgressSteps (int totalSteps)
void | sigSetStatusbarProgress (int stepPosition)
void | sigWriteToStatusBar (const QString &text)
void | sigCurrentViewChanged ()

## Public Member Functions
| UMLDoc ()
| ~UMLDoc ()
void | init ()
void | addView (UMLView *view)
void | removeView (UMLView *view, bool enforceOneView=true)
void | setMainViewID (Uml::ID::Type viewID)
void | changeCurrentView (Uml::ID::Type id)
void | activateAllViews ()
void | removeAllViews ()
void | removeAllObjects ()
void | setModified (bool modified=true)
bool | isModified () const
bool | saveModified ()
bool | newDocument ()
void | closeDocument ()
bool | openDocument (const QUrl &url, const char *format=0)
bool | saveDocument (const QUrl &url, const char *format=0)
const QUrl & | url () const
void | setUrl (const QUrl &url)
void | setUrlUntitled ()
void | setupSignals ()
bool | isUnique (const QString &name) const
bool | isUnique (const QString &name, UMLPackage *package) const
UMLAssociation * | createUMLAssociation (UMLObject *a, UMLObject *b, Uml::AssociationType::Enum type)
void | addAssociation (UMLAssociation *assoc)
void | removeAssociation (UMLAssociation *assoc, bool doSetModified=true)
UMLAssociation * | findAssociation (Uml::AssociationType::Enum assocType, const UMLObject *roleAObj, const UMLObject *roleBObj, bool *swap=0) const
QString | createDiagramName (Uml::DiagramType::Enum type, bool askForName=true)
UMLView * | createDiagram (UMLFolder *folder, Uml::DiagramType::Enum type, const QString &name, Uml::ID::Type id=Uml::ID::None)
void | removeDiagram (Uml::ID::Type id)
void | removeDiagramCmd (Uml::ID::Type id)
void | renameDiagram (Uml::ID::Type id)
void | removeUMLObject (UMLObject *umlobject, bool deleteObject=false)
void | renameUMLObject (UMLObject *o)
void | renameChildUMLObject (UMLObject *o)
UMLObject * | findObjectById (Uml::ID::Type id)
UMLObject * | findUMLObject (const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject, UMLObject *currentObj=0)
UMLObject * | findUMLObjectRaw (Uml::ModelType::Enum, const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject)
UMLObject * | findUMLObjectRaw (UMLFolder *folder, const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject)
UMLObject * | findUMLObjectRecursive (Uml::ModelType::Enum, const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject)
UMLObject * | findUMLObjectRecursive (UMLFolder *folder, const QString &name, UMLObject::ObjectType type=UMLObject::ot_UMLObject)
UMLClassifier * | findUMLClassifier (const QString &name)
UMLView * | findView (Uml::ID::Type id) const
UMLView * | findView (Uml::DiagramType::Enum type, const QString &name, bool searchAllScopes=false) const
void | setName (const QString &name)
QString | name () const
void | setResolution (qreal resolution)
qreal | resolution () const
qreal | dpiScale () const
Uml::ID::Type | modelID () const
virtual void | saveToXMI (QIODevice &file)
short | encoding (QIODevice &file)
virtual bool | loadFromXMI (QIODevice &file, short encode=ENC_UNKNOWN)
bool | validateXMI1Header (QDomNode &headerNode)
bool | loadUMLObjectsFromXMI (QDomElement &element)
void | loadExtensionsFromXMI1 (QDomNode &node)
bool | loadDiagramsFromXMI1 (QDomNode &node)
void | signalDiagramRenamed (UMLView *view)
void | signalUMLObjectCreated (UMLObject *o)
UMLClassifierList | concepts (bool includeNested=true) const
UMLClassifierList | classesAndInterfaces (bool includeNested=true) const
UMLEntityList | entities (bool includeNested=true) const
UMLFolder * | datatypeFolder () const
UMLClassifierList | datatypes (bool includeInactive=false) const
UMLDatatype * | findDatatype (QString name, bool includeInactive=false)
UMLAssociationList | associations () const
UMLPackageList | packages (bool includeNested=true, Uml::ModelType::Enum model=Uml::ModelType::Logical) const
void | print (QPrinter *pPrinter, DiagramPrintPage *selectPage)
UMLViewList | viewIterator () const
UMLViewList | views (Uml::DiagramType::Enum type=Uml::DiagramType::Undefined) const
bool | assignNewIDs (UMLObject *obj)
bool | addUMLObject (UMLObject *object)
bool | addUMLView (UMLView *pView)
UMLFolder * | rootFolder (Uml::ModelType::Enum mt) const
Uml::ModelType::Enum | rootFolderType (UMLObject *obj) const
UMLFolder * | currentRoot () const
void | setCurrentRoot (Uml::ModelType::Enum rootType)
virtual IDChangeLog * | changeLog () const
void | beginPaste ()
void | endPaste ()
Uml::ID::Type | assignNewID (Uml::ID::Type oldID)
void | setDocumentation (const QString &doc)
QString | documentation () const
void | settingsChanged (Settings::OptionState &optionState)
QString | uniqueViewName (const Uml::DiagramType::Enum type) const
bool | loading () const
void | setLoading (bool state=true)
bool | importing () const
void | setImporting (bool state=true)
bool | closing () const
void | addDefaultDatatypes ()
UMLDatatype * | createDatatype (const QString &name)
void | removeDatatype (const QString &name)
UMLStereotype * | createStereotype (const QString &name)
UMLStereotype * | findStereotype (const QString &name) const
UMLStereotype * | findOrCreateStereotype (const QString &name)
UMLStereotype * | findStereotypeById (Uml::ID::Type id) const
void | addStereotype (UMLStereotype *s)
void | removeStereotype (UMLStereotype *s)
void | addDefaultStereotypes ()
const UMLStereotypeList & | stereotypes () const
void | writeToStatusBar (const QString &text)
void | resolveTypes ()
bool | loadDiagrams1 ()
void | addDiagramToLoad (UMLFolder *folder, QDomNode node)
DiagramsModel * | diagramsModel () const
StereotypesModel * | stereotypesModel () const
ObjectsModel * | objectsModel () const
void | setLoadingError (const QString &text)

## Static Public Member Functions
static bool | tagEq (const QString &tag, const QString &pattern)

## Private Types
typedef QMap< UMLFolder *, QList< QDomNode > > | DiagramsMap

## Private Member Functions
void | initSaveTimer ()
void | createDatatypeFolder ()

## Private Attributes
Private * | m_d
UMLFolder * | m_root [Uml::ModelType::N_MODELTYPES]
UMLFolder * | m_datatypeRoot
UMLStereotypeList | m_stereoList
QString | m_Name
| name of this model as stored in the <UML:Model> tag
Uml::ID::Type | m_modelID
| xmi.id of this model in the <UML:Model>
int | m_count
| auxiliary counter for the progress bar
bool | m_modified
QUrl | m_doc_url
IDChangeLog * | m_pChangeLog
bool | m_bLoading
bool | m_importing
QString | m_Doc
QTimer * | m_pAutoSaveTimer
Uml::ID::Type | m_nViewID
bool | m_bTypesAreResolved
UMLFolder * | m_pCurrentRoot
bool | m_bClosing
DiagramsModel * | m_diagramsModel
ObjectsModel * | m_objectsModel
StereotypesModel * | m_stereotypesModel
qreal | m_resolution
DiagramsMap | m_diagramsToLoad

## Detailed Description

UMLDoc provides a document object for a document-view model.

The UMLDoc class provides a document object that can be used in conjunction with the classes UMLApp and UMLView to create a document-view model for standard KDE applications based on KApplication and KMainWindow. Thereby, the document object is created by the UMLApp instance and contains the document structure with the according methods for manipulation of the document data by UMLView objects. Also, UMLDoc contains the methods for serialization of the document data from and to files.

Author
  Paul Hensgen phens.nosp@m.gen@.nosp@m.techi.nosp@m.e.co.nosp@m.m Bugs and comments to umbre.nosp@m.llo-.nosp@m.devel.nosp@m.@kde.nosp@m..org or https://bugs.kde.org

## Member Typedef Documentation

## ◆ DiagramsMap

typedef QMap<UMLFolder*, QList<QDomNode> > UMLDoc::DiagramsMap
| private

Holds diagram xml nodes on loading

## Constructor & Destructor Documentation

## ◆ UMLDoc()

UMLDoc::UMLDoc | ( |  | ) |

Constructor for the fileclass of the application.

## ◆ ~UMLDoc()

UMLDoc::~UMLDoc | ( |  | ) |

Destructor for the fileclass of the application.

## Member Function Documentation

## ◆ activateAllViews()

void UMLDoc::activateAllViews | ( |  | ) |

Activate all the diagrams/views after loading so all their widgets keep their IDs.

## ◆ addAssociation()

void UMLDoc::addAssociation | ( | UMLAssociation * | assoc | ) |

Adds an association.

Parameters

  assoc | Pointer to the UMLAssociation to add.

## ◆ addDefaultDatatypes()

void UMLDoc::addDefaultDatatypes | ( |  | ) |

Calls the active code generator to create its default datatypes.

## ◆ addDefaultStereotypes()

void UMLDoc::addDefaultStereotypes | ( |  | ) |

Add a stereotype if it doesn't already exist. Used by code generators, operations and attribute dialog.

## ◆ addDiagramToLoad()

void UMLDoc::addDiagramToLoad | ( | UMLFolder * | folder,
|  | QDomNode | node )

Add a xml node containing a diagram to the list of diagrams to load. Helper function for loadDiagrams().

Parameters

  folder | pointer to UMFolder instance the diagrams belongs to
  node | xml document node containing the diagram

## ◆ addStereotype()

void UMLDoc::addStereotype | ( | UMLStereotype * | s | ) |

Add a UMLStereotype to the application.

Parameters

  s | the stereotype to be added

## ◆ addUMLObject()

bool UMLDoc::addUMLObject | ( | UMLObject * | object | ) |

Adds a UMLObject that is already created but doesn't change any ids or signal. Use AddUMLObjectPaste if pasting.

Parameters

  object | The object to add.

Returns
  True if the object was actually added.

## ◆ addUMLView()

bool UMLDoc::addUMLView | ( | UMLView * | pView | ) |

Adds an already created UMLView to the document, it gets assigned a new ID, if its name is already in use then the function appends a number to it to differentiate it from the others; this number is incremental so if number 1 is in use then it tries 2 and then 3 and so on

Parameters

  pView | Pointer to the UMLView to add.

Returns
  True if operation successful.

## ◆ addView()

void UMLDoc::addView | ( | UMLView * | view | ) |

Adds a view to the document which represents the document contents. Usually this is your main view.

Parameters

  view | Pointer to the UMLView to add.

## ◆ assignNewID()

Uml::ID::Type UMLDoc::assignNewID | ( | Uml::ID::Type | oldID | ) |

Assigns a New ID to an Object, and also logs the assignment to its internal ChangeLog.

Parameters

  oldID | The present ID of the object.

Returns
  The new ID assigned to the object.

## ◆ assignNewIDs()

bool UMLDoc::assignNewIDs | ( | UMLObject * | obj | ) |

Assigns an already created UMLObject a new ID. If the object is a classifier then the operations/attributes are also assigned new IDs.

Parameters

  obj | Pointer to the UMLObject to add.

Returns
  True if operation successful.

## ◆ associations()

UMLAssociationList UMLDoc::associations | ( |  | ) | const

Returns a list of the associations in this UMLDoc.

Returns
  List of UML associations.

## ◆ beginPaste()

void UMLDoc::beginPaste | ( |  | ) |

Opens a Paste session, deletes the old ChangeLog and creates an empty one.

## ◆ changeCurrentView()

void UMLDoc::changeCurrentView | ( | Uml::ID::Type | id | ) |

Changes the current view (diagram) to the view with the given ID.

Parameters

  id | The ID of the view to change to.

## ◆ changeLog()

IDChangeLog * UMLDoc::changeLog | ( |  | ) | const
| virtual

Read property of IDChangeLog* m_pChangeLog.

Returns
  Pointer to the IDChangeLog object.

## ◆ classesAndInterfaces()

UMLClassifierList UMLDoc::classesAndInterfaces | ( | bool | includeNested = true | ) | const

Returns a list of the classes, interfaces, and enumerations in this UMLDoc.

Parameters

  includeNested | Whether to include the concepts from nested packages (default: true.)

Returns
  List of UML concepts.

## ◆ closeDocument()

void UMLDoc::closeDocument | ( |  | ) |

Closes the current document.

## ◆ closing()

bool UMLDoc::closing | ( |  | ) | const

Returns the m_bClosing flag.

Returns
  the value of the flag

## ◆ concepts()

UMLClassifierList UMLDoc::concepts | ( | bool | includeNested = true | ) | const

Returns a list of the concepts in this UMLDoc.

Parameters

  includeNested | Whether to include the concepts from nested packages (default: true.)

Returns
  List of UML concepts.

## ◆ createDatatype()

UMLDatatype * UMLDoc::createDatatype | ( | const QString & | name | ) |

Add a datatype if it doesn't already exist. Used by addDefaultDatatypes().

## ◆ createDatatypeFolder()

void UMLDoc::createDatatypeFolder | ( |  | ) |
| private

Create the datatype folder and add it to the logical folder.

## ◆ createDiagram()

UMLView * UMLDoc::createDiagram | ( | UMLFolder * | folder,
|  | Uml::DiagramType::Enum | type,
|  | const QString & | name,
|  | Uml::ID::Type | id = Uml::ID::None )

Creates a diagram of the given type.

Parameters

  folder | the folder in which tp create the diagram.
  type | the type of diagram to create
  name | the name for the diagram to create
  id | optional ID of new diagram

Returns
  pointer to the UMLView of the new diagram

## ◆ createDiagramName()

QString UMLDoc::createDiagramName | ( | Uml::DiagramType::Enum | type,
|  | bool | askForName = true )

Creates the name of the given diagram type.

Parameters

  type | The type of diagram to create.
  askForName | If true shows a dialog box asking for name, else uses a default name.

Returns
  name of the new diagram

## ◆ createStereotype()

UMLStereotype * UMLDoc::createStereotype | ( | const QString & | name | ) |

Creates a stereotype for the parent object.

Parameters

  name | the name of the stereotype

## ◆ createUMLAssociation()

UMLAssociation * UMLDoc::createUMLAssociation | ( | UMLObject * | a,
|  | UMLObject * | b,
|  | Uml::AssociationType::Enum | type )

Creates AND adds an association between two UMLObjects. Used by refactoring assistant. NOTE: this method does not check if the association is valid / legal

Parameters

  a | The UMLObject "A" for the association (source)
  b | The UMLObject "B" for the association (destination)
  type | The association's type

Returns
  The Association created

## ◆ currentRoot()

UMLFolder * UMLDoc::currentRoot | ( |  | ) | const

Return the currently selected root folder. This will be an element from the m_root[] array.

Returns
  the currently selected root folder or NULL

## ◆ datatypeFolder()

UMLFolder * UMLDoc::datatypeFolder | ( |  | ) | const

Returns the datatype folder.

Returns
  Pointer to the predefined folder for datatypes.

## ◆ datatypes()

UMLClassifierList UMLDoc::datatypes | ( | bool | includeInactive = false | ) | const

Returns a list of the datatypes in this UMLDoc.

Parameters

  includeInactive | Include inactive datatypes which may have accrued by changing the active programming language.

Returns
  List of datatypes.

## ◆ diagramsModel()

DiagramsModel * UMLDoc::diagramsModel | ( |  | ) | const

## ◆ documentation()

QString UMLDoc::documentation | ( |  | ) | const

Returns the documentation for the project.

Returns
  The documentation text of this UMLDoc.

## ◆ dpiScale()

qreal UMLDoc::dpiScale | ( |  | ) | const

Returns scale factor for recalculation of document coordinates.

Returns
  scale factor

## ◆ encoding()

short UMLDoc::encoding | ( | QIODevice & | file | ) |

If the given XMI file has a processing instruction then extract the encoding info from the processing instruction. If that info is unrecognized then return ENC_OLD_ENC, else return the encoding found. If the file does not have a processing instruction then give a warning but return ENC_UNICODE. This is an optimistic assumption in the interest of best effort loading. The value ENC_UNKNOWN is only returned in case of a grave error.

Parameters

  file | The file to be checked.

## ◆ endPaste()

void UMLDoc::endPaste | ( |  | ) |

Closes a paste session, deletes the ChangeLog.

## ◆ entities()

UMLEntityList UMLDoc::entities | ( | bool | includeNested = true | ) | const

Returns a list of the entities in this UMLDoc.

Parameters

  includeNested | Whether to include the entities from nested packages (default: true.)

Returns
  List of UML Entities.

## ◆ findAssociation()

UMLAssociation * UMLDoc::findAssociation | ( | Uml::AssociationType::Enum | assocType,
|  | const UMLObject * | roleAObj,
|  | const UMLObject * | roleBObj,
|  | bool * | swap = 0 ) const

Finds an association.

Parameters

  assocType | Type of the UMLAssociation to seek.
  roleAObj | Pointer to the role A UMLCanvasObject.
  roleBObj | Pointer to the role B UMLCanvasObject.
  swap | Optional pointer to boolean. The bool is set to true if the association matched with swapped roles, else it is set to false.

Returns
  Pointer to the UMLAssociation found or NULL if not found.

## ◆ findDatatype()

UMLDatatype * UMLDoc::findDatatype | ( | QString | name,
|  | bool | includeInactive = false )

Seek the datatype of the given name in the Datatypes folder.

Parameters

  name | Name of the datatype
  includeInactive | Include inactive datatypes in the search.

Returns
  List of datatypes.

## ◆ findObjectById()

UMLObject * UMLDoc::findObjectById | ( | Uml::ID::Type | id | ) |

Used to find a reference to a UMLObject by its ID.

Parameters

  id | The UMLObject to find.

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findOrCreateStereotype()

UMLStereotype * UMLDoc::findOrCreateStereotype | ( | const QString & | name | ) |

Finds or creates a stereotype for the parent object.

Parameters

  name | the name of the stereotype

Returns
  the found stereotype object or a just created one

## ◆ findStereotype()

UMLStereotype * UMLDoc::findStereotype | ( | const QString & | name | ) | const

Finds a UMLStereotype by its name.

Parameters

  name | The name of the UMLStereotype to find.

Returns
  Pointer to the UMLStereotype found, or NULL if not found.

## ◆ findStereotypeById()

UMLStereotype * UMLDoc::findStereotypeById | ( | Uml::ID::Type | id | ) | const

Find a UMLStereotype by its unique ID.

Parameters

  id | the unique ID

Returns
  the found stereotype or NULL

## ◆ findUMLClassifier()

UMLClassifier * UMLDoc::findUMLClassifier | ( | const QString & | name | ) |

Used to find a UMLClassifier by its name.

Parameters

  name | The name of the UMLObject to find.

## ◆ findUMLObject()

UMLObject * UMLDoc::findUMLObject | ( | const QString & | name,
|  | UMLObject::ObjectType | type = UMLObject::ot_UMLObject,
|  | UMLObject * | currentObj = 0 )

Used to find a UMLObject by its type and name.

Parameters

  name | The name of the UMLObject to find.
  type | ObjectType of the object to find (optional.) When the given type is ot_UMLObject the type is disregarded, i.e. the given name is the only search criterion.
  currentObj | Object relative to which to search (optional.) If given then the enclosing scope(s) of this object are searched before the global scope.

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRaw() [1/2]

UMLObject * UMLDoc::findUMLObjectRaw | ( | Uml::ModelType::Enum | modelType,
|  | const QString & | name,
|  | UMLObject::ObjectType | type = UMLObject::ot_UMLObject )

Used to find a UMLObject by its type and raw name.

Parameters

  modelType | The model type in which to search for the object
  name | The raw name of the UMLObject to find.
  type | ObjectType of the object to find

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRaw() [2/2]

UMLObject * UMLDoc::findUMLObjectRaw | ( | UMLFolder * | folder,
|  | const QString & | name,
|  | UMLObject::ObjectType | type = UMLObject::ot_UMLObject )

Used to find a UMLObject by its type and raw name.

Parameters

  folder | The UMLFolder in which to search for the object
  name | The raw name of the UMLObject to find.
  type | ObjectType of the object to find

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRecursive() [1/2]

UMLObject * UMLDoc::findUMLObjectRecursive | ( | Uml::ModelType::Enum | modelType,
|  | const QString & | name,
|  | UMLObject::ObjectType | type = UMLObject::ot_UMLObject )

Used to find a UMLObject by its type and raw name recursively

Parameters

  modelType | The model type in which to search for the object
  name | The raw name of the UMLObject to find.
  type | ObjectType of the object to find

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findUMLObjectRecursive() [2/2]

UMLObject * UMLDoc::findUMLObjectRecursive | ( | UMLFolder * | folder,
|  | const QString & | name,
|  | UMLObject::ObjectType | type = UMLObject::ot_UMLObject )

Used to find a UMLObject by its type and raw name recursively

Parameters

  folder | The UMLFolder in which to search for the object
  name | The raw name of the UMLObject to find.
  type | ObjectType of the object to find

Returns
  Pointer to the UMLObject found, or NULL if not found.

## ◆ findView() [1/2]

UMLView * UMLDoc::findView | ( | Uml::DiagramType::Enum | type,
|  | const QString & | name,
|  | bool | searchAllScopes = false ) const

Finds a view (diagram) by the type and name given.

Parameters

  type | The type of view to find.
  name | The name of the view to find.
  searchAllScopes | Search in all subfolders (default: false.)

Returns
  Pointer to the view found, or NULL if not found.

## ◆ findView() [2/2]

UMLView * UMLDoc::findView | ( | Uml::ID::Type | id | ) | const

Finds a view (diagram) by the ID given to method.

Parameters

  id | The ID of the view to search for.

Returns
  Pointer to the view found, or NULL if not found.

## ◆ importing()

bool UMLDoc::importing | ( |  | ) | const

Returns true when importing file(s).

Returns
  the value of the flag

## ◆ init()

void UMLDoc::init | ( |  | ) |

Initialize the UMLDoc. To be called after the constructor, before anything else.

## ◆ initSaveTimer()

void UMLDoc::initSaveTimer | ( |  | ) |
| private

Sets up the autosave timer.

## ◆ isModified()

bool UMLDoc::isModified | ( |  | ) | const

Returns if the document is modified or not. Use this to determine if your document needs saving by the user on closing.

Returns
  True if this UMLDoc is modified.

## ◆ isUnique() [1/2]

bool UMLDoc::isUnique | ( | const QString & | name | ) | const

Returns true if the given name is unique within its scope.

Parameters

  name | The name to check.

Returns
  True if name is unique.

## ◆ isUnique() [2/2]

bool UMLDoc::isUnique | ( | const QString & | name,
|  | UMLPackage * | package ) const

Returns true if the given name is unique within its scope of given package.

Parameters

  name | The name to check.
  package | The UMLPackage in which we have to determine the unique-ness

Returns
  True if name is unique.

## ◆ loadDiagrams1()

bool UMLDoc::loadDiagrams1 | ( |  | ) |

Load all diagrams collected from the xmi file.

Loading diagrams is implemented as additional pass to avoid unresolved uml objects which are defined later in the xmi file.

## ◆ loadDiagramsFromXMI1()

bool UMLDoc::loadDiagramsFromXMI1 | ( | QDomNode & | node | ) |

Loads all diagrams from XMI into the current UMLDoc. For backward compatibility only: Since version 1.5.5 diagrams are saved as part of the UMLFolder.

Returns
  True if operation successful.

## ◆ loadExtensionsFromXMI1()

void UMLDoc::loadExtensionsFromXMI1 | ( | QDomNode & | node | ) |

Loads umbrello specific extensions from XMI to the UMLDoc. The extension tags are: "docsettings", "diagrams", "listview", and "codegeneration".

## ◆ loadFromXMI()

bool UMLDoc::loadFromXMI | ( | QIODevice & | file,
|  | short | encode = ENC_UNKNOWN )
| virtual

Load a given XMI model from a file. If the encoding of the file is already known it can be passed to the function. If this info isn't given, loadFromXMI will check which encoding was used.

Parameters

  file | The file to be loaded.
  encode | The encoding used.

## ◆ loading()

bool UMLDoc::loading | ( |  | ) | const

Returns true when loading a document file.

Returns
  the value of the flag

## ◆ loadUMLObjectsFromXMI()

bool UMLDoc::loadUMLObjectsFromXMI | ( | QDomElement & | element | ) |

Loads all UML objects from XMI into the current UMLDoc.

Returns
  True if operation successful.

## ◆ modelID()

Uml::ID::Type UMLDoc::modelID | ( |  | ) | const

Return the m_modelID (currently this a fixed value: Umbrello supports only a single document.)

## ◆ name()

QString UMLDoc::name | ( |  | ) | const

Return the name of this model.

## ◆ newDocument()

bool UMLDoc::newDocument | ( |  | ) |

Initializes the document generally.

Returns
  True if operation successful.

## ◆ objectsModel()

ObjectsModel * UMLDoc::objectsModel | ( |  | ) | const

## ◆ openDocument()

bool UMLDoc::openDocument | ( | const QUrl & | url,
|  | const char * | format = 0 )

Loads the document by filename and format and emits the updateViews() signal.

Parameters

  url | The filename in KUrl format.
  format | The format (optional.)

Returns
  True if operation successful.

## ◆ packages()

UMLPackageList UMLDoc::packages | ( | bool | includeNested = true,
|  | Uml::ModelType::Enum | model = Uml::ModelType::Logical ) const

Returns a list of the packages in this UMLDoc,

Returns
  List of UMLPackages.

## ◆ print()

void UMLDoc::print | ( | QPrinter * | pPrinter,
|  | DiagramPrintPage * | selectPage )

Controls the printing of the program.

Parameters

  pPrinter | The printer (object) to use.
  selectPage | The DiagramPrintPage by which diagrams are selected for printing

## ◆ removeAllObjects()

void UMLDoc::removeAllObjects | ( |  | ) |

Call to remove all objects in the current file.

## ◆ removeAllViews()

void UMLDoc::removeAllViews | ( |  | ) |

Call to remove all the views (diagrams) in the current file.

## ◆ removeAssociation()

void UMLDoc::removeAssociation | ( | UMLAssociation * | assoc,
|  | bool | doSetModified = true )

Removes an association.

Parameters

  assoc | Pointer to the UMLAssociation to remove.
  doSetModified | Whether to mark the document as modified (default: true.)

## ◆ removeDatatype()

void UMLDoc::removeDatatype | ( | const QString & | name | ) |

Remove a datatype by name. Used when changing the active programming language.

## ◆ removeDiagram()

void UMLDoc::removeDiagram | ( | Uml::ID::Type | id | ) |

Deletes a diagram from the current file.

Undo command

Parameters

  id | The ID of the diagram to delete.

## ◆ removeDiagramCmd()

void UMLDoc::removeDiagramCmd | ( | Uml::ID::Type | id | ) |

Deletes a diagram from the current file.

Parameters

  id | The ID of the diagram to delete.

## ◆ removeStereotype()

void UMLDoc::removeStereotype | ( | UMLStereotype * | s | ) |

Remove a UMLStereotype from the application.

Parameters

  s | the stereotype to be removed

## ◆ removeUMLObject()

void UMLDoc::removeUMLObject | ( | UMLObject * | umlobject,
|  | bool | deleteObject = false )

Removes an UMLObject from the current file. If this object is being represented on a diagram it will also delete all those representations.

Parameters

  umlobject | Pointer to the UMLObject to delete.
  deleteObject | Delete the UMLObject instance.

## ◆ removeView()

void UMLDoc::removeView | ( | UMLView * | view,
|  | bool | enforceCurrentView = true )

Removes a view from the list of currently connected views.

Parameters

  view | Pointer to the UMLView to remove.
  enforceCurrentView | Switch to determine if we have a current view or not. Most of the time, we DO want this, except when exiting the program.

## ◆ renameChildUMLObject()

void UMLDoc::renameChildUMLObject | ( | UMLObject * | o | ) |

Used to rename an operation or attribute of a classifier.

Parameters

  o | The attribute or operation to rename.

## ◆ renameDiagram()

void UMLDoc::renameDiagram | ( | Uml::ID::Type | id | ) |

Used to rename a document. This method takes care of everything. You just need to give the ID of the diagram to the method.

Parameters

  id | The ID of the diagram to rename.

## ◆ renameUMLObject()

void UMLDoc::renameUMLObject | ( | UMLObject * | o | ) |

Used to rename a UMLObject. The UMLObject is to be an actor, use case or classifier.

Parameters

  o | The object to rename.

## ◆ resolution()

qreal UMLDoc::resolution | ( |  | ) | const

Returns coordinates resolution for current document.

Returns
  document resolution in DPI

## ◆ resolveTypes()

void UMLDoc::resolveTypes | ( |  | ) |

Type resolution pass.

## ◆ rootFolder()

UMLFolder * UMLDoc::rootFolder | ( | Uml::ModelType::Enum | mt | ) | const

Return the predefined root folder of the given type.

## ◆ rootFolderType()

Uml::ModelType::Enum UMLDoc::rootFolderType | ( | UMLObject * | obj | ) | const

Return the corresponding Model_Type if the given object is one of the root folders. When the given object is not one of the root folders then return Uml::ModelType::N_MODELTYPES.

## ◆ saveDocument()

bool UMLDoc::saveDocument | ( | const QUrl & | url,
|  | const char * | format = 0 )

Saves the document using the given filename and format.

Parameters

  url | The filename in KUrl format.
  format | The format (optional.)

Returns
  True if operation successful.

Todo
  insert some checks in saveToXMI to detect a failed save attempt

## ◆ saveModified()

bool UMLDoc::saveModified | ( |  | ) |

"save modified" - Asks the user for saving if the document is modified.

Returns
  True if document can be closed.

## ◆ saveToXMI()

void UMLDoc::saveToXMI | ( | QIODevice & | file | ) |
| virtual

This method is called for saving the given model as a XMI file. It is virtual and calls the corresponding saveToXMI() functions of the derived classes.

Parameters

  file | The file to be saved to.

## ◆ setCurrentRoot()

void UMLDoc::setCurrentRoot | ( | Uml::ModelType::Enum | rootType | ) |

Set the current root folder.

Parameters

  rootType | The type of the root folder to set. The element from m_root[] which is indexed by this type is selected.

## ◆ setDocumentation()

void UMLDoc::setDocumentation | ( | const QString & | doc | ) |

Sets the documentation for the project.

Parameters

  doc | The documentation to set for this UMLDoc.

## ◆ setImporting()

void UMLDoc::setImporting | ( | bool | state = true | ) |

Sets importing boolean flag to the value given.

Parameters

  state | value to set

## ◆ setLoading()

void UMLDoc::setLoading | ( | bool | state = true | ) |

Sets loading boolean flag to the value given.

Parameters

  state | value to set

## ◆ setLoadingError()

void UMLDoc::setLoadingError | ( | const QString & | text | ) |

## ◆ setMainViewID()

void UMLDoc::setMainViewID | ( | Uml::ID::Type | viewID | ) |

Sets m_nViewID.

## ◆ setModified()

void UMLDoc::setModified | ( | bool | modified = true | ) |

Sets the modified flag for the document after a modifying action on the view connected to the document.

Parameters

  modified | The value to set the modified flag to.

## ◆ setName()

void UMLDoc::setName | ( | const QString & | name | ) |

Set the name of this model.

## ◆ setResolution()

void UMLDoc::setResolution | ( | qreal | resolution | ) |

Set coordinates resolution for current document.

Parameters

  resolution | document resolution in DPI

## ◆ settingsChanged()

void UMLDoc::settingsChanged | ( | Settings::OptionState & | optionState | ) |

Sets the default settings to the given settings.

Parameters

  optionState | settings

## ◆ setupSignals()

void UMLDoc::setupSignals | ( |  | ) |

Sets up the signals needed by the program for it to work.

## ◆ setUrl()

void UMLDoc::setUrl | ( | const QUrl & | url | ) |

Sets the URL of the document.

Parameters

  url | The KUrl to set.

## ◆ setUrlUntitled()

void UMLDoc::setUrlUntitled | ( |  | ) |

Sets the URL of the document to "Untitled".

## ◆ sigCurrentViewChanged

void UMLDoc::sigCurrentViewChanged | ( |  | ) |
| signal

The diagram being displayed has changed. UMLApp uses this to keep its menu items state up to date.

## ◆ sigDiagramChanged

void UMLDoc::sigDiagramChanged | ( | Uml::DiagramType::Enum |  | ) |
| signal

## ◆ sigDiagramCreated

void UMLDoc::sigDiagramCreated | ( | Uml::ID::Type | id | ) |
| signal

## ◆ sigDiagramRemoved

void UMLDoc::sigDiagramRemoved | ( | Uml::ID::Type | id | ) |
| signal

## ◆ sigDiagramRenamed

void UMLDoc::sigDiagramRenamed | ( | Uml::ID::Type | t | ) |
| signal

## ◆ signalDiagramRenamed()

void UMLDoc::signalDiagramRenamed | ( | UMLView * | view | ) |

Signal a view/diagram has been renamed.

## ◆ signalUMLObjectCreated()

void UMLDoc::signalUMLObjectCreated | ( | UMLObject * | o | ) |

Signal that a UMLObject has been created.

Parameters

  o | The object that has been created.

## ◆ sigObjectCreated

void UMLDoc::sigObjectCreated | ( | UMLObject * |  | ) |
| signal

## ◆ sigObjectRemoved

void UMLDoc::sigObjectRemoved | ( | UMLObject * |  | ) |
| signal

## ◆ sigResetStatusbarProgress

void UMLDoc::sigResetStatusbarProgress | ( |  | ) |
| signal

Reset the status bar.

## ◆ sigSetStatusbarProgress

void UMLDoc::sigSetStatusbarProgress | ( | int | stepPosition | ) |
| signal

Set the progress position of the progressbar.

Parameters

  stepPosition | The step position to set.

## ◆ sigSetStatusbarProgressSteps

void UMLDoc::sigSetStatusbarProgressSteps | ( | int | totalSteps | ) |
| signal

Set the total range of the progressbar.

Parameters

  totalSteps | Total range of the progressbar (0..totalSteps)

## ◆ sigWriteToStatusBar

void UMLDoc::sigWriteToStatusBar | ( | const QString & | text | ) |
| signal

Write text to the status bar.

## ◆ slotAutoSave

void UMLDoc::slotAutoSave | ( |  | ) |
| slot

Called after a specified time to autosave the document.

## ◆ slotDiagramPopupMenu

void UMLDoc::slotDiagramPopupMenu | ( | QWidget * | umlview,
|  | const QPoint & | point )
| slot

Make a popup menu for the tabs signalled from tabWidget's contextMenu().

## ◆ slotRemoveUMLObject

void UMLDoc::slotRemoveUMLObject | ( | UMLObject * | object | ) |
| slot

Simple removal of an object.

Parameters

  object | the UMLObject to be removed

## ◆ stereotypes()

const UMLStereotypeList & UMLDoc::stereotypes | ( |  | ) | const

Returns a list of the stereotypes in this UMLDoc.

Returns
  List of UML stereotypes.

## ◆ stereotypesModel()

StereotypesModel * UMLDoc::stereotypesModel | ( |  | ) | const

## ◆ tagEq()

bool UMLDoc::tagEq | ( | const QString & | inTag,
|  | const QString & | inPattern )
| static

Function for comparing tags in XMI files.

## ◆ uniqueViewName()

QString UMLDoc::uniqueViewName | ( | const Uml::DiagramType::Enum | type | ) | const

Returns a name for the new object, appended with a number if the default name is taken e.g. class diagram, class diagram_1 etc.

Parameters

  type | the diagram type

Returns
  the unique view name

## ◆ url()

const QUrl & UMLDoc::url | ( |  | ) | const

Returns the KUrl of the document.

Returns
  The KUrl of this UMLDoc.

## ◆ validateXMI1Header()

bool UMLDoc::validateXMI1Header | ( | QDomNode & | headerNode | ) |

Ensures the XMI file is a valid UML file. Currently only checks for metamodel=UML.

Parameters

  headerNode | The <XMI.header> node

## ◆ viewIterator()

UMLViewList UMLDoc::viewIterator | ( |  | ) | const

Return the list of views for this document.

Returns
  List of UML views.

## ◆ views()

UMLViewList UMLDoc::views | ( | Uml::DiagramType::Enum | type = Uml::DiagramType::Undefined | ) | const

Return a list of filtered views of this document by type.

Parameters

  type | diagram type to filter

Returns
  List of UML views.

## ◆ writeToStatusBar()

void UMLDoc::writeToStatusBar | ( | const QString & | text | ) |

Write text to the status bar.

Parameters

  text | the text to write

## Member Data Documentation

## ◆ m_bClosing

bool UMLDoc::m_bClosing
| private

True while closeDocument() is executing.

## ◆ m_bLoading

bool UMLDoc::m_bLoading
| private

true if the we're loading a new document

## ◆ m_bTypesAreResolved

bool UMLDoc::m_bTypesAreResolved
| private

True when type resolution pass has been executed.

## ◆ m_count

int UMLDoc::m_count
| private

auxiliary counter for the progress bar

## ◆ m_d

Private* UMLDoc::m_d
| private

## ◆ m_datatypeRoot

UMLFolder* UMLDoc::m_datatypeRoot
| private

Predefined root folder for datatypes, contained in m_root[Uml::mt_Logical]

## ◆ m_diagramsModel

DiagramsModel* UMLDoc::m_diagramsModel
| private

## ◆ m_diagramsToLoad

DiagramsMap UMLDoc::m_diagramsToLoad
| private

## ◆ m_Doc

QString UMLDoc::m_Doc
| private

Documentation for the project.

## ◆ m_doc_url

QUrl UMLDoc::m_doc_url
| private

## ◆ m_importing

bool UMLDoc::m_importing
| private

true if the we're importing

## ◆ m_modelID

Uml::ID::Type UMLDoc::m_modelID
| private

xmi.id of this model in the <UML:Model>

## ◆ m_modified

bool UMLDoc::m_modified
| private

## ◆ m_Name

QString UMLDoc::m_Name
| private

name of this model as stored in the <UML:Model> tag

## ◆ m_nViewID

Uml::ID::Type UMLDoc::m_nViewID
| private

Auxiliary to <docsettings> processing

## ◆ m_objectsModel

ObjectsModel* UMLDoc::m_objectsModel
| private

## ◆ m_pAutoSaveTimer

QTimer* UMLDoc::m_pAutoSaveTimer
| private

Used for autosave

## ◆ m_pChangeLog

IDChangeLog* UMLDoc::m_pChangeLog
| private

Contains all the UMLObject id changes of paste session.

## ◆ m_pCurrentRoot

UMLFolder* UMLDoc::m_pCurrentRoot
| private

Auxiliary variable for currentRoot(): m_pCurrentRoot is only used if UMLApp::app()->currentView() returns 0.

## ◆ m_resolution

qreal UMLDoc::m_resolution
| private

Holds widgets coordinates resolution. Unit is dpi.

## ◆ m_root

UMLFolder* UMLDoc::m_root[Uml::ModelType::N_MODELTYPES]
| private

Array of predefined root folders.

## ◆ m_stereoList

UMLStereotypeList UMLDoc::m_stereoList
| private

The UMLDoc is the sole owner of all stereotypes. UMLStereotype instances are reference counted. When a UMLStereotype is no longer referenced anywhere, its refcount drops to zero. It is then removed from the m_stereoList and it is physically deleted.

## ◆ m_stereotypesModel

StereotypesModel* UMLDoc::m_stereotypesModel
| private

The documentation for this class was generated from the following files:

- umbrello/umldoc.h
- umbrello/umldoc.cpp