LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hfi_doc.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 78 78 100.0 %
Date: 2012-12-27 Functions: 7 8 87.5 %
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_doc.hxx"
      22             : 
      23             : 
      24             : // NOT FULLY DEFINED SERVICES
      25             : #include <ary/idl/i_ce.hxx>
      26             : #include <ary/doc/d_oldidldocu.hxx>
      27             : #include <ary_i/d_token.hxx>
      28             : #include <toolkit/hf_docentry.hxx>
      29             : #include "hfi_tag.hxx"
      30             : #include "hi_ary.hxx"
      31             : 
      32             : 
      33             : 
      34             : 
      35       18598 : HF_IdlDocu::HF_IdlDocu( Environment &       io_rEnv,
      36             :                         HF_DocEntryList &   o_rOut )
      37       18598 :     :   HtmlFactory_Idl( io_rEnv, &o_rOut.CurOut() ),
      38       18598 :         rOut(o_rOut)
      39             : {
      40       18598 : }
      41             : 
      42       18598 : HF_IdlDocu::~HF_IdlDocu()
      43             : {
      44       18598 : }
      45             : 
      46             : void
      47       16635 : HF_IdlDocu::Produce_fromCodeEntity( const client & i_ce ) const
      48             : {
      49             :     const ce_info *
      50       16635 :         i_pDocu = Get_IdlDocu(i_ce.Docu());
      51       16635 :     if (i_pDocu != 0)
      52       16635 :         Produce_byDocuAndScope(*i_pDocu, &i_ce, i_ce);
      53       16635 : }
      54             : 
      55             : void
      56        1963 : HF_IdlDocu::Produce_fromReference( const ce_info &   i_rDocuForReference,
      57             :                                    const client &    i_rScopeGivingCe ) const
      58             : {
      59        1963 :     Produce_byDocuAndScope(i_rDocuForReference, 0, i_rScopeGivingCe );
      60        1963 : }
      61             : 
      62             : void
      63       18598 : HF_IdlDocu::Produce_byDocuAndScope( const ce_info & i_rDocu,
      64             :                                     const client *  i_pClient,
      65             :                                     const client &  i_rScopeGivingCe ) const
      66             : {
      67       18598 :     bool bShort = NOT i_rDocu.Short().IsEmpty();
      68       18598 :     bool bDescr = NOT i_rDocu.Description().IsEmpty();
      69             : 
      70       56342 :     if ( i_rDocu.IsDeprecated()
      71             :          OR (
      72       16558 :              (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false)
      73        2732 :              AND NOT i_rDocu.IsPublished()
      74             :             )
      75       18454 :          OR i_rDocu.IsOptional() )
      76             :     {   // any usage restriction
      77        1564 :         rOut.Produce_Term("Usage Restrictions");
      78             : 
      79        1564 :         if ( i_rDocu.IsDeprecated() )
      80          88 :             rOut.Produce_Definition() >> *new Html::Italic << "deprecated";
      81        1620 :         if ( (i_pClient != 0 ? i_pClient->SightLevel() == ary::idl::sl_File : false)
      82          56 :              AND NOT i_rDocu.IsPublished() )
      83          56 :             rOut.Produce_Definition() >> *new Html::Italic << "not published";
      84        1564 :         if ( i_rDocu.IsOptional() )
      85        1436 :             rOut.Produce_Definition() >> *new Html::Italic << "optional";
      86             : 
      87        1652 :         if ( i_rDocu.IsDeprecated() AND
      88             :              // KORR_FUTURE
      89             :              // Workaround, because DocuTex2::IsEmpty() does not
      90             :              //   calculate whitespace tokens only as empty.
      91          88 :              i_rDocu.DeprecatedText().Tokens().size() > 1 )
      92             :         {
      93          22 :             rOut.Produce_Term("Deprecation Info");
      94             : 
      95             :             HF_IdlDocuTextDisplay
      96          22 :                 aDescription( Env(), 0, i_rScopeGivingCe);
      97          22 :             aDescription.Out().Enter( rOut.Produce_Definition() );
      98          22 :             i_rDocu.DeprecatedText().DisplayAt( aDescription );
      99          22 :             aDescription.Out().Leave();
     100             :         }
     101             :     }   // end if (<any usage restriction>)
     102             : 
     103       18598 :     if ( bShort OR bDescr )
     104             :     {
     105       15338 :         rOut.Produce_Term("Description");
     106             :         HF_IdlDocuTextDisplay
     107       15338 :                 aDescription( Env(), 0, i_rScopeGivingCe);
     108       15338 :         if (bShort)
     109             :         {
     110       15330 :             aDescription.Out().Enter( rOut.Produce_Definition() );
     111       15330 :             i_rDocu.Short().DisplayAt( aDescription );
     112       15330 :             aDescription.Out().Leave();
     113             :         }
     114       15338 :         if (bDescr)
     115             :         {
     116        3305 :             aDescription.Out().Enter( rOut.Produce_Definition() );
     117        3305 :             i_rDocu.Description().DisplayAt( aDescription );
     118        3305 :             aDescription.Out().Leave();
     119       15338 :         }
     120             :     }
     121             : 
     122             :     std::vector< csi::dsapi::DT_SeeAlsoAtTag* >
     123       18598 :         aSeeAlsosWithoutText;
     124             :     std::vector< csi::dsapi::DT_SeeAlsoAtTag* >
     125       18598 :         aSeeAlsosWithText;
     126             : 
     127       83553 :     for ( std::vector< ary::inf::AtTag2* >::const_iterator
     128       18598 :                 iter = i_rDocu.Tags().begin();
     129       55702 :           iter != i_rDocu.Tags().end();
     130             :           ++iter )
     131             :     {
     132             :         csi::dsapi::DT_SeeAlsoAtTag*
     133        9253 :             pSeeAlso = dynamic_cast< csi::dsapi::DT_SeeAlsoAtTag * >(*iter);
     134        9253 :         if (pSeeAlso != 0 )
     135             :         {
     136        1615 :             if ( pSeeAlso->Text().IsEmpty() )
     137             :             {
     138        1577 :                 aSeeAlsosWithoutText.push_back(pSeeAlso);
     139             :             }
     140             :             else
     141             :             {
     142          38 :                 aSeeAlsosWithText.push_back(pSeeAlso);
     143             :             }
     144        1615 :             continue;
     145             :         }
     146             : 
     147        7638 :         if ( strlen( (*iter)->Title() ) > 0 )
     148             :         {
     149             :             HF_IdlTag
     150        7547 :                     aTag(Env(), i_rScopeGivingCe);
     151             :             Xml::Element &
     152        7547 :                 rTerm = rOut.Produce_Term();
     153             :             aTag.Produce_byData( rTerm,
     154        7547 :                                  rOut.Produce_Definition(),
     155       15094 :                                  *(*iter) );
     156             :         }
     157             :     }   // end for
     158             : 
     159       18598 :     if (!aSeeAlsosWithoutText.empty())
     160             :     {
     161             :         HF_IdlTag
     162        1248 :             aSeeAlsoTag(Env(),  i_rScopeGivingCe);
     163             :         Xml::Element &
     164        1248 :             rTerm = rOut.Produce_Term();
     165             :         aSeeAlsoTag.Produce_byData( rTerm,
     166        1248 :                                     rOut.Produce_Definition(),
     167        1248 :                                     aSeeAlsosWithoutText );
     168             :     }
     169             : 
     170       55908 :     for ( std::vector< csi::dsapi::DT_SeeAlsoAtTag* >::const_iterator
     171       18598 :                 itSee2 = aSeeAlsosWithText.begin();
     172       37272 :           itSee2 != aSeeAlsosWithText.end();
     173             :           ++itSee2 )
     174             :     {
     175             :         HF_IdlTag
     176          38 :             aTag(Env(),  i_rScopeGivingCe);
     177             :         Xml::Element &
     178          38 :             rTerm = rOut.Produce_Term();
     179             :             aTag.Produce_byData( rTerm,
     180          38 :                                  rOut.Produce_Definition(),
     181          76 :                                  *(*itSee2) );
     182       18636 :     }   // end for
     183       18601 : }
     184             : 
     185             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10