File: xmloutputdev.h

package info (click to toggle)
pdftoipe 20040630-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,552 kB
  • ctags: 3,413
  • sloc: cpp: 36,882; ansic: 2,877; makefile: 37
file content (96 lines) | stat: -rw-r--r-- 2,860 bytes parent folder | download | duplicates (2)
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
// -*- C++ -*-
// --------------------------------------------------------------------
// XmlOutputDev.h
// --------------------------------------------------------------------

#ifndef XMLOUTPUTDEV_H
#define XMLOUTPUTDEV_H

#include <stddef.h>
#include "object.h"
#include "outputdev.h"

class GfxPath;
class GfxFont;

#define PDFTOIPE_VERSION "2004/06/30"

class XmlOutputDev: public OutputDev
{
public:

  // Open an XML output file, and write the prolog.
  XmlOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
	       int firstPage, int lastPage, GBool isMath, GBool noText);
  
  // Destructor -- writes the trailer and closes the file.
  virtual ~XmlOutputDev();

  // Check if file was successfully created.
  virtual GBool isOk() { return ok; }

  bool hasUnicode() const { return iUnicode; }

  //---- get info about output device

  // Does this device use upside-down coordinates?
  // (Upside-down means (0,0) is the top left corner of the page.)
  virtual GBool upsideDown() { return gFalse; }

  // Does this device use drawChar() or drawString()?
  virtual GBool useDrawChar() { return gTrue; }

  // Does this device use beginType3Char/endType3Char?  Otherwise,
  // text in Type 3 fonts will be drawn with drawChar/drawString.
  virtual GBool interpretType3Chars() { return gFalse; }

  //----- initialization and control

  // Start a page.
  virtual void startPage(int pageNum, GfxState *state);

  // End a page.
  virtual void endPage();

  //----- update graphics state
  virtual void updateTextPos(GfxState *state);

  //----- path painting
  virtual void stroke(GfxState *state);
  virtual void fill(GfxState *state);
  virtual void eoFill(GfxState *state);

  //----- text drawing
  virtual void drawChar(GfxState *state, double x, double y,
			double dx, double dy,
			double originX, double originY,
			CharCode c, Unicode *u, int uLen);

  //----- image drawing
  virtual void drawImageMask(GfxState *state, Object *ref, Stream *str,
			     int width, int height, GBool invert,
			     GBool inlineImg);
  virtual void drawImage(GfxState *state, Object *ref, Stream *str,
			 int width, int height, GfxImageColorMap *colorMap,
			 int *maskColors, GBool inlineImg);

private:
  void doPath(GfxState *state);
  void finishText();
  void writePSChar(int code);
  void writePS(char *s);
  void writePSFmt(const char *fmt, ...);

 private:
  OCFILE *outputStream;
  int seqPage;			// current sequential page number
  XRef *xref;			// the xref table for this PDF file
  GBool ok;			// set up ok?
  bool iIsMath;                 // make text objects math formulas
  bool iNoText;                 // discard text objects 
  bool inText;                  // inside a text object
  bool iUnicode;                // has a Unicode character been used?
};

// --------------------------------------------------------------------
#endif