Back to index

texmacs  1.0.7.15
edit_table.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : edit_table.hpp
00004 * DESCRIPTION: Editing matrices, tables and tables
00005 * COPYRIGHT  : (C) 1999  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef EDIT_TABLE_H
00013 #define EDIT_TABLE_H
00014 #include "editor.hpp"
00015 
00016 class edit_table_rep: virtual public editor_rep {
00017 protected:
00018   string cell_mode;
00019 
00020 protected:
00021   // Searching the format, a table, row or cell
00022   path search_format ();
00023   path search_format (path p);
00024   path search_format (int& row, int& col);
00025   path search_table ();
00026   path search_table (path fp);
00027   path search_table (int& row, int& col);
00028   path search_row (path fp, int row);
00029   path search_cell (path p, int col);
00030   path search_cell (path fp, int row, int col);
00031 
00032   // Analyzing with statements in the format
00033   void with_raw_read (tree with, int& i1, int& j1, int& i2, int& j2);
00034   void with_decode (int nr_rows, int nr_cols,
00035                   int& i1, int& j1, int& i2, int& j2);
00036   void with_decode (int nr_rows, int nr_cols,
00037                   int& I1, int& J1, int& I2, int& J2,
00038                   int& i1, int& j1, int& i2, int& j2);
00039   void with_read (tree with, int nr_rows, int nr_cols,
00040                 int& i1, int& j1, int& i2, int& j2);
00041   void with_read (tree with, int nr_rows, int nr_cols,
00042                 int& I1, int& J1, int& I2, int& J2,
00043                 int& i1, int& j1, int& i2, int& j2);
00044   
00045   // Routines for formatting tables
00046   tree table_get_format (path fp);
00047   void table_set_format (path fp, string var, tree val);
00048   tree table_get_format (path fp, string var);
00049   void table_del_format (path fp, string var);
00050   void table_set_format (path fp, int I1, int J1, int I2, int J2,
00051                       string var, tree val);
00052   tree table_get_format (path fp, int I1, int J1, int I2, int J2, string var);
00053   void table_del_format (path fp, int I1, int J1, int I2, int J2, string var);
00054   void table_get_format (path fp, string var,
00055                       tree** val, int nr_rows, int nr_cols);
00056   void table_individualize (path fp, string var);
00057   void table_format_center (path fp, int row, int col);
00058 
00059   // Main routines for manipulating the entire table
00060   void table_get_extents (path fp, int& nr_rows, int& nr_cols);
00061   void table_set_extents (path fp, int nr_rows, int nr_cols);
00062   void table_get_limits (path fp, int& i1, int& j1, int& i2, int& j2);
00063   void table_insert (path fp, int row, int col, int nr_rows, int nr_cols);
00064   void table_remove (path fp, int row, int col, int nr_rows, int nr_cols);
00065   tree table_get_subtable (path p, int i1, int j1, int i2, int j2);
00066   tree table_get_subtable (path p, int i1, int j1, int i2, int j2, bool rec);
00067   void table_write_subtable (path fp, int row, int col, tree subt);
00068   void table_hor_insert_subtable (path fp, int col, tree subt);
00069   void table_ver_insert_subtable (path fp, int row, tree subt);
00070 
00071   // Cell decorations
00072   void table_force_decoration (path fp, int row, int col);
00073   void table_hor_decorate (path fp, int col, int cbef, int caft);
00074   void table_ver_decorate (path fp, int row, int rbef, int raft);
00075 
00076   // Positioning the cursor inside tables
00077   void table_bound (path fp, int& row1, int& col1, int& row2, int& col2);
00078   void table_go_to (path fp, int row, int col, bool at_start= false);
00079   void table_go_to_border (path fp, bool right);
00080   void back_table (path p, bool forward);
00081   void back_in_table (tree t, path p, bool forward);
00082 
00083 public:
00084   edit_table_rep ();
00085   ~edit_table_rep ();
00086 
00087   void   make_table (int nr_rows, int nr_cols);
00088   void   make_subtable (int nr_rows, int nr_cols);
00089   void   destroy_table ();
00090   void   table_disactivate ();
00091   void   table_extract_format ();
00092   void   table_insert_row (bool forward);
00093   void   table_insert_column (bool forward);
00094   void   table_remove_row (bool forward, bool flag= false);
00095   void   table_remove_column (bool forward, bool flag= false);
00096   int    table_nr_rows ();
00097   int    table_nr_columns ();
00098   void   table_set_extents (int rows, int cols);
00099   int    table_which_row ();
00100   int    table_which_column ();
00101   path   table_search_cell (int row, int col);
00102   void   table_go_to (int row, int col);
00103   void   table_set_format (string var, tree val);
00104   string table_get_format (string var);
00105   void   table_del_format (string var);
00106   void   table_format_center ();
00107   void   table_row_decoration (bool forward);
00108   void   table_column_decoration (bool forward);
00109   void   table_correct_block_content ();
00110   void   table_resize_notify ();
00111   void   set_cell_mode (string mode);
00112   string get_cell_mode ();
00113   void   cell_set_format (string var, tree val);
00114   string cell_get_format (string var);
00115   void   cell_del_format (string var);
00116 
00117   void   table_test ();
00118 };
00119 
00120 #endif // defined EDIT_TABLE_H