blob: 5ea1def16dd6b9b6ea30fdda184ce9200ba67a64 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/***************************************************************************
* *
* 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. *
* *
* copyright (C) 2006-2007 *
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net> *
***************************************************************************/
#ifndef UMLVIEWIMAGEEXPORTER_H
#define UMLVIEWIMAGEEXPORTER_H
#include <tqstring.h>
#include <kurl.h>
class UMLView;
class KFileDialog;
/**
* Exports the view as an image.
* This class takes care of asking the user the needed parameters and
* then exports the view.
*/
class UMLViewImageExporter {
public:
/**
* Constructor for UMLViewImageExporter
*/
UMLViewImageExporter(UMLView* view);
/**
* Destructor for UMLViewImageExporter
*/
virtual ~UMLViewImageExporter() {
}
/**
* Shows a save dialog to the user to get the needed parameters and then exports
* the view.
* If the selected file already exists, an overwrite confirmation
* dialog is shown. If the user doesn't want to overwrite the file,
* the save dialog is shown again.
* The dialog remembers values between calls (in the same application instance,
* although it's not persistent between Umbrello executions).
*
* The status bar shows an information message until the export finishes.
*
* If something went wrong while exporting, an error dialog is shown to the
* user with the error message explaining the problem that happened.
*/
void exportView();
/**
* Returns the URL used to save the image.
*
* @return The URL used to save the image.
*/
KURL getImageURL() const {
return m_imageURL;
}
/**
* Returns the mime type used to save the image.
*
* @return The mime type used to save the image.
*/
TQString getImageMimeType() const {
return m_imageMimeType;
}
private:
/**
* The view to export.
*/
UMLView* m_view;
/**
* The URL used to save the image.
*/
KURL m_imageURL;
/**
* The mime type used to save the image.
*/
TQString m_imageMimeType;
/**
* Shows a save file dialog to the user to get the parameters used
* to export the view.
* If the selected file already exists, an overwrite confirmation
* dialog is shown. If the user doesn't want to overwrite the file,
* the save dialog is shown again.
*
* @return True if the user wants to save the image,
* false if the operation is cancelled.
*/
bool prepareExportView();
/**
* Shows a save file dialog to the user to get the parameters used
* to export the view and updates the attributes with the parameters got.
*
* @return True if the user wants to save the image,
* false if the operation is cancelled.
*/
bool getParametersFromUser();
/**
* Prepares the save file dialog.
* Sets the mime type filter, sensible default values...
*
* @param fileDialog The dialog to prepare.
*/
void prepareFileDialog(KFileDialog &fileDialog);
};
#endif
|