umbrello 2.34.70-5524f40e1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
UMLViewImageExporterModel Class Reference

#include <umlviewimageexportermodel.h>

Collaboration diagram for UMLViewImageExporterModel:

Public Member Functions

 UMLViewImageExporterModel (float resolution=0.0)
 
virtual ~UMLViewImageExporterModel ()
 
QString exportView (UMLScene *scene, const QString &imageType, const KUrl &url) const
 
QStringList exportViews (const UMLViewList &views, const QString &imageType, const QUrl &directory, bool useFolders) const
 

Static Public Member Functions

static QStringList supportedImageTypes ()
 
static QStringList supportedMimeTypes ()
 
static QString imageTypeToMimeType (const QString &imageType)
 
static QString mimeTypeToImageType (const QString &mimeType)
 

Private Member Functions

QString getDiagramFileName (UMLScene *scene, const QString &imageType, bool useFolders=false) const
 
bool prepareDirectory (const KUrl &url) const
 
bool exportViewTo (UMLScene *scene, const QString &imageType, const QString &fileName) const
 
bool exportViewToDot (UMLScene *scene, const QString &fileName) const
 
bool exportViewToEps (UMLScene *scene, const QString &fileName) const
 
bool exportViewToSvg (UMLScene *scene, const QString &fileName) const
 
bool exportViewToPixmap (UMLScene *scene, const QString &imageType, const QString &fileName) const
 

Private Attributes

float m_resolution
 

Static Private Attributes

static QStringList s_supportedImageTypesList
 
static QStringList s_supportedMimeTypesList
 

Detailed Description

Exports a UMLView in various image formats. It can also export all the views in the current document.

The methods in this class don't communicate with the user, so asking the format to save the images in, checking if the target file exists and so on must be done before calling those methods, if needed. The only exception is asking passwords for example when KIO slaves are used, as this operation is made automatically by the KIO classes.

Constructor & Destructor Documentation

◆ UMLViewImageExporterModel()

UMLViewImageExporterModel::UMLViewImageExporterModel ( float  resolution = 0.0)
explicit

Constructor for UMLViewImageExporterModel.

Parameters
resolutionresolution of export in DPI (default 0.0 means export type related default)

◆ ~UMLViewImageExporterModel()

UMLViewImageExporterModel::~UMLViewImageExporterModel ( )
virtual

Destructor for UMLViewImageExporterModel.

Member Function Documentation

◆ exportView()

QString UMLViewImageExporterModel::exportView ( UMLScene scene,
const QString &  imageType,
const KUrl &  url 
) const

Exports the view to the url using the 'imageType' for the image.

This method creates the needed directories, if any. If there was an existing file in the specified url overwrites it without asking. The url used can be local or remote, using supported KIO slaves.

If some problem occurs when exporting, an error message is returned.

Parameters
sceneThe UMLScene to export.
imageTypeThe type of the image the view will be exported to.
urlThe url where the image will be saved.
Returns
The error message if some problem occurred when exporting, or QString() if all went fine.
Here is the call graph for this function:

◆ exportViews()

QStringList UMLViewImageExporterModel::exportViews ( const UMLViewList views,
const QString &  imageType,
const QUrl &  directory,
bool  useFolders 
) const

Exports views in the document to the directory specified in the url using the 'imageType' for the images. The name of the exported images will be like their view's name and using the 'imageType' as extension.

The views are stored in folders in the document. The same tree structure used in the document to store the views can be created in the target directory with 'useFolders'. Only the folders made by the user are created in the target directory (Logical view, use case view and so on aren't created).

This method creates the specified target directory if needed. If there was an existing file with the same path as one to be created overwrites it without asking. The url used can be local or remote, using supported KIO slaves.

Parameters
viewsThe list of views to export.
imageTypeThe type of the images the views will be exported to.
directoryThe url of the directory where the images will be saved.
useFoldersIf the tree structure of the views in the document must be created in the target directory.
Returns
A QStringList with all the error messages that occurred during export. If the list is empty, all the views were exported successfully.
Here is the call graph for this function:

◆ exportViewTo()

bool UMLViewImageExporterModel::exportViewTo ( UMLScene scene,
const QString &  imageType,
const QString &  fileName 
) const
private

Exports the scene to the file 'fileName' as the specified type.

Parameters
sceneThe scene to export.
imageTypeThe type of the image the scene will be exported to.
fileNameThe name of the file where the image will be saved.
Returns
True if the operation was successful, false if a problem occurred while exporting.
Here is the call graph for this function:

◆ exportViewToDot()

bool UMLViewImageExporterModel::exportViewToDot ( UMLScene scene,
const QString &  fileName 
) const
private

Exports the view to the file 'fileName' as a dot file.

Parameters
sceneThe scene to export.
fileNameThe name of the file where the image will be saved.
Returns
True if the operation was successful, false if a problem occurred while exporting.
Here is the call graph for this function:

◆ exportViewToEps()

bool UMLViewImageExporterModel::exportViewToEps ( UMLScene scene,
const QString &  fileName 
) const
private

Exports the view to the file 'fileName' as EPS.

Parameters
sceneThe scene to export.
fileNameThe name of the file where the image will be saved.
Returns
True if the operation was successful, false if a problem occurred while exporting.
Here is the call graph for this function:

◆ exportViewToPixmap()

bool UMLViewImageExporterModel::exportViewToPixmap ( UMLScene scene,
const QString &  imageType,
const QString &  fileName 
) const
private

Exports the view to the file 'fileName' as a pixmap of the specified type. The valid types are those supported by QPixmap save method.

Parameters
sceneThe scene to export.
imageTypeThe type of the image the view will be exported to.
fileNameThe name of the file where the image will be saved.
Returns
True if the operation was successful, false if a problem occurred while exporting.
Here is the call graph for this function:

◆ exportViewToSvg()

bool UMLViewImageExporterModel::exportViewToSvg ( UMLScene scene,
const QString &  fileName 
) const
private

Exports the view to the file 'fileName' as SVG.

Parameters
sceneThe scene to export.
fileNameThe name of the file where the image will be saved.
Returns
True if the operation was successful, false if a problem occurred while exporting.
Here is the call graph for this function:

◆ getDiagramFileName()

QString UMLViewImageExporterModel::getDiagramFileName ( UMLScene scene,
const QString &  imageType,
bool  useFolders = false 
) const
private

Returns the diagram file name.

Parameters
scenethe diagram
imageTypethe image type as file name extension
useFoldersflag whether to add folder to the file name
Returns
the file name with extension
Here is the call graph for this function:

◆ imageTypeToMimeType()

QString UMLViewImageExporterModel::imageTypeToMimeType ( const QString &  imageType)
static

Returns the mime type for an image type. The supported image types are those that the diagrams can be exported to.

Parameters
imageTypeThe type of the image.
Returns
A QString with the equivalent mime type, or QString() if it's unknown.

◆ mimeTypeToImageType()

QString UMLViewImageExporterModel::mimeTypeToImageType ( const QString &  mimeType)
static

Returns the image type for a mime type. The supported image types are those that the diagrams can be exported to.

Parameters
mimeTypeThe mime type.
Returns
A lowercase QString with the equivalent image type, or QString() if it's unknown.

◆ prepareDirectory()

bool UMLViewImageExporterModel::prepareDirectory ( const KUrl &  url) const
private

Creates, if it doesn't exist, the directory to save the file. It also creates all the needed parent directories.

Parameters
urlThe url where the image will be saved.
Returns
True if the operation was successful, false if the directory didn't exist and couldn't be created.
Here is the call graph for this function:

◆ supportedImageTypes()

QStringList UMLViewImageExporterModel::supportedImageTypes ( )
static

Returns a QStringList containing all the supported image types to use when exporting. All the types will be lower case.

Returns
A QStringList containing all the supported image types to use when exporting.

◆ supportedMimeTypes()

QStringList UMLViewImageExporterModel::supportedMimeTypes ( )
static

Returns a QStringList containing all the supported mime types to use when exporting. All the types will be lower case.

Returns
A QStringList containing all the supported mime types to use when exporting.
Here is the call graph for this function:

Member Data Documentation

◆ m_resolution

float UMLViewImageExporterModel::m_resolution
private

◆ s_supportedImageTypesList

QStringList UMLViewImageExporterModel::s_supportedImageTypesList
staticprivate

◆ s_supportedMimeTypesList

QStringList UMLViewImageExporterModel::s_supportedMimeTypesList
staticprivate

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