LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hfi_xrefpage.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 114 115 99.1 %
Date: 2012-12-27 Functions: 10 11 90.9 %
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 "hfi_xrefpage.hxx"
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <ary/idl/i_ce.hxx>
      26             : #include <ary/idl/i_gate.hxx>
      27             : #include <ary/idl/ip_ce.hxx>
      28             : #include <toolkit/hf_title.hxx>
      29             : #include "hfi_navibar.hxx"
      30             : #include "hfi_typetext.hxx"
      31             : #include "hi_env.hxx"
      32             : 
      33             : 
      34             : namespace
      35             : {
      36             : 
      37             : const String
      38           1 :     C_sTitleStart("uses of ");
      39             : const String
      40           1 :     C_sCRLF("\n");
      41             : const String
      42           1 :     C_sDevMan("References in Developers Guide");
      43             : 
      44             : }   // anonymous namespace
      45             : 
      46             : 
      47             : 
      48        3551 : HF_IdlXrefs::HF_IdlXrefs( Environment &         io_rEnv,
      49             :                           Xml::Element &        o_rOut,
      50             :                           const String &        i_prefix,
      51             :                           const client &        i_ce )
      52             :     :   HtmlFactory_Idl(io_rEnv, &o_rOut),
      53        3551 :         rContentDirectory(*new Html::Paragraph),
      54        7102 :         pClient(&i_ce)
      55             : {
      56        3551 :     produce_Main(i_prefix, i_ce);
      57        3551 : }
      58             : 
      59        3551 : HF_IdlXrefs::~HF_IdlXrefs()
      60             : {
      61        3551 : }
      62             : 
      63             : void
      64        3551 : HF_IdlXrefs::Write_ManualLinks( const client &  i_ce ) const
      65             : {
      66             :     const StringVector &
      67        3551 :         rLinks2Refs = i_ce.Secondaries().Links2RefsInManual();
      68        3551 :     if ( rLinks2Refs.empty() )
      69             :     {
      70             :         rContentDirectory
      71        2467 :             << C_sDevMan
      72        4934 :             << new Html::LineBreak
      73        2467 :             << C_sCRLF;
      74        3551 :         return;
      75             :     }
      76             : 
      77             : 
      78             :     rContentDirectory
      79        2168 :         >> *new Html::Link("#devmanrefs")
      80        1084 :             << C_sDevMan
      81        2168 :             << new Html::LineBreak
      82        1084 :             << C_sCRLF;
      83             : 
      84             :     HF_SubTitleTable
      85        1084 :         aList(CurOut(), "devmanrefs", C_sDevMan, 1);
      86             :     Xml::Element &
      87        1084 :         rOutCell = aList.Add_Row() >>* new Html::TableCell;
      88             : 
      89             :     csv_assert(rLinks2Refs.size() % 2 == 0);
      90       11259 :     for ( StringVector::const_iterator it = rLinks2Refs.begin();
      91        7506 :           it != rLinks2Refs.end();
      92             :           ++it )
      93             :     {
      94             :         Xml::Element &
      95        2669 :             rLink = rOutCell >> *new Html::Link( Env().Link2Manual(*it));
      96        2669 :         if ( (*(it+1)).empty() )
      97             : 
      98             :             // HACK KORR_FUTURE
      99             :             // Research what happens with manual links which contain normal characters
     100             :             // in non-utf-8 texts. And research, why utfF-8 does not work here.
     101           0 :             rLink << new Xml::XmlCode(*it);
     102             :         else
     103             :             // HACK KORR_FUTURE, see above.
     104        2669 :             rLink << new Xml::XmlCode( *(it+1) );
     105             :         rOutCell
     106        2669 :             << new Html::LineBreak
     107        2669 :             << C_sCRLF;
     108        2669 :         ++it;
     109        1084 :     }   // end for
     110             : }
     111             : 
     112             : void
     113       14613 : HF_IdlXrefs::Produce_List( const char *        i_title,
     114             :                            const char *        i_label,
     115             :                            ce_list &           i_iterator ) const
     116             : {
     117       14613 :     if (NOT i_iterator)
     118             :     {
     119             :         rContentDirectory
     120       12062 :             << i_title
     121       24124 :             << new Html::LineBreak
     122       12062 :             << C_sCRLF;
     123       14613 :         return;
     124             :     }
     125             : 
     126             :     csv_assert(*i_label == '#');
     127             : 
     128             :     rContentDirectory
     129        5102 :         >> *new Html::Link(i_label)
     130        2551 :             << i_title
     131        5102 :             << new Html::LineBreak
     132        2551 :             << C_sCRLF;
     133             : 
     134             :     HF_SubTitleTable
     135        2551 :         aList(CurOut(), i_label+1, i_title, 1);
     136             :     Xml::Element &
     137        2551 :         rOutCell = aList.Add_Row() >>* new Html::TableCell;
     138             :     HF_IdlTypeText
     139        2551 :         aTypeWriter(Env(), rOutCell, pClient);
     140       18373 :     for ( ce_list & it = i_iterator; it; ++it )
     141             :     {
     142       15822 :         aTypeWriter.Produce_byData(*it);
     143       15822 :         rOutCell << new Html::LineBreak;
     144        2551 :     }   // end for
     145             : }
     146             : 
     147             : void
     148        2268 : HF_IdlXrefs::Produce_Tree(  const char *        i_title,
     149             :                             const char *        i_label,
     150             :                             const client &      i_ce,
     151             :                             F_GET_SUBLIST       i_sublistcreator ) const
     152             : {
     153        2268 :     dyn_ce_list pResult;
     154        2268 :     (*i_sublistcreator)(pResult, i_ce);
     155             : 
     156        2268 :     if (NOT (*pResult).operator bool())
     157             :     {
     158             :         rContentDirectory
     159        1906 :             << i_title
     160        3812 :             << new Html::LineBreak
     161        1906 :             << C_sCRLF;
     162        2268 :         return;
     163             :     }
     164             : 
     165             :     csv_assert(*i_label == '#');
     166             : 
     167             :     rContentDirectory
     168         724 :         >> *new Html::Link(i_label)
     169         362 :             << i_title
     170         724 :             << new Html::LineBreak
     171         362 :             << C_sCRLF;
     172             : 
     173             :     HF_SubTitleTable
     174         362 :         aList(CurOut(), i_label+1, i_title, 1);
     175             :     Xml::Element &
     176         362 :         rOut = aList.Add_Row()
     177         724 :                     >>* new Html::TableCell
     178         724 :                         >> *new csi::xml::AnElement("pre")
     179         724 :                             << new csi::html::StyleAttr("font-family:monospace;");
     180             : 
     181             :     recursive_make_ListInTree( rOut,
     182             :                                0,
     183             :                                i_ce,
     184         362 :                                *pResult,
     185         362 :                                i_sublistcreator );
     186             : }
     187             : 
     188             : void
     189        3551 : HF_IdlXrefs::produce_Main( const String &        i_prefix,
     190             :                            const client &        i_ce ) const
     191             : {
     192        3551 :     make_Navibar(i_ce);
     193             : 
     194             :     HF_TitleTable
     195        3551 :         aTitle(CurOut());
     196        3551 :     StreamLock sl(200);
     197        3551 :     aTitle.Produce_Title( sl()
     198        3551 :                           << C_sTitleStart
     199        3551 :                           << i_prefix
     200        3551 :                           << " "
     201        7102 :                           << i_ce.LocalName()
     202        3551 :                           << c_str );
     203             : 
     204        3551 :     aTitle.Add_Row() << &rContentDirectory;
     205        3551 :     sl().reset();
     206             :     rContentDirectory
     207        3551 :         >> *new Html::Link( sl()    << i_ce.LocalName()
     208        3551 :                                     << ".html"
     209        7102 :                                     << c_str )
     210        7102 :             >> *new Html::Bold
     211        3551 :                 << "back to "
     212        3551 :                 << i_prefix
     213        3551 :                 << " "
     214        7102 :                 << i_ce.LocalName();
     215             :     rContentDirectory
     216        3551 :         << new Html::LineBreak
     217        7102 :         << new Html::LineBreak
     218        3551 :         << C_sCRLF;
     219             : 
     220        3551 :     CurOut() << new Html::HorizontalLine();
     221        3551 : }
     222             : 
     223             : void
     224        3551 : HF_IdlXrefs::make_Navibar( const client & i_ce ) const
     225             : {
     226             :     HF_IdlNavigationBar
     227        3551 :         aNaviBar(Env(), CurOut());
     228        3551 :     aNaviBar.Produce_CeXrefsMainRow(i_ce);
     229        3551 :     CurOut() << new Html::HorizontalLine();
     230        3551 : }
     231             : 
     232             : void
     233         935 : HF_IdlXrefs::recursive_make_ListInTree( Xml::Element &      o_rDisplay,
     234             :                                         uintt               i_level,
     235             :                                         const client &      i_ce,
     236             :                                         ce_list &           i_iterator,
     237             :                                         F_GET_SUBLIST       i_sublistcreator ) const
     238             : {
     239         935 :     const char * sLevelIndentation = "    ";
     240             : 
     241             :     HF_IdlTypeText
     242         935 :         aTypeWriter(Env(), o_rDisplay, &i_ce);
     243        4433 :     for ( ; i_iterator.operator bool(); ++i_iterator )
     244             :     {
     245        5443 :         for (uintt i = 0; i < i_level; ++i)
     246             :         {
     247        1945 :             o_rDisplay << sLevelIndentation;
     248             :         }   // end for
     249             : 
     250        3498 :         aTypeWriter.Produce_byData(*i_iterator);
     251        3498 :         o_rDisplay << C_sCRLF;
     252             : 
     253        3498 :         dyn_ce_list     pResult;
     254        3498 :         const client &  rCe = Env().Gate().Ces().Find_Ce(*i_iterator);
     255        3498 :         (*i_sublistcreator)(pResult, rCe);
     256        3498 :         if ( (*pResult).operator bool() )
     257             :         {
     258             :             recursive_make_ListInTree( o_rDisplay,
     259             :                                        i_level + 1,
     260             :                                        rCe,
     261         573 :                                        *pResult,
     262         573 :                                        i_sublistcreator );
     263             :         }
     264        4433 :     }   // end for
     265         938 : }
     266             : 
     267             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10