summaryrefslogtreecommitdiffstats
path: root/src/translators/exporter.h
blob: 28155779e321afeb7e3eb5a5c80f438856dd3c51 (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
/***************************************************************************
    copyright            : (C) 2003-2006 by Robby Stephenson
    email                : robby@periapsis.org
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of version 2 of the GNU General Public License as  *
 *   published by the Free Software Foundation;                            *
 *                                                                         *
 ***************************************************************************/

#ifndef TELLICO_EXPORTER_H
#define TELLICO_EXPORTER_H

class TDEConfig;

class TQWidget;
class TQString;

#include "../entry.h"
#include "../datavectors.h"

#include <kurl.h>

#include <tqobject.h>

namespace Tellico {
  namespace Export {
    enum Options {
      ExportFormatted   = 1 << 0,   // format entries when exported
      ExportUTF8        = 1 << 1,   // valid for some text files, export as utf-8
      ExportImages      = 1 << 2,   // should the images be included?
      ExportForce       = 1 << 3,   // force the export, no confirmation of overwriting
      ExportComplete    = 1 << 4,   // export complete document, including loans, etc.
      ExportProgress    = 1 << 5,   // show progress bar
      ExportClean       = 1 << 6,   // specifically for bibliographies, remove latex commands
      ExportVerifyImages= 1 << 7,   // don't put in an image link that's not in the cache
      ExportImageSize   = 1 << 8    // include image size in the generated XML
    };

/**
 * @author Robby Stephenson
 */
class Exporter : public TQObject {
Q_OBJECT
  

public:
  Exporter();
  Exporter(Data::CollPtr coll);
  virtual ~Exporter();

  Data::CollPtr collection() const;

  void setURL(const KURL& url_) { m_url = url_; }
  void setEntries(const Data::EntryVec& entries) { m_entries = entries; }
  void setOptions(long options) { m_options = options; reset(); }

  virtual TQString formatString() const = 0;
  virtual TQString fileFilter() const = 0;
  const KURL& url() const { return m_url; }
  const Data::EntryVec& entries() const { return m_entries; }
  long options() const { return m_options; }

  /**
   * Do the export
   */
  virtual bool exec() = 0;
  /**
   * If changing options in the exporter should cause member variables to reset, implement
   * that here
   */
  virtual void reset() {}

  virtual TQWidget* widget(TQWidget* parent, const char* name=0) = 0;
  virtual void readOptions(TDEConfig*) {}
  virtual void saveOptions(TDEConfig*) {}

private:
  long m_options;
  Data::CollPtr m_coll;
  Data::EntryVec m_entries;
  KURL m_url;
};

  } // end namespace
} // end namespace
#endif