1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include "hfi_doc.hxx"
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"
35 HF_IdlDocu::HF_IdlDocu( Environment
& io_rEnv
,
36 HF_DocEntryList
& o_rOut
)
37 : HtmlFactory_Idl( io_rEnv
, &o_rOut
.CurOut() ),
42 HF_IdlDocu::~HF_IdlDocu()
47 HF_IdlDocu::Produce_fromCodeEntity( const client
& i_ce
) const
50 i_pDocu
= Get_IdlDocu(i_ce
.Docu());
52 Produce_byDocuAndScope(*i_pDocu
, &i_ce
, i_ce
);
56 HF_IdlDocu::Produce_fromReference( const ce_info
& i_rDocuForReference
,
57 const client
& i_rScopeGivingCe
) const
59 Produce_byDocuAndScope(i_rDocuForReference
, 0, i_rScopeGivingCe
);
63 HF_IdlDocu::Produce_byDocuAndScope( const ce_info
& i_rDocu
,
64 const client
* i_pClient
,
65 const client
& i_rScopeGivingCe
) const
67 bool bShort
= NOT i_rDocu
.Short().IsEmpty();
68 bool bDescr
= NOT i_rDocu
.Description().IsEmpty();
70 if ( i_rDocu
.IsDeprecated()
72 (i_pClient
!= 0 ? i_pClient
->SightLevel() == ary::idl::sl_File
: false)
73 AND NOT i_rDocu
.IsPublished()
75 OR i_rDocu
.IsOptional() )
76 { // any usage restriction
77 rOut
.Produce_Term("Usage Restrictions");
79 if ( i_rDocu
.IsDeprecated() )
80 rOut
.Produce_Definition() >> *new Html::Italic
<< "deprecated";
81 if ( (i_pClient
!= 0 ? i_pClient
->SightLevel() == ary::idl::sl_File
: false)
82 AND NOT i_rDocu
.IsPublished() )
83 rOut
.Produce_Definition() >> *new Html::Italic
<< "not published";
84 if ( i_rDocu
.IsOptional() )
85 rOut
.Produce_Definition() >> *new Html::Italic
<< "optional";
87 if ( i_rDocu
.IsDeprecated() AND
89 // Workaround, because DocuTex2::IsEmpty() does not
90 // calculate whitespace tokens only as empty.
91 i_rDocu
.DeprecatedText().Tokens().size() > 1 )
93 rOut
.Produce_Term("Deprecation Info");
96 aDescription( Env(), 0, i_rScopeGivingCe
);
97 aDescription
.Out().Enter( rOut
.Produce_Definition() );
98 i_rDocu
.DeprecatedText().DisplayAt( aDescription
);
99 aDescription
.Out().Leave();
101 } // end if (<any usage restriction>)
103 if ( bShort OR bDescr
)
105 rOut
.Produce_Term("Description");
106 HF_IdlDocuTextDisplay
107 aDescription( Env(), 0, i_rScopeGivingCe
);
110 aDescription
.Out().Enter( rOut
.Produce_Definition() );
111 i_rDocu
.Short().DisplayAt( aDescription
);
112 aDescription
.Out().Leave();
116 aDescription
.Out().Enter( rOut
.Produce_Definition() );
117 i_rDocu
.Description().DisplayAt( aDescription
);
118 aDescription
.Out().Leave();
122 std::vector
< csi::dsapi::DT_SeeAlsoAtTag
* >
123 aSeeAlsosWithoutText
;
124 std::vector
< csi::dsapi::DT_SeeAlsoAtTag
* >
127 for ( std::vector
< ary::inf::AtTag2
* >::const_iterator
128 iter
= i_rDocu
.Tags().begin();
129 iter
!= i_rDocu
.Tags().end();
132 csi::dsapi::DT_SeeAlsoAtTag
*
133 pSeeAlso
= dynamic_cast< csi::dsapi::DT_SeeAlsoAtTag
* >(*iter
);
136 if ( pSeeAlso
->Text().IsEmpty() )
138 aSeeAlsosWithoutText
.push_back(pSeeAlso
);
142 aSeeAlsosWithText
.push_back(pSeeAlso
);
147 if ( strlen( (*iter
)->Title() ) > 0 )
150 aTag(Env(), i_rScopeGivingCe
);
152 rTerm
= rOut
.Produce_Term();
153 aTag
.Produce_byData( rTerm
,
154 rOut
.Produce_Definition(),
159 if (!aSeeAlsosWithoutText
.empty())
162 aSeeAlsoTag(Env(), i_rScopeGivingCe
);
164 rTerm
= rOut
.Produce_Term();
165 aSeeAlsoTag
.Produce_byData( rTerm
,
166 rOut
.Produce_Definition(),
167 aSeeAlsosWithoutText
);
170 for ( std::vector
< csi::dsapi::DT_SeeAlsoAtTag
* >::const_iterator
171 itSee2
= aSeeAlsosWithText
.begin();
172 itSee2
!= aSeeAlsosWithText
.end();
176 aTag(Env(), i_rScopeGivingCe
);
178 rTerm
= rOut
.Produce_Term();
179 aTag
.Produce_byData( rTerm
,
180 rOut
.Produce_Definition(),
185 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */