/* html-ooa/html-ooa-doc.h
Copyright (C) 2008 CONNOTECH Experts-conseils inc.
Written by Thierry Moreau (e-mail:thierry.moreau@connotech.com)
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the
Free Software Foundation; either version 2.1 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation, Inc.,
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
HOW TO CONTACT THE COPYRIGHT HOLDER:
CONNOTECH Experts-conseils inc.
home page: http://www.connotech.com
e-mail to: info@connotech.com
mailing address: 9130 Place de Montgolfier, Montreal, Quebec, Canada, H2M 2A1.
--------------------------------------------------------------------------------
Send bug reports to the above address.
*/
// *************************************
class toc_entry_cl {
public:
html_block_element_cl *toc_entry, *doc_body_entry;
// for reference, section numbering information
int main_no;
std::string annex_id;
std::vector subs_nos;
toc_entry_cl *parent;
std::vector subsections;
private:
void link_to_parent();
void make_two_entries(std::vector &marked_up_text);
public:
toc_entry_cl(int main, std::string text);
toc_entry_cl(int main, std::vector &marked_up_text);
toc_entry_cl(std::string ann, std::string text);
toc_entry_cl(std::string ann, std::vector &marked_up_text);
toc_entry_cl(toc_entry_cl *par, std::string text);
toc_entry_cl(toc_entry_cl *par, std::vector &marked_up_text);
static bool is_toc_target(html_doc_node_cl* pt); /**//* this is sample code for testing */
};
class connodoc_toc_cl {
private:
int main_toc_count;
toc_entry_cl *toc_cursor[6/**/];
html_block_element_cl *pt_toc_div;
html_block_element_cl *pt_toc, *pt_body;
protected:
connodoc_toc_cl()
: main_toc_count(0)
{ for (int i=0;i entries; // e.g. DT, DD as top HTML elements for the bibliographic entry
public:
bibl_ref_cl()
: refer(0), entries()
{}
bibl_ref_cl(html_element_cl *ref, std::vector &ent)
: refer(ref), entries(ent)
{}
bibl_ref_cl(html_element_cl *ref
, html_el_dt *dt
, html_el_dd *dd);
};
// class bibl_ref_cl used in a std::map with a std::string key:
// std::string sorting_value; // author's own reference name space - but defines the order of bibliographic listings
class conno_bibl_sections_cl {
private:
std::map normative_refs;
std::map informative_refs;
void add_rfc(std::map &bibl_refs,std::string s1, std::string s2);
void add_ref(std::map &bibl_refs,std::string s1, html_el_dd *dd);
void add_bibl(std::map &bibl_refs,html_block_element_cl *pt);
public:
int add_normative_rfc(html_block_element_cl *pt,std::string s1, std::string s2);
int add_informative_rfc(html_block_element_cl *pt,std::string s1, std::string s2);
int add_normative_ref(html_block_element_cl *pt, std::string s1, html_el_dd *dd);
int add_informative_ref(html_block_element_cl *pt, std::string s1, html_el_dd *dd);
int add_bibl_ref(html_block_element_cl *pt,std::string s1);
void add_normative_bibl(html_block_element_cl *pt);
void add_informative_bibl(html_block_element_cl *pt);
};
// *************************************
class internal_xref ;
class xref_from ;
class conno_doc_xrefs;
class internal_xref : public html_doc_node_cl {
public:
conno_doc_xrefs * xref_table;
std::list ref_list;
public:
internal_xref(conno_doc_xrefs *doc_table);
virtual void create_doc();
virtual html_doc_node_cl * duplicate();
};
class conno_doc_xrefs {
public:
std::list every_xref;
public:
void allocate(internal_xref *(&xref_var))
{ xref_var=new internal_xref(this); }
static bool is_html_a_target(html_doc_node_cl* pt);
static bool is_html_a_virgin(html_doc_node_cl* pt);
html_el_a * ref_section(internal_xref *target);
void attach_xrefs();
};
class xref_from : public html_doc_node_cl {
public:
internal_xref *targ_anchor;
public:
xref_from(internal_xref *target);
virtual std::string get_anchor_href()=0;
virtual void create_doc();
};
class xref_from_manifest : public virtual xref_from
{
public:
xref_from_manifest(internal_xref *target)
: xref_from(target)
{}
virtual std::vector get_html_frag()=0;
};
class xref_anchor_target : public virtual xref_from
{
public:
xref_anchor_target(internal_xref *target)
: xref_from(target)
{}
virtual std::string get_anchor_href();
virtual html_doc_node_cl * duplicate();
};
class xref_toc_entry_target : public virtual xref_from
{
public:
xref_toc_entry_target(internal_xref *target)
: xref_from(target)
{}
virtual std::string get_anchor_href();
virtual html_doc_node_cl * duplicate();
};
class xref_manifest_toc_entry_target : public xref_toc_entry_target
, public xref_from_manifest
{
public:
xref_manifest_toc_entry_target(internal_xref *target)
: xref_toc_entry_target(target), xref_from_manifest(target), xref_from(target)
{}
virtual std::vector get_html_frag();
virtual html_doc_node_cl * duplicate();
};
// *************************************
class conno_doc_utils {
public:
static std::vector > frame_regular_table
(html_block_element_cl * table_block
,int cols=1
,int body_rows=1
,bool has_header=false
,bool has_footer=false);
};
// *************************************
#define CONNODOC "conno_"
// *************************************