summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/docgenerators/xhtmlgenerator.h
blob: a6b8e6a47d4de44d9d51d6e4737a0a62b1ecf85d (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
/***************************************************************************
                          xhtmlgenerator.h  -  description
                             -------------------
    begin                : Sat Jun 24 2006
    copyright            : (C) 2006 by Gael de Chalendar (aka Kleag)
    email                : kleag@free.fr
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   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 XHTMLGENERATOR_H
#define XHTMLGENERATOR_H

#include <kurl.h>
#include <ktempdir.h>
#include <tqobject.h>

namespace TDEIO
{
  class Job;
}

/**
 * class XhtmlGenerator is a documentation generator for UML documents.
 * It uses first @ref DocbookGenerator to convert the XMI generated by
 * UMLDoc::saveToXMI to docbook and next libxslt through
 * the XSLT file stored in resources to convert the docbook file to XHTML.
 * The latter uses the XSLT available on the Web at
 * http://docbook.sourceforge.net/release/xsl/snapshot/html/docbook.xsl
 *
 * @todo allow to specify the destination and ensure that it works with distant
 * ones
 */
class XhtmlGenerator : public TQObject
{
  Q_OBJECT
  
  public:

    /**
     * Constructor
     */
    XhtmlGenerator();

    /**
     * Empty Destructor
     */
    virtual ~XhtmlGenerator();

    /**
     * Exports the current model to XHTML in a directory named as the model
     * with the .xmi suffix removed. The XHTML file will have the same name
     * with the .html suffix. Figures will be named as the corresponding
     * diagrams in the GUI
     * @todo change file naming to avoid paths with spaces or non-ASCII chars
     * @todo better handling of error conditions
     * @return true if saving is successful and false otherwise.
     */
    bool generateXhtmlForProject();

    /**
     * Exports the current model to XHTML in the given directory
     * @param destDir the directory where the XHTML file and the figures will
     * be written
     * @todo better handling of error conditions
     * @return true if saving is successful and false otherwise.
     */
    bool generateXhtmlForProjectInto(const KURL& destDir);

  signals:

    /** Emited when the documentation generation is finished */
    void finished();

  protected slots:

    /** This slot is triggerd when the first part, xmi to docbook, is
     * finished
     * @param docbookJob the job copying the docbook file to its destination.
     * Used only for error reporting
     */
    void slotDocbookToXhtml(TDEIO::Job * docbookJob);

    /** Triggered when the copying of the HTML result file is finished. Emits
     * the signal finished().
     */
    void slotHtmlCopyFinished( TDEIO::Job* );

  private:

    /** The destination directory where the final documentation will be
     * written.
     */
    KURL m_destDir;
//     KTempDir m_tmpDir;
};

#endif // XHTMLGENERATOR_H