summaryrefslogtreecommitdiffstats
path: root/kig/filters/exporter.h
blob: b4d9f56bc70cda6c6ebea45469ed0cbfaf45e088 (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
// Copyright (C)  2003  Dominique Devriese <devriese@kde.org>

// 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.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
// 02110-1301, USA.

#ifndef KIG_FILTERS_EXPORTER_H
#define KIG_FILTERS_EXPORTER_H

#include <vector>

class TQString;
class KigDocument;
class KigPart;
class KigWidget;
class TDEActionCollection;

class KigExporter;

class KigExportManager
{
  std::vector<KigExporter*> mexporters;
  KigExportManager();
  ~KigExportManager();
public:
  static KigExportManager* instance();
  void addMenuAction( const KigPart* doc, KigWidget* w,
                      TDEActionCollection* coll );
};

/**
 * Base class for a Kig exporter.
 *
 * Subclass it and implement its methods to have it working.
 */
class KigExporter
{
public:
  virtual ~KigExporter();

  /**
   * Returns a statement like i18n( "Export to image" )
   */
  virtual TQString exportToStatement() const = 0;
  /**
   * Returns a string like i18n( "Image..." )
   */
  virtual TQString menuEntryName() const = 0;
  /**
   * Returns a string with the name of the icon
   */
  virtual TQString menuIcon() const = 0;

  /**
   * Do what you need to do.  It's up to the individual exporters to
   * ask the user for which file to export to etc., because they can
   * do a much better job at that..
   */
  virtual void run( const KigPart& doc, KigWidget& w ) = 0;
};

/**
 * This exporter takes care of the "Export to Image" stuff..
 */
class ImageExporter
  : public KigExporter
{
public:
  ~ImageExporter();
  TQString exportToStatement() const;
  TQString menuEntryName() const;
  TQString menuIcon() const;
  void run( const KigPart& doc, KigWidget& w );
};

/**
 * Guess what this one does ;)
 * It exports to the XFig file format, as documented in the file
 * FORMAT3.2 in the XFig source distribution.
 */
class XFigExporter
  : public KigExporter
{
public:
  ~XFigExporter();
  TQString exportToStatement() const;
  TQString menuEntryName() const;
  TQString menuIcon() const;
  void run( const KigPart& doc, KigWidget& w );
};
#endif