LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hfi_module.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 113 115 98.3 %
Date: 2012-12-27 Functions: 9 10 90.0 %
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_module.hxx"
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <ary/idl/i_ce.hxx>
      26             : #include <ary/idl/i_module.hxx>
      27             : #include <ary/idl/ik_module.hxx>
      28             : #include <ary/doc/d_oldidldocu.hxx>
      29             : #include <ary/getncast.hxx>
      30             : #include <toolkit/hf_docentry.hxx>
      31             : #include <toolkit/hf_linachain.hxx>
      32             : #include <toolkit/hf_navi_sub.hxx>
      33             : #include <toolkit/hf_title.hxx>
      34             : #include "hfi_doc.hxx"
      35             : #include "hfi_navibar.hxx"
      36             : #include "hfi_tag.hxx"
      37             : #include "hfi_typetext.hxx"
      38             : #include "hi_linkhelper.hxx"
      39             : 
      40             : 
      41             : extern const String
      42           1 :     C_sCePrefix_Module("module");
      43             : 
      44             : namespace
      45             : {
      46             : 
      47             : const String
      48           1 :     C_sList_NestedModules("Nested Modules");
      49             : const String
      50           1 :     C_sList_NestedModules_Label("NestedModules");
      51             : const String
      52           1 :     C_sList_Services("Services");
      53             : const String
      54           1 :     C_sList_Singletons("Singletons");
      55             : const String
      56           1 :     C_sList_Interfaces("Interfaces");
      57             : const String
      58           1 :     C_sList_Structs("Structs");
      59             : const String
      60           1 :     C_sList_Exceptions("Exceptions");
      61             : const String
      62           1 :     C_sList_Enums("Enums");
      63             : const String
      64           1 :     C_sList_Typedefs("Typedefs");
      65             : const String
      66           1 :     C_sList_ConstGroups("Constant Groups");
      67             : const String
      68           1 :     C_sList_ConstGroups_Label("ConstantGroups");
      69             : 
      70             : 
      71             : enum E_SubListIndices
      72             : {   // In case of changes, also adapt make_Navibar() !!
      73             :     sli_NestedModules = 0,
      74             :     sli_Services = 1,
      75             :     sli_Singletons = 2,
      76             :     sli_Interfaces = 3,
      77             :     sli_Structs = 4,
      78             :     sli_Exceptions = 5,
      79             :     sli_Enums = 6,
      80             :     sli_Typedefs = 7,
      81             :     sli_ConstGroups = 8
      82             : };
      83             : 
      84             : } //anonymous namespace
      85             : 
      86             : 
      87         119 : HF_IdlModule::HF_IdlModule( Environment &         io_rEnv,
      88             :                             Xml::Element &        o_rOut )
      89         119 :     :   HtmlFactory_Idl(io_rEnv, &o_rOut)
      90             : {
      91         119 : }
      92             : 
      93         119 : HF_IdlModule::~HF_IdlModule()
      94             : {
      95         119 : }
      96             : 
      97             : typedef ary::idl::ifc_module::attr  ModuleAttr;
      98             : 
      99             : 
     100             : void
     101         119 : HF_IdlModule::Produce_byData( const client & i_ce ) const
     102             : {
     103             :     Dyn<HF_NaviSubRow>
     104         119 :         pNaviSubRow( &make_Navibar(i_ce) );
     105             : 
     106             :     HF_TitleTable
     107         119 :         aTitle(CurOut());
     108             :     HF_LinkedNameChain
     109         119 :         aNameChain(aTitle.Add_Row());
     110             : 
     111         119 :     if ( Env().CurPosition().Depth() > 0 )
     112             :     {
     113         118 :         aNameChain.Produce_CompleteChain_forModule(Env().CurPosition(), nameChainLinker);
     114             : 
     115             :         StreamLock
     116         118 :             sl(200);
     117         118 :         aTitle.Produce_Title( sl()
     118         118 :                                 << C_sCePrefix_Module
     119         118 :                                   << " "
     120         236 :                                 << i_ce.LocalName()
     121         118 :                                 << c_str );
     122             :     }
     123             :     else
     124             :     {
     125           1 :         aTitle.Produce_Title( "Global Module" );
     126             :     }
     127             : 
     128         119 :     write_Docu(aTitle.Add_Row(), i_ce);
     129         119 :     CurOut() << new Html::HorizontalLine();
     130             : 
     131             : 
     132             :     // Write children lists:
     133         119 :     ce_ptr_list aNestedModules;
     134         119 :     ce_ptr_list aServices;
     135         119 :     ce_ptr_list aInterfaces;
     136         119 :     ce_ptr_list aStructs;
     137         119 :     ce_ptr_list aExceptions;
     138         119 :     ce_ptr_list aEnums;
     139         119 :     ce_ptr_list aTypedefs;
     140         119 :     ce_ptr_list aConstantGroups;
     141         119 :     ce_ptr_list aSingletons;
     142             : 
     143             :     ModuleAttr::Get_AllChildrenSeparated(
     144             :                                 aNestedModules,
     145             :                                 aServices,
     146             :                                 aInterfaces,
     147             :                                 aStructs,
     148             :                                 aExceptions,
     149             :                                 aEnums,
     150             :                                 aTypedefs,
     151             :                                 aConstantGroups,
     152             :                                 aSingletons,
     153         119 :                                 Env().Data().Ces(),
     154         119 :                                 i_ce );
     155             : 
     156             :     // Has this to be in the order of enum E_SubListIndices ???
     157         119 :     if (produce_ChildList(C_sList_NestedModules, C_sList_NestedModules_Label, aNestedModules ))
     158          25 :         pNaviSubRow->SwitchOn(sli_NestedModules);
     159         119 :     if (produce_ChildList(C_sList_Services, C_sList_Services, aServices))
     160         103 :         pNaviSubRow->SwitchOn(sli_Services);
     161         119 :     if (produce_ChildList(C_sList_Singletons, C_sList_Singletons, aSingletons))
     162          10 :         pNaviSubRow->SwitchOn(sli_Singletons);
     163         119 :     if (produce_ChildList(C_sList_Interfaces, C_sList_Interfaces, aInterfaces))
     164          99 :         pNaviSubRow->SwitchOn(sli_Interfaces);
     165         119 :     if (produce_ChildList(C_sList_Structs, C_sList_Structs, aStructs))
     166          67 :         pNaviSubRow->SwitchOn(sli_Structs);
     167         119 :     if (produce_ChildList(C_sList_Exceptions, C_sList_Exceptions, aExceptions))
     168          54 :         pNaviSubRow->SwitchOn(sli_Exceptions);
     169         119 :     if (produce_ChildList(C_sList_Enums, C_sList_Enums, aEnums))
     170          41 :         pNaviSubRow->SwitchOn(sli_Enums);
     171         119 :     if (produce_ChildList(C_sList_Typedefs, C_sList_Typedefs, aTypedefs))
     172           8 :         pNaviSubRow->SwitchOn(sli_Typedefs);
     173         119 :     if (produce_ChildList(C_sList_ConstGroups, C_sList_ConstGroups_Label, aConstantGroups))
     174          56 :         pNaviSubRow->SwitchOn(sli_ConstGroups);
     175         119 :     pNaviSubRow->Produce_Row();
     176         119 : }
     177             : 
     178             : DYN HF_NaviSubRow &
     179         119 : HF_IdlModule::make_Navibar( const client & i_ce ) const
     180             : {
     181             :     HF_IdlNavigationBar
     182         119 :         aNaviBar(Env(), CurOut());
     183         119 :     aNaviBar.Produce_ModuleMainRow(i_ce);
     184             : 
     185             :     DYN HF_NaviSubRow &
     186         119 :         ret = aNaviBar.Add_SubRow();
     187             : 
     188             :     // Has to be in the order of E_SubListIndices:
     189         119 :     ret.AddItem(C_sList_NestedModules, C_sList_NestedModules_Label, false);
     190         119 :     ret.AddItem(C_sList_Services, C_sList_Services, false);
     191         119 :     ret.AddItem(C_sList_Singletons, C_sList_Singletons, false);
     192         119 :     ret.AddItem(C_sList_Interfaces, C_sList_Interfaces, false);
     193         119 :     ret.AddItem(C_sList_Structs, C_sList_Structs, false);
     194         119 :     ret.AddItem(C_sList_Exceptions, C_sList_Exceptions, false);
     195         119 :     ret.AddItem(C_sList_Enums, C_sList_Enums, false);
     196         119 :     ret.AddItem(C_sList_Typedefs, C_sList_Typedefs, false);
     197         119 :     ret.AddItem(C_sList_ConstGroups, C_sList_ConstGroups_Label, false);
     198             : 
     199         119 :     CurOut() << new Html::HorizontalLine();
     200         119 :     return ret;
     201             : }
     202             : 
     203             : bool
     204        1071 : HF_IdlModule::produce_ChildList( const String &      i_sName,
     205             :                                  const String &      i_sLabel,
     206             :                                  const ce_ptr_list & i_list ) const
     207             : {
     208        1071 :     if ( i_list.empty() )
     209         608 :         return false;
     210             : 
     211             :     HF_SubTitleTable
     212         463 :         aTable( CurOut(),
     213             :                 i_sLabel,
     214             :                 i_sName,
     215         463 :                 2 );
     216             : 
     217             :     ce_ptr_list::const_iterator
     218         463 :         itEnd = i_list.end();
     219        4715 :     for ( ce_ptr_list::const_iterator it = i_list.begin();
     220             :           it != itEnd;
     221             :           ++it )
     222             :     {
     223             :         Xml::Element &
     224        4252 :             rRow = aTable.Add_Row();
     225        4252 :         produce_Link(rRow, *it);
     226        4252 :         produce_LinkDoc(rRow, *it);
     227             :     }   // end for
     228             : 
     229         463 :     return true;
     230             : }
     231             : 
     232             : void
     233        4252 : HF_IdlModule::produce_Link( Xml::Element &      o_row,
     234             :                             const client *      i_ce ) const
     235             : {
     236             :     csv_assert(i_ce != 0);
     237             :     Xml::Element &
     238             :         rCell = o_row
     239        4252 :                 >> *new Html::TableCell
     240        8504 :                     << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
     241             : 
     242        4252 :     if ( NOT ary::is_type<ary::idl::Module>(*i_ce) )
     243             :     {
     244             :         HF_IdlTypeText
     245        4134 :             aText(Env(), rCell);
     246        4134 :         aText.Produce_byData(i_ce->CeId());
     247             :     }
     248             :     else
     249             :     {
     250         118 :         StreamLock slBuf(100);
     251             :          rCell
     252         118 :             >> *new Html::Link( slBuf() << i_ce->LocalName()
     253         118 :                                         << "/module-ix.html"
     254         236 :                                         << c_str )
     255         354 :                 << i_ce->LocalName();
     256             :     }
     257        4252 : }
     258             : 
     259             : void
     260        4252 : HF_IdlModule::produce_LinkDoc( Xml::Element &      o_row,
     261             :                                const client *      i_ce ) const
     262             : {
     263             :     csv_assert(i_ce != 0);
     264             : 
     265             :     // We need the cell in any case, because, the rendering may be hurt else.
     266             :     Xml::Element &
     267             :         rCell = o_row
     268        4252 :                     >> *new Html::TableCell
     269        8504 :                         << new Html::ClassAttr(C_sCellStyle_SummaryRight);
     270             : 
     271             :     const client &
     272        4252 :         rCe = *i_ce;
     273             :     const ce_info *
     274        4252 :         pShort = Get_IdlDocu(rCe.Docu());
     275        4252 :     if ( pShort == 0 )
     276        4252 :         return;
     277             : 
     278             : 
     279        2799 :     if (pShort->IsDeprecated())
     280             :     {
     281           0 :         rCell << "[ DEPRECATED ]" << new Html::LineBreak;
     282             :     }
     283        2799 :     if (pShort->IsOptional())
     284             :     {
     285           0 :         rCell << "[ OPTIONAL ]" << new Html::LineBreak;
     286             :     }
     287             : 
     288             :     HF_IdlDocuTextDisplay
     289        2799 :         aShortDisplay(Env(), &rCell, *i_ce);
     290        2799 :     pShort->Short().DisplayAt(aShortDisplay);
     291           3 : }
     292             : 
     293             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10