LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/toolkit - hf_title.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 67 67 100.0 %
Date: 2012-12-27 Functions: 12 13 92.3 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <precomp.h>
      21             : #include <toolkit/hf_title.hxx>
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <stdlib.h>
      26             : 
      27             : 
      28           1 : const String C_sTitleBorder("0");
      29           1 : const String C_sTitleWidth("100%");
      30           1 : const String C_sTitlePadding("5");
      31           1 : const String C_sTitleSpacing("3");
      32             : 
      33           1 : const String C_sSubTitleBorder("1");
      34           1 : const String C_sSubTitleWidth("100%");
      35           1 : const String C_sSubTitlePadding("5");
      36           1 : const String C_sSubTitleSpacing("0");
      37           1 : const String C_sColSpan("colspan");
      38             : 
      39             : 
      40        7831 : HF_TitleTable::HF_TitleTable( Xml::Element & o_rOut )
      41             :     :   HtmlMaker(o_rOut >> *new Html::Table( C_sTitleBorder,
      42             :                                               C_sTitleWidth,
      43             :                                               C_sTitlePadding,
      44        7831 :                                               C_sTitleSpacing )
      45       23493 :                             << new Html::ClassAttr("title-table")
      46       23493 :                             << new Html::StyleAttr("margin-bottom:6pt;") )
      47             : {
      48        7831 : }
      49             : 
      50        7831 : HF_TitleTable::~HF_TitleTable()
      51             : {
      52        7831 : }
      53             : 
      54             : void
      55        7775 : HF_TitleTable::Produce_Title( const char * i_title )
      56             : {
      57        7775 :     Add_Row()
      58       23325 :         << new Html::ClassAttr("title")
      59        7775 :         << i_title;
      60        7775 : }
      61             : 
      62             : void
      63        4134 : HF_TitleTable::Produce_Title( const char *        i_annotations,
      64             :                               const char *        i_title )
      65             : {
      66        4134 :     if (csv::no_str(i_annotations))
      67             :     {
      68        4078 :         Produce_Title(i_title);
      69        8212 :         return;
      70             :     }
      71             : 
      72             :     Xml::Element &
      73          56 :         rRow = Add_Row();
      74             :     rRow
      75          56 :         << new Html::ClassAttr("title");
      76             : 
      77             :     Xml::Element &
      78             :         rTable = rRow
      79          56 :                     >> *new Html::Table()
      80         168 :                         << new Html::ClassAttr("title-table")
      81         168 :                         << new Html::WidthAttr("99%");
      82             :     Xml::Element &
      83             :         rInnerRow = rTable
      84          56 :                         >> *new Html::TableRow;
      85             :     rInnerRow
      86          56 :         >> *new Html::TableCell
      87         168 :             << new Html::WidthAttr("25%")
      88         168 :             << new Html::ClassAttr("title2")
      89          56 :             << i_annotations;
      90             :     rInnerRow
      91          56 :         >> *new Html::TableCell
      92         168 :             << new Html::WidthAttr("50%")
      93         168 :             << new Html::ClassAttr("title")
      94          56 :             << i_title;
      95             :     rInnerRow
      96          56 :         >> *new Html::TableCell
      97         112 :             << new Html::WidthAttr("*");
      98             : }
      99             : 
     100             : Xml::Element &
     101       22437 : HF_TitleTable::Add_Row()
     102             : {
     103       22437 :     return CurOut()
     104       44874 :             >> *new Html::TableRow
     105       44874 :                 >> *new Html::TableCell;
     106             : }
     107             : 
     108             : 
     109             : inline const char *
     110       26929 : get_SubTitleCssClass(HF_SubTitleTable::E_SubLevel i_eSubTitleLevel)
     111             : {
     112             :     return i_eSubTitleLevel == HF_SubTitleTable::sublevel_1
     113             :             ?   "subtitle"
     114       26929 :             :   "crosstitle";
     115             : }
     116             : 
     117             : 
     118       13747 : HF_SubTitleTable::HF_SubTitleTable( Xml::Element &      o_rOut,
     119             :                                     const String &      i_label,
     120             :                                     const String &      i_title,
     121             :                                     int                 i_nColumns,
     122             :                                     E_SubLevel          i_eSubTitleLevel )
     123             :     :   HtmlMaker( o_rOut
     124       13747 :                     << new Html::Label(i_label)
     125             :                     >> *new Html::Table( C_sSubTitleBorder,
     126             :                                          C_sSubTitleWidth,
     127             :                                          C_sSubTitlePadding,
     128       27494 :                                          C_sSubTitleSpacing )
     129       27494 :                         << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) )
     130             : {
     131             :     csv_assert(i_nColumns > 0);
     132             : 
     133       13747 :     if (i_eSubTitleLevel == sublevel_3)
     134       14312 :         return;
     135             : 
     136             :     Xml::Element &
     137       13182 :         rCell = CurOut()
     138       26364 :                     >> *new Html::TableRow
     139       26364 :                         >> *new Html::TableCell
     140       26364 :                         << new Html::ClassAttr(get_SubTitleCssClass(i_eSubTitleLevel)) ;
     141             : 
     142       13182 :     if (i_nColumns > 1)
     143             :     {
     144        6055 :         StreamLock sl(20);
     145        6055 :         String sColumns = sl() << i_nColumns << c_str;
     146             :         rCell
     147        6055 :             << new Xml::AnAttribute(C_sColSpan, sColumns);
     148             :     }
     149             :     rCell
     150       13182 :         << i_title;
     151             : }
     152             : 
     153       20007 : HF_SubTitleTable::~HF_SubTitleTable()
     154             : {
     155       20007 : }
     156             : 
     157             : Xml::Element &
     158       47828 : HF_SubTitleTable::Add_Row()
     159             : {
     160       47828 :     return CurOut() >> *new Html::TableRow;
     161           3 : }
     162             : 
     163             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10