/*
 * Copyright (c) 2006-2009 Pixware. 
 *
 * This file is part of the XMLmind XML Editor project.
 * For conditions of distribution and use, see the accompanying legal.txt file.
 *
 * Styles for DITA map elements. 
 */

@import "common.imp";

/*
 * Implementation of methods topicrefContent and chunkIcon.
 */
@extension "com.xmlmind.xmleditext.dita.MapStyleSheetExtension";

/* mapgroup-d ------------------------------------------------------------- */

topicgroup,
topichead {
    display: block;
}

/* map -------------------------------------------------------------------- */

map {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1; /* first line */
}

@property-value item-collapser()
    collapser(collapsed-icon, icon(pop-right), 
              expanded-icon, icon(pop-down));

@property-group map-content() {
    display: inline;
    content: paragraph(content(item-collapser(), 
                               " ", element-name(), 
                               " ", text(attr(title),
                                         font-family, serif,
                                         font-size, 1.5em,
                                         font-weight, bold),
                               " ", invoke("chunkIcon")),
                       border-width, 1px,
                       border-style, solid,
                       border-top-color, transparent,
                       border-left-color, transparent,
                       border-right-color transparent);
    color: #333333;
}

map:before {
    property-group: map-content();
}

@property-group map-title() {
    font-family: serif;
    font-size: 1.5em;
    margin: 0.83ex 0;
    border-width: 1px;
    border-style: solid;
    border-top-color: transparent;
    border-left-color: transparent;
    border-right-color: transparent;
}

map > title {
    property-group: map-title();
}

navref,
anchor,
topicgroup,
topichead,
topicref {
    display: block;
    collapsible: yes;
    not-collapsible-head: 1; /* first line */
    margin-left: 4ex;
    margin-top: 0.5ex;
    margin-bottom: 0.5ex;
}

map > navref,
map > anchor,
map > topicgroup,
map > topichead,
map > topicref,
relcell > topicgroup,
relcell > topichead,
relcell > topicref {
    margin-left: 0;
}

navref:before,
anchor:before,
topicgroup:before,
topichead:before,
topicref:before {
    display: inline;
    color: #333333;
}

topichead:before {
    content: paragraph(content(item-collapser(), 
                               " ", element-name(), 
                               " ", text(attr(navtitle), 
                                         font-family, serif,
                                         font-weight, bold),
                               " ", invoke("chunkIcon")));
    color: #800080;
}

topicgroup:before {
    content: paragraph(content(item-collapser(), 
                               " ", element-name(),
                               " ", invoke("chunkIcon")));
    color: #008080;
}

topicgroup[collection-type]:before {
    content: paragraph(content(item-collapser(), 
                               " ", element-name(),
                               " collection-type=", text(attr(collection-type),
                                                         font-weight, bold),
                               " ", invoke("chunkIcon")));
}

topicref:before {
    content: invoke("topicrefContent", normal);
    color: #000080;
}

navref:before {
    content: paragraph(content(element-name(), " ",
                               drop-site(icon, icon(square-3),
                                         text, attr(mapref),
                                         command, "ditamap.dropHref",
                                         parameter, "mapref '%{value}'")));
    color: #008000;
}

anchor:before {
    content: paragraph(content(element-name(), " ", 
                               icon(left-target), " ", attr(id)));
    color: #800000;
}

reltable {
    display: table;
    border: 1 solid #D0E0F0;
    margin: 1.33ex 0;
}

reltable > topicmeta {
    display: table-caption;
    /* A table-caption cannot be made collapsible. */
    collapsible: no;
    margin-left: 0;
}

reltable > topicmeta:before {
    content: "";
}

relheader,
relrow {
    display: table-row;
}

relcolspec,
relcell {
    display: table-cell;
    border: 1 solid #D0E0F0;
    padding: 2px;
}

relcolspec {
    content: "";
    vertical-align: middle;
    background-color: #D0E0F0;
}

relcolspec:empty {
    content: "\A0\A0\A0\A0\A0\A0\A0\A0";
    font-weight: bold;
    color: #333333;
}

relcolspec[type]:empty {
    content: "type=" attr(type);
}

/*
 * Also found in topics but these are really map elements.
 */

/* map -------------------------------------------------------------------- */

linktext,
searchtitle,
shortdesc {
    display: block;
    margin-left: 16ex;
    margin-top: 1.33ex;
    margin-bottom: 1.33ex;
}

linktext:before,
searchtitle:before,
shortdesc:before {
    display: marker;
    content: element-name(); /*Support for specialization*/
    marker-offset: fill; /*Nicer*/
    font-size: smaller;
    font-weight: bold;
    color: #333333;
}

/* ---------------------------------------------------------------------------
  When printing
--------------------------------------------------------------------------- */

@media print {
    * {
        line-height: 1.2; 
    }

    *:read-only {
        background-color: transparent;
    }
}

