~ubuntu-branches/ubuntu/jaunty/cups/jaunty

« back to all changes in this revision

Viewing changes to debian/local/filters/pdf-filters/pdftopdf/P2PObject.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt, Till Kamppeter, Martin Pitt
  • Date: 2009-02-15 18:39:03 UTC
  • mfrom: (6.1.30 jaunty)
  • Revision ID: james.westby@ubuntu.com-20090215183903-i0nhvqyqj4vyn52a
Tags: 1.3.9-13
[ Till Kamppeter ]
* debian/local/filters/pdf-filters/filter/imagetopdf.c: Added support for
  the new "fit-to-page" option (new, more intuitive name for "fitplot").
* debian/filters/pstopdf: Only apply paper size if the "fitplot" or the
  "fit-to-page" option is set.
* debian/local/filters/cpdftocps: Only the last digit of the number of
  copies was used (LP: #309314).
* debian/local/filters/pdf-filters/pdftopdf/pdftopdf.cxx: Do not preceed the
  PDF output with a newline (LP: #303691). Only impose the page size from
  the PPD file to all pages if the "fitplot" or the "fit-to-page" option is 
  set. This prevented from automatic paper tray switching to the correct paper
  sizes when a multiple-page-size document is printed (partial fix for
  LP: #310575).
* debian/patches/pdftops-cups-1.4.dpatch: Updated from CUPS 1.4 SVN. Contains
  fixes for multiple-page-size document printing (partial fix for
  LP: #310575).
* debian/patches/pdftops-dont_fail_on_cancel.dpatch: Removed, should be
  fixed in the new upstream version of pdftops.

[ Martin Pitt ]
* debian/patches/pdftops-cups-1.4.dpatch: Add definition of
  HAVE_PDFTOPS and CUPS_PDFTOPS, so that the filter actually gets
  again built with pdftops support. (Fixes Till's change from above).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 
 
3
Copyright (c) 2006-2007, BBR Inc.  All rights reserved.
 
4
 
 
5
Permission is hereby granted, free of charge, to any person obtaining
 
6
a copy of this software and associated documentation files (the
 
7
"Software"), to deal in the Software without restriction, including
 
8
without limitation the rights to use, copy, modify, merge, publish,
 
9
distribute, sublicense, and/or sell copies of the Software, and to
 
10
permit persons to whom the Software is furnished to do so, subject to
 
11
the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included
 
14
in all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 
17
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 
18
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 
19
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 
20
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 
21
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 
22
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
23
 
 
24
*/
 
25
/*
 
26
 P2PObject.h
 
27
 pdftopdf object
 
28
*/
 
29
#ifndef _P2POBJECT_H_
 
30
#define _P2POBJECT_H_
 
31
 
 
32
#include "P2POutputStream.h"
 
33
#include "P2PXRef.h"
 
34
#include "Object.h"
 
35
#include "P2POutput.h"
 
36
#include "Error.h"
 
37
#include "XRef.h"
 
38
 
 
39
class P2PObject {
 
40
public:
 
41
  /* find object with original object number and generation */
 
42
  static P2PObject *find(int orgNumA, int orgGenA);
 
43
 
 
44
  P2PObject() {
 
45
    next = 0;
 
46
    offset = -1;
 
47
    orgNum = -1;
 
48
    orgGen = -1;
 
49
    num = -1;
 
50
    gen = -1;
 
51
    secondPhase = gFalse;
 
52
    put();
 
53
  }
 
54
  P2PObject(int orgNumA, int orgGenA) {
 
55
    next = 0;
 
56
    offset = -1;
 
57
    orgNum = orgNumA;
 
58
    orgGen = orgGenA;
 
59
    num = -1;
 
60
    gen = -1;
 
61
    secondPhase = gFalse;
 
62
    put();
 
63
  }
 
64
 
 
65
  virtual ~P2PObject() {
 
66
    remove();
 
67
    P2PXRef::remove(this);
 
68
  }
 
69
  void setOffset(int offsetA) {
 
70
    offset = offsetA;
 
71
  }
 
72
  void setOffset(P2POutputStream *str) {
 
73
    offset = str->getPosition();
 
74
  }
 
75
  int getOffset() { return offset; }
 
76
 
 
77
  void setNum(int numA, int genA) {
 
78
    num = numA;
 
79
    gen = genA;
 
80
  }
 
81
 
 
82
  void getNum(int *numA, int *genA) {
 
83
    *numA = num;
 
84
    *genA = gen;
 
85
  }
 
86
 
 
87
  /* output begin object */
 
88
  void outputBegin(P2POutputStream *str);
 
89
  /* output end object */
 
90
  void outputEnd(P2POutputStream *str);
 
91
  /* output reference */
 
92
  void outputRef(P2POutputStream *str);
 
93
 
 
94
  /* output as an object */
 
95
  virtual void output(P2POutputStream *str, XRef *xref) {
 
96
    error(-1,const_cast<char *>("Illegal output call of P2PObject:%d"),num);
 
97
  }
 
98
 
 
99
  GBool isSecondPhase() { return secondPhase; }
 
100
  void setSecondPhase(GBool v) { secondPhase = v; }
 
101
 
 
102
private:
 
103
  /* original object number hash table */
 
104
  static P2PObject **orgTable;
 
105
  /* hash function */
 
106
  static int hash(int num, int gen);
 
107
 
 
108
  /* put this into original object number table */
 
109
  void put();
 
110
  /* remove this from original object number able */
 
111
  void remove();
 
112
 
 
113
  /* original object number */
 
114
  int orgNum;
 
115
  /* original object generation */
 
116
  int orgGen;
 
117
 
 
118
  /* object number */
 
119
  int num;
 
120
  /* object generation */
 
121
  int gen;
 
122
  /* offset in output file */
 
123
  /* when minus value, not output this yet. */
 
124
  int offset;
 
125
  /* next object pointer for list */
 
126
  P2PObject *next;
 
127
  /* flag indicating that should be output in second phase */
 
128
  GBool secondPhase;
 
129
};
 
130
 
 
131
class P2PObj : public P2PObject {
 
132
public:
 
133
  P2PObj() {}
 
134
  P2PObj(Object *objA) {
 
135
    objA->copy(&obj);
 
136
  }
 
137
 
 
138
  virtual ~P2PObj() {
 
139
    obj.free();
 
140
  }
 
141
 
 
142
  virtual void output(P2POutputStream *str, XRef *xref) {
 
143
    if (getOffset() < 0) {
 
144
      int num, gen;
 
145
 
 
146
      getNum(&num,&gen);
 
147
      if (num > 0) outputBegin(str);
 
148
      P2POutput::outputObject(&obj,str,xref);
 
149
      str->putchar('\n');
 
150
      if (num > 0) outputEnd(str);
 
151
    }
 
152
  }
 
153
  void setObj(Object *objA) {
 
154
    obj.free();
 
155
    objA->copy(&obj);
 
156
  }
 
157
  Object *getObj() {
 
158
    return &obj;
 
159
  }
 
160
 
 
161
private:
 
162
  Object obj;
 
163
};
 
164
 
 
165
#endif