LCOV - code coverage report
Current view: top level - libreoffice/autodoc/source/display/idl - hfi_hierarchy.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 40 68 58.8 %
Date: 2012-12-27 Functions: 4 8 50.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_hierarchy.hxx"
      22             : 
      23             : 
      24             : // NOT FULLY DECLARED SERVICES
      25             : #include <udm/html/htmlitem.hxx>
      26             : #include <ary/stdconstiter.hxx>
      27             : #include <ary/idl/i_ce.hxx>
      28             : #include <ary/idl/i_gate.hxx>
      29             : #include <ary/idl/i_type.hxx>
      30             : #include <ary/idl/ik_interface.hxx>
      31             : #include <ary/idl/ip_ce.hxx>
      32             : #include <ary/idl/ip_type.hxx>
      33             : #include "hfi_interface.hxx"
      34             : #include "hfi_typetext.hxx"
      35             : #include "hi_env.hxx"
      36             : 
      37             : 
      38             : 
      39           0 : HF_IdlBaseNode::HF_IdlBaseNode( const TYPE &            i_rType,
      40             :                                 const GATE &            i_rGate,
      41             :                                 intt                    i_nPositionOffset,
      42             :                                 HF_IdlBaseNode &        io_rDerived )
      43             :     :   nType(i_rType.TypeId()),
      44             :         aBases(),
      45             :         nCountBases(0),
      46             :         nPosition(i_nPositionOffset),
      47           0 :         pDerived(&io_rDerived)
      48             : {
      49           0 :     Ce_id nCe = i_rGate.Types().Search_CeRelatedTo(nType);
      50           0 :     if (nCe.IsValid())
      51             :     {
      52           0 :         GatherBases(i_rGate.Ces().Find_Ce(nCe), i_rGate);
      53             :     }
      54           0 : }
      55             : 
      56           0 : HF_IdlBaseNode::~HF_IdlBaseNode()
      57             : {
      58           0 : }
      59             : 
      60             : void
      61           0 : HF_IdlBaseNode::FillPositionList( std::vector< const HF_IdlBaseNode* > & o_rPositionList ) const
      62             : {
      63           0 :     for ( BaseList::const_iterator it = aBases.begin();
      64           0 :           it != aBases.end();
      65             :           ++it )
      66             :     {
      67           0 :         (*it)->FillPositionList(o_rPositionList);
      68             :     }  // end for
      69             : 
      70           0 :     o_rPositionList.push_back(this);
      71           0 : }
      72             : 
      73             : void
      74           0 : HF_IdlBaseNode::GatherBases( const CE &       i_rCe,
      75             :                              const GATE &     i_rGate )
      76             : {
      77             :     ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
      78           0 :         aHelp;
      79           0 :     ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
      80             : 
      81           0 :     for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
      82             :           it.operator bool();
      83           0 :           ++it )
      84             :     {
      85             :         const TYPE &
      86           0 :             rBaseType = i_rGate.Types().Find_Type((*it).Type());
      87             : 
      88             :         Dyn<HF_IdlBaseNode>
      89             :             pBaseNode( new HF_IdlBaseNode( rBaseType,
      90             :                                            i_rGate,
      91             :                                            nPosition,
      92           0 :                                            *this )
      93           0 :                      );
      94             : 
      95           0 :         intt nAddedBases = pBaseNode->BaseCount() + 1;
      96           0 :         nCountBases += nAddedBases;
      97           0 :         nPosition += nAddedBases;
      98           0 :         aBases.push_back( pBaseNode.Release() );
      99           0 :     }   // end for
     100           0 : }
     101             : 
     102             : 
     103             : void
     104         565 : Write_BaseHierarchy( csi::xml::Element &            o_rOut,
     105             :                      HtmlEnvironment_Idl &          i_env,
     106             :                      const ary::idl::CodeEntity &   i_ce )
     107             : {
     108             :     csi::xml::Element &
     109             :         rPre = o_rOut
     110         565 :                >> *new csi::xml::AnElement("pre")
     111        1130 :                    << new csi::html::StyleAttr("font-family:monospace;");
     112             : 
     113             :     std::vector<uintt>
     114         565 :         aSetColumns;
     115             :     rPre
     116         565 :         >> *new csi::html::Strong
     117        1130 :             << i_ce.LocalName();
     118             :     rPre
     119         565 :         << "\n";
     120             :     Write_Bases( rPre,
     121             :                  i_env,
     122             :                  i_ce,
     123         565 :                          aSetColumns );
     124             :     rPre
     125         565 :         << "\n";
     126             : 
     127         565 : }
     128             : 
     129             : 
     130             : void
     131        1661 : Write_Bases( csi::xml::Element &            o_out,
     132             :              HtmlEnvironment_Idl &          i_env,
     133             :              const ary::idl::CodeEntity &   i_rCe,
     134             :              std::vector<uintt> &           io_setColumns )
     135             : {
     136             :     ary::Dyn_StdConstIterator<ary::idl::CommentedRelation>
     137        1661 :         aHelp;
     138        1661 :     ary::idl::ifc_interface::attr::Get_Bases(aHelp,i_rCe);
     139             : 
     140        5216 :     for ( ary::StdConstIterator<ary::idl::CommentedRelation> & it = *aHelp;
     141             :           it.operator bool();
     142             :           // NO INCREMENT HERE, see below
     143             :         )
     144             :     {
     145             :         ary::idl::Type_id
     146        1894 :             nType = (*it).Type();
     147        1894 :         ++it;
     148             :         bool
     149        1894 :             bThereComesMore = it.operator bool();
     150             : 
     151             :         ary::idl::Ce_id
     152        1894 :             nCe = i_env.Gate().Types().Search_CeRelatedTo(nType);
     153        1894 :         if (nCe.IsValid())
     154             :         {
     155             :             // KORR_FUTURE
     156             :             //   Rather check for id(!) of com::sun::star::uno::XInterface.
     157        1894 :             if (i_env.Gate().Ces().Find_Ce(nCe).LocalName() == "XInterface")
     158         798 :                 continue;
     159             :         }
     160             : 
     161        1600 :         for (uintt i = 0; i < io_setColumns.size(); ++i)
     162             :         {
     163         504 :             if (io_setColumns[i] == 1)
     164         127 :                 o_out << new csi::xml::XmlCode("&#x2503");
     165             :             else
     166         377 :                 o_out << "  ";
     167         504 :             o_out << " ";
     168             :         }
     169             : 
     170        1096 :         if (bThereComesMore)
     171         233 :             o_out << new csi::xml::XmlCode("&#x2523");
     172             :         else
     173         863 :             o_out << new csi::xml::XmlCode("&#x2517");
     174        1096 :         o_out << " ";
     175             : 
     176             :         HF_IdlTypeText
     177        1096 :             aDisplay( i_env, o_out, i_env.CurPageCe());
     178        1096 :         aDisplay.Produce_byData(nType);
     179        1096 :         o_out << "\n";
     180             : 
     181        1096 :         if (nCe.IsValid())
     182             :         {
     183        1096 :             io_setColumns.push_back(bThereComesMore ? 1 : 0);
     184             : 
     185             :             const ary::idl::CodeEntity &
     186        1096 :                 rCe = i_env.Gate().Ces().Find_Ce(nCe);
     187             :             Write_Bases( o_out,
     188             :                          i_env,
     189             :                          rCe,
     190        1096 :                          io_setColumns );
     191        1096 :             io_setColumns.pop_back();
     192             :         }
     193        2757 :     }   // end for
     194        1664 : }
     195             : 
     196             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10