~ubuntu-branches/ubuntu/hardy/texmacs/hardy

« back to all changes in this revision

Viewing changes to src/Typeset/Format/page_item.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Ralf Treinen
  • Date: 2004-04-19 20:34:00 UTC
  • Revision ID: james.westby@ubuntu.com-20040419203400-g4e34ih0315wcn8v
Tags: upstream-1.0.3-R2
ImportĀ upstreamĀ versionĀ 1.0.3-R2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/******************************************************************************
 
3
* MODULE     : page_item.cpp
 
4
* DESCRIPTION: A typesetted document consists of an array of page_items.
 
5
*              Each page item contains spacing and page breaking information.
 
6
* COPYRIGHT  : (C) 1999  Joris van der Hoeven
 
7
*******************************************************************************
 
8
* This software falls under the GNU general public license and comes WITHOUT
 
9
* ANY WARRANTY WHATSOEVER. See the file $TEXMACS_PATH/LICENSE for more details.
 
10
* If you don't have this file, write to the Free Software Foundation, Inc.,
 
11
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
12
******************************************************************************/
 
13
 
 
14
#include "Format/page_item.hpp"
 
15
#include "Boxes/construct.hpp"
 
16
 
 
17
/******************************************************************************
 
18
* Routines for the page item class
 
19
******************************************************************************/
 
20
 
 
21
page_item_rep::page_item_rep (box b2, array<lazy> f2, int n2):
 
22
  type (PAGE_LINE_ITEM), b (b2), spc (0), penalty (0), fl (f2), nr_cols (n2) {}
 
23
page_item_rep::page_item_rep (tree t2, int nr_cols2):
 
24
  type (PAGE_CONTROL_ITEM), b (empty_box (decorate ())), spc (0),
 
25
  penalty (HYPH_INVALID), nr_cols (nr_cols2), t (t2) {}
 
26
page_item_rep::page_item_rep (int tp2, box b2, space spc2, int pen2,
 
27
                              array<lazy> fl2, int nr_cols2, tree t2):
 
28
  type (tp2), b (b2), spc (spc2), penalty (pen2),
 
29
  fl (fl2), nr_cols (nr_cols2), t (t2) {}
 
30
 
 
31
page_item::page_item (box b, array<lazy> lz, int nr_cols):
 
32
  rep (new page_item_rep (b, lz, nr_cols)) {}
 
33
page_item::page_item (tree t, int nr_cols):
 
34
  rep (new page_item_rep (t, nr_cols)) {}
 
35
page_item::page_item (int type, box b, space spc, int penalty,
 
36
                      array<lazy> fl, int nr_cols, tree t):
 
37
  rep (new page_item_rep (type, b, spc, penalty, fl, nr_cols, t)) {}
 
38
bool page_item::operator == (page_item item2) { return rep==item2.rep; }
 
39
bool page_item::operator != (page_item item2) { return rep!=item2.rep; }
 
40
page_item copy (page_item l) {
 
41
  return page_item (l->type, l->b, l->spc, l->penalty,
 
42
                    l->fl, l->nr_cols, l->t); }
 
43
 
 
44
ostream&
 
45
operator << (ostream& out, page_item item) {
 
46
  switch (item->type) {
 
47
  case PAGE_LINE_ITEM:
 
48
    return out << "line (" << item->b << ")";
 
49
  case PAGE_CONTROL_ITEM:
 
50
    return out << "control (" << item->t << ")";
 
51
  }
 
52
  return out << "unknown";
 
53
}