LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hfi_interface.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 126 126 100.0 %
Date: 2012-12-27 Functions: 8 9 88.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_interface.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/ik_function.hxx>
      28             : #include <ary/idl/ik_interface.hxx>
      29             : #include <ary/idl/ip_ce.hxx>
      30             : #include <ary/idl/ip_type.hxx>
      31             : #include <toolkit/hf_docentry.hxx>
      32             : #include <toolkit/hf_linachain.hxx>
      33             : #include <toolkit/hf_navi_sub.hxx>
      34             : #include <toolkit/hf_title.hxx>
      35             : #include "hfi_doc.hxx"
      36             : #include "hfi_hierarchy.hxx"
      37             : #include "hfi_method.hxx"
      38             : #include "hfi_navibar.hxx"
      39             : #include "hfi_property.hxx"
      40             : #include "hfi_tag.hxx"
      41             : #include "hfi_typetext.hxx"
      42             : #include "hi_linkhelper.hxx"
      43             : 
      44             : 
      45             : extern const String
      46           1 :     C_sCePrefix_Interface("interface");
      47             : 
      48             : namespace
      49             : {
      50             : 
      51             : const String
      52           1 :     C_sBaseInterface("Base Interfaces");
      53             : const String
      54           1 :     C_sList_BaseComments("Comments on Base Interfaces");
      55             : const String
      56           1 :     C_sList_Methods("Methods' Summary");
      57             : const String
      58           1 :     C_sList_Methods_Label("MethodsSummary");
      59             : const String
      60           1 :     C_sDetails_Methods("Methods' Details");
      61             : const String
      62           1 :     C_sDetails_Methods_Label("MethodsDetails");
      63             : 
      64             : const String
      65           1 :     C_sList_Attributes("Attributes' Summary");
      66             : const String
      67           1 :     C_sList_Attributes_Label("AttributesSummary");
      68             : const String
      69           1 :     C_sList_AttributesDetails("Attributes' Details");
      70             : const String
      71           1 :     C_sList_AttributesDetails_Label("AttributesDetails");
      72             : 
      73             : 
      74             : 
      75             : enum E_SubListIndices
      76             : {
      77             :     sli_MethodsSummay = 0,
      78             :     sli_AttributesSummary = 1,
      79             :     sli_MethodDetails = 2,
      80             :     sli_AttributesDetails = 3
      81             : };
      82             : 
      83             : } //anonymous namespace
      84             : 
      85             : 
      86             : 
      87             : 
      88        1644 : HF_IdlInterface::HF_IdlInterface( Environment &         io_rEnv,
      89             :                                   Xml::Element &        o_rOut )
      90             :     :   HtmlFactory_Idl(io_rEnv, &o_rOut),
      91        1644 :         eCurProducedMembers(mem_none)
      92             : {
      93        1644 : }
      94             : 
      95        1644 : HF_IdlInterface::~HF_IdlInterface()
      96             : {
      97        1644 : }
      98             : 
      99             : void
     100        1644 : HF_IdlInterface::Produce_byData( const client & i_ce ) const
     101             : {
     102             :     Dyn<HF_NaviSubRow>
     103        1644 :         pNaviSubRow( &make_Navibar(i_ce) );
     104             : 
     105             :     HF_TitleTable
     106        1644 :         aTitle(CurOut());
     107             : 
     108             :     HF_LinkedNameChain
     109        1644 :         aNameChain(aTitle.Add_Row());
     110        1644 :     aNameChain.Produce_CompleteChain(Env().CurPosition(), nameChainLinker);
     111             : 
     112        1644 :     produce_Title(aTitle, C_sCePrefix_Interface, i_ce);
     113             : 
     114        1644 :     produce_BaseHierarchy( aTitle.Add_Row(),
     115             :                            i_ce,
     116        1644 :                            C_sBaseInterface );
     117             : 
     118        1644 :     write_Docu(aTitle.Add_Row(), i_ce);
     119        1644 :     CurOut() << new Html::HorizontalLine();
     120             : 
     121        1644 :     dyn_ce_list dpFunctions;
     122        1644 :     ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce);
     123        1644 :     if ( (*dpFunctions).operator bool() )
     124             :     {
     125        1531 :         eCurProducedMembers = mem_Functions;
     126             : 
     127        1531 :         produce_Members( *dpFunctions,
     128             :                          C_sList_Methods,
     129             :                          C_sList_Methods_Label,
     130             :                          C_sDetails_Methods,
     131             :                          C_sDetails_Methods_Label,
     132        1531 :                          HtmlFactory_Idl::viewtype_summary );
     133        1531 :         pNaviSubRow->SwitchOn(sli_MethodsSummay);
     134             :     }
     135             : 
     136             :     dyn_ce_list
     137        1644 :         dpAttributes;
     138        1644 :     ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce);
     139        1644 :     if ( (*dpAttributes).operator bool() )
     140             :     {
     141         106 :         eCurProducedMembers = mem_Attributes;
     142             : 
     143         106 :         produce_Members( *dpAttributes,
     144             :                          C_sList_Attributes,
     145             :                          C_sList_Attributes_Label,
     146             :                          C_sList_AttributesDetails,
     147             :                          C_sList_AttributesDetails_Label,
     148         106 :                          HtmlFactory_Idl::viewtype_summary );
     149         106 :         pNaviSubRow->SwitchOn(sli_AttributesSummary);
     150             :     }
     151             : 
     152        1644 :     ary::idl::ifc_interface::attr::Get_Functions(dpFunctions, i_ce);
     153        1644 :     if ( (*dpFunctions).operator bool() )
     154             :     {
     155        1531 :         eCurProducedMembers = mem_Functions;
     156             : 
     157        1531 :         produce_Members( *dpFunctions,
     158             :                          C_sList_Methods,
     159             :                          C_sList_Methods_Label,
     160             :                          C_sDetails_Methods,
     161             :                          C_sDetails_Methods_Label,
     162        1531 :                          HtmlFactory_Idl::viewtype_details );
     163        1531 :         pNaviSubRow->SwitchOn(sli_MethodDetails);
     164             :     }
     165             : 
     166        1644 :     ary::idl::ifc_interface::attr::Get_Attributes(dpAttributes, i_ce);
     167        1644 :     if ( (*dpAttributes).operator bool() )
     168             :     {
     169         106 :         eCurProducedMembers = mem_Attributes;
     170             : 
     171         106 :         produce_Members( *dpAttributes,
     172             :                          C_sList_Attributes,
     173             :                          C_sList_Attributes_Label,
     174             :                          C_sList_AttributesDetails,
     175             :                          C_sList_AttributesDetails_Label,
     176         106 :                          HtmlFactory_Idl::viewtype_details );
     177         106 :         pNaviSubRow->SwitchOn(sli_AttributesDetails);
     178             :     }
     179             : 
     180        1644 :     eCurProducedMembers = mem_none;
     181             : 
     182        1644 :     pNaviSubRow->Produce_Row();
     183        1644 : }
     184             : 
     185             : DYN HF_NaviSubRow &
     186        1644 : HF_IdlInterface::make_Navibar( const client & i_ce ) const
     187             : {
     188             :     HF_IdlNavigationBar
     189        1644 :         aNaviBar(Env(), CurOut());
     190        1644 :     aNaviBar.Produce_CeMainRow(i_ce);
     191             : 
     192             :     DYN HF_NaviSubRow &
     193        1644 :         ret = aNaviBar.Add_SubRow();
     194        1644 :     ret.AddItem(C_sList_Methods, C_sList_Methods_Label, false);
     195        1644 :     ret.AddItem(C_sList_Attributes, C_sList_Attributes_Label, false);
     196        1644 :     ret.AddItem(C_sDetails_Methods, C_sDetails_Methods_Label, false);
     197        1644 :     ret.AddItem(C_sList_AttributesDetails, C_sList_AttributesDetails_Label, false);
     198             : 
     199        1644 :     CurOut() << new Html::HorizontalLine();
     200        1644 :     return ret;
     201             : }
     202             : 
     203             : void
     204        6015 : HF_IdlInterface::produce_MemberDetails( HF_SubTitleTable &  o_table,
     205             :                                         const client &      i_ce ) const
     206             : {
     207        6015 :     switch (eCurProducedMembers)
     208             :     {
     209             :         case mem_Functions:
     210        5502 :                     break;
     211             :         case mem_Attributes:
     212             :         {
     213             :                     HF_IdlAttribute
     214         513 :                         aAttribute( Env(), o_table);
     215         513 :                     aAttribute.Produce_byData( i_ce );
     216         513 :                     return;
     217             :         };
     218             :         default:    //Won't happen.
     219             :                     return;
     220             :     }   // end switch
     221             : 
     222             :     typedef ary::idl::ifc_function::attr    funcAttr;
     223             : 
     224             :     HF_IdlMethod
     225        5502 :         aFunction(  Env(),
     226        5502 :                     o_table.Add_Row()
     227       11004 :                         >> *new Html::TableCell
     228       16506 :                            << new Html::ClassAttr(C_sCellStyle_MDetail) );
     229             : 
     230             :     ary::Dyn_StdConstIterator<ary::idl::Parameter>
     231        5502 :         pParameters;
     232        5502 :     funcAttr::Get_Parameters(pParameters, i_ce);
     233             : 
     234             :     ary::Dyn_StdConstIterator<ary::idl::Type_id>
     235        5502 :         pExceptions;
     236        5502 :     funcAttr::Get_Exceptions(pExceptions, i_ce);
     237             : 
     238        5502 :     aFunction.Produce_byData( i_ce.LocalName(),
     239             :                               funcAttr::ReturnType(i_ce),
     240        5502 :                               *pParameters,
     241        5502 :                               *pExceptions,
     242        5502 :                               funcAttr::IsOneway(i_ce),
     243        5502 :                               funcAttr::HasEllipse(i_ce),
     244       22008 :                               i_ce );
     245             : }
     246             : 
     247             : void
     248        1644 : HF_IdlInterface::produce_BaseHierarchy( Xml::Element &      o_screen,
     249             :                                         const client &      i_ce,
     250             :                                         const String &      i_sLabel ) const
     251             : {
     252             :     ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
     253        1644 :         pHelp;
     254        1644 :     ary::idl::ifc_interface::attr::Get_Bases(pHelp, i_ce);
     255        1644 :     if (NOT (*pHelp).operator bool())
     256             :         return;
     257             : 
     258             :     // Check for XInterface as only base:
     259             :     ary::StdConstIterator<ary::idl::CommentedRelation> &
     260        1643 :         itTest = *pHelp;
     261             :     ary::idl::Ce_id
     262        1643 :         nCe = Env().Gate().Types().Search_CeRelatedTo((*itTest).Type());
     263        1643 :     if (nCe.IsValid())
     264             :     {
     265             :         // KORR_FUTURE
     266             :         //   Rather check for id(!) of com::sun::star::uno::XInterface.
     267        1643 :         if (Env().Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
     268             :         {
     269        1078 :             ++itTest;
     270        1078 :             if (NOT itTest.operator bool())
     271             :                 return;
     272             :         }
     273             :     }
     274             : 
     275             :     // Write hierarchy:
     276             : 
     277             :     HF_DocEntryList
     278         565 :         aDocList( o_screen );
     279         565 :     aDocList.Produce_Term(i_sLabel);
     280             :     Xml::Element &
     281         565 :         rBaseList = aDocList.Produce_Definition();
     282             : 
     283             : // NEW
     284         565 :     Write_BaseHierarchy(rBaseList, Env(), i_ce);
     285             : 
     286             :     // Write comments:
     287             :         // KORR_FUTURE: Make sure, no empty table is constructed when comments list is empty.
     288             :     HF_SubTitleTable
     289         565 :         aBaseTable( aDocList.Produce_Definition(),
     290             :                 "",
     291             :                 C_sList_BaseComments,
     292             :                 2,
     293        1130 :                 HF_SubTitleTable::sublevel_3 );
     294             : 
     295             :     ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
     296         565 :         pBases;
     297         565 :     ary::idl::ifc_interface::attr::Get_Bases(pBases, i_ce);
     298        1872 :     for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *pBases;
     299             :           it.operator bool();
     300         742 :           ++it )
     301             :     {
     302             :         Xml::Element &
     303         742 :             rRow = aBaseTable.Add_Row();
     304             : 
     305             :         Xml::Element &
     306             :             rTerm = rRow
     307         742 :                         >> *new Html::TableCell
     308        1484 :                             << new Html::ClassAttr(C_sCellStyle_SummaryLeft);
     309             :         HF_IdlTypeText
     310         742 :             aTypeDisplay( Env(), rTerm, 0);
     311         742 :         aTypeDisplay.Produce_byData((*it).Type());
     312             : 
     313             :         Xml::Element &
     314             :             rDocu = rRow
     315         742 :                         >> *new Html::TableCell
     316        1484 :                             << new Html::ClassAttr(C_sCellStyle_SummaryRight);
     317             : 
     318             :         HF_DocEntryList
     319         742 :             aDocuList(rDocu);
     320             : 
     321         742 :         if ((*it).Info() != 0)
     322             :         {
     323             : //          aDocuList.Produce_Term("Comment on Base Reference");
     324             : 
     325             :             HF_IdlDocu
     326         177 :                 aDocuDisplay(Env(), aDocuList);
     327         177 :             aDocuDisplay.Produce_fromReference(*(*it).Info(), i_ce);
     328             :         }
     329             :         else
     330             :         {
     331             :             const client *
     332         565 :                 pCe = Env().Linker().Search_CeFromType((*it).Type());
     333             :             const ce_info *
     334             :                 pShort = pCe != 0
     335         565 :                             ?   Get_IdlDocu(pCe->Docu())
     336        1130 :                             :   (const ce_info *)(0);
     337         565 :             if ( pShort != 0 )
     338             :             {
     339         447 :                 aDocuList.Produce_NormalTerm("(referenced interface's summary:)");
     340             : 
     341             :                 Xml::Element &
     342         447 :                     rDef = aDocuList.Produce_Definition();
     343             :                 HF_IdlDocuTextDisplay
     344         447 :                     aShortDisplay( Env(), &rDef, *pCe);
     345         447 :                 pShort->Short().DisplayAt(aShortDisplay);
     346             :             }   // end if (pShort != 0)
     347             :         }   // endif ( (*i_commentedRef).Info() != 0 ) else
     348        1307 :     }   // end for
     349           3 : }
     350             : 
     351             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10