Back to index

texmacs  1.0.7.15
page_item.cpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : page_item.cpp
00004 * DESCRIPTION: A typesetted document consists of an array of page_items.
00005 *              Each page item contains spacing and page breaking information.
00006 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00007 *******************************************************************************
00008 * This software falls under the GNU general public license version 3 or later.
00009 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00010 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00011 ******************************************************************************/
00012 
00013 #include "Format/page_item.hpp"
00014 #include "Boxes/construct.hpp"
00015 
00016 /******************************************************************************
00017 * Routines for the page item class
00018 ******************************************************************************/
00019 
00020 page_item_rep::page_item_rep (box b2, array<lazy> f2, int n2):
00021   type (PAGE_LINE_ITEM), b (b2), spc (0), penalty (0), fl (f2), nr_cols (n2) {}
00022 page_item_rep::page_item_rep (tree t2, int nr_cols2):
00023   type (PAGE_CONTROL_ITEM), b (empty_box (decorate ())), spc (0),
00024   penalty (HYPH_INVALID), nr_cols (nr_cols2), t (t2) {}
00025 page_item_rep::page_item_rep (int tp2, box b2, space spc2, int pen2,
00026                            array<lazy> fl2, int nr_cols2, tree t2):
00027   type (tp2), b (b2), spc (spc2), penalty (pen2),
00028   fl (fl2), nr_cols (nr_cols2), t (t2) {}
00029 
00030 page_item::page_item (box b, array<lazy> lz, int nr_cols):
00031   rep (tm_new<page_item_rep> (b, lz, nr_cols)) {}
00032 page_item::page_item (tree t, int nr_cols):
00033   rep (tm_new<page_item_rep> (t, nr_cols)) {}
00034 page_item::page_item (int type, box b, space spc, int penalty,
00035                     array<lazy> fl, int nr_cols, tree t):
00036   rep (tm_new<page_item_rep> (type, b, spc, penalty, fl, nr_cols, t)) {}
00037 bool page_item::operator == (page_item item2) { return rep==item2.rep; }
00038 bool page_item::operator != (page_item item2) { return rep!=item2.rep; }
00039 page_item copy (page_item l) {
00040   return page_item (l->type, l->b, l->spc, l->penalty,
00041                   l->fl, l->nr_cols, l->t); }
00042 
00043 tm_ostream&
00044 operator << (tm_ostream& out, page_item item) {
00045   switch (item->type) {
00046   case PAGE_LINE_ITEM:
00047     return out << "line (" << item->b << ")";
00048   case PAGE_HIDDEN_ITEM:
00049     return out << "hidden (" << item->b << ")";
00050   case PAGE_CONTROL_ITEM:
00051     return out << "control (" << item->t << ")";
00052   }
00053   return out << "unknown";
00054 }