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_property.hxx"
24 // NOT FULLY DEFINED SERVICES
25 #include <ary/idl/i_ce.hxx>
26 #include <ary/idl/ik_attribute.hxx>
27 #include <ary/idl/ik_constant.hxx>
28 #include <ary/idl/ik_enumvalue.hxx>
29 #include <ary/idl/ik_property.hxx>
30 #include <ary/idl/ik_structelem.hxx>
31 #include <toolkit/hf_docentry.hxx>
32 #include <toolkit/hf_title.hxx>
33 #include "hfi_typetext.hxx"
34 #include "hfi_doc.hxx"
35 #include "hfi_tag.hxx"
38 #include "hi_linkhelper.hxx"
41 HF_IdlDataMember::Produce_byData( const client
& ce
) const
45 write_Declaration(ce
);
46 write_Description(ce
);
50 HF_IdlDataMember::HF_IdlDataMember( Environment
& io_rEnv
,
51 HF_SubTitleTable
& o_table
)
52 : HtmlFactory_Idl( io_rEnv
,
54 >> *new Html::TableCell
55 << new Html::ClassAttr(C_sCellStyle_MDetail
))
60 const String
sContentBorder("0");
61 const String
sContentWidth("96%");
62 const String
sContentPadding("5");
63 const String
sContentSpacing("0");
65 const String
sBgWhite("#ffffff");
66 const String
sCenter("center");
69 HF_IdlDataMember::write_Title( const client
& i_ce
) const
72 >> *new Html::Label(i_ce
.LocalName())
73 << new Html::ClassAttr(C_sMemberTitle
)
78 HF_IdlDataMember::write_Description( const client
& i_ce
) const
80 CurOut() << new Html::HorizontalLine
;
81 write_Docu(CurOut(), i_ce
);
85 HF_IdlDataMember::enter_ContentCell() const
89 rContentCell
= CurOut()
90 >> *new Html::Table( sContentBorder
,
94 << new Html::ClassAttr("table-in-data")
95 << new Html::BgColorAttr(sBgWhite
)
96 << new Html::AlignAttr(sCenter
)
97 >> *new Html::TableRow
98 >> *new Html::TableCell
;
99 Out().Enter(rContentCell
);
104 HF_IdlDataMember::leave_ContentCell() const
110 HF_IdlProperty::~HF_IdlProperty()
114 typedef ary::idl::ifc_property::attr PropertyAttr
;
117 HF_IdlProperty::write_Declaration( const client
& i_ce
) const
119 if (PropertyAttr::HasAnyStereotype(i_ce
))
122 if (PropertyAttr::IsReadOnly(i_ce
))
123 CurOut() << "readonly ";
124 if (PropertyAttr::IsBound(i_ce
))
125 CurOut() << "bound ";
126 if (PropertyAttr::IsConstrained(i_ce
))
127 CurOut() << "constrained ";
128 if (PropertyAttr::IsMayBeAmbiguous(i_ce
))
129 CurOut() << "maybeambiguous ";
130 if (PropertyAttr::IsMayBeDefault(i_ce
))
131 CurOut() << "maybedefault ";
132 if (PropertyAttr::IsMayBeVoid(i_ce
))
133 CurOut() << "maybevoid ";
134 if (PropertyAttr::IsRemovable(i_ce
))
135 CurOut() << "removable ";
136 if (PropertyAttr::IsTransient(i_ce
))
137 CurOut() << "transient ";
142 aType( Env(), CurOut() );
143 aType
.Produce_byData( PropertyAttr::Type(i_ce
) );
145 CurOut() << " " >> *new Html::Bold
<< i_ce
.LocalName();
152 HF_IdlAttribute::~HF_IdlAttribute()
156 typedef ary::idl::ifc_attribute::attr AttributeAttr
;
159 HF_IdlAttribute::write_Declaration( const client
& i_ce
) const
161 if (AttributeAttr::HasAnyStereotype(i_ce
))
164 if (AttributeAttr::IsReadOnly(i_ce
))
165 CurOut() << "readonly ";
166 if (AttributeAttr::IsBound(i_ce
))
167 CurOut() << "bound ";
172 aType( Env(), CurOut() );
173 aType
.Produce_byData( AttributeAttr::Type(i_ce
) );
180 dyn_type_list pGetExceptions
;
181 dyn_type_list pSetExceptions
;
182 AttributeAttr::Get_GetExceptions(pGetExceptions
, i_ce
);
183 AttributeAttr::Get_SetExceptions(pSetExceptions
, i_ce
);
185 bool bGetRaises
= (*pGetExceptions
).IsValid();
186 bool bSetRaises
= (*pSetExceptions
).IsValid();
187 bool bRaises
= bGetRaises OR bSetRaises
;
190 HF_DocEntryList
aSub(CurOut());
195 rGet
= aSub
.Produce_Definition();
198 type_list
& itExc
= *pGetExceptions
;
200 rGet
<< "get raises (";
201 aExc
.Produce_byData(*itExc
);
202 for (++itExc
; itExc
.operator bool(); ++itExc
)
206 aExc
.Produce_byData(*itExc
);
211 } // end if (bGetRaises)
216 rSet
= aSub
.Produce_Definition();
219 type_list
& itExc
= *pSetExceptions
;
221 rSet
<< "set raises (";
222 aExc
.Produce_byData(*itExc
);
223 for (++itExc
; itExc
.operator bool(); ++itExc
)
227 aExc
.Produce_byData(*itExc
);
230 } // end if (bSetRaises)
241 HF_IdlEnumValue::~HF_IdlEnumValue()
245 typedef ary::idl::ifc_enumvalue::attr EnumValueAttr
;
248 HF_IdlEnumValue::write_Declaration( const client
& i_ce
) const
255 rValue
= EnumValueAttr::Value(i_ce
);
256 if ( NOT rValue
.empty() )
257 { CurOut() << " " // << " = " // In the moment this is somehow in the value
259 // CurOut() << ","; // In the moment this is somehow in the value
266 HF_IdlConstant::~HF_IdlConstant()
270 typedef ary::idl::ifc_constant::attr ConstantAttr
;
273 HF_IdlConstant::write_Declaration( const client
& i_ce
) const
275 CurOut() << "const ";
277 aType( Env(), CurOut() );
278 aType
.Produce_byData(ConstantAttr::Type(i_ce
));
284 rValue
= ConstantAttr::Value(i_ce
);
285 CurOut() << " " // << " = " // In the moment this is somehow in the value
287 // << ";"; // In the moment this is somehow in the value
291 HF_IdlStructElement::~HF_IdlStructElement()
295 typedef ary::idl::ifc_structelement::attr StructElementAttr
;
298 HF_IdlStructElement::write_Declaration( const client
& i_ce
) const
301 aType( Env(), CurOut() );
302 aType
.Produce_byData(StructElementAttr::Type(i_ce
));
311 HF_IdlCommentedRelationElement::~HF_IdlCommentedRelationElement()
316 HF_IdlCommentedRelationElement::produce_Summary( Environment
& io_env
,
317 Xml::Element
& io_context
,
318 const comref
& i_commentedRef
,
319 const client
& i_rScopeGivingCe
)
321 csv_assert( i_commentedRef
.Info() );
323 const ce_info
& rDocu
= *i_commentedRef
.Info();
325 bool bShort
= NOT rDocu
.Short().IsEmpty();
326 bool bDescr
= NOT rDocu
.Description().IsEmpty();
330 HF_IdlDocuTextDisplay
331 aDescription(io_env
, 0, i_rScopeGivingCe
);
333 Xml::Element
& rPara
= io_context
>> *new Html::Paragraph
;
334 aDescription
.Out().Enter( rPara
);
335 rDocu
.Short().DisplayAt( aDescription
);
337 // if there's more than just the summary - i.e. a description, or usage restrictions, or tags -,
338 // then add a link to the details section
339 if ( bDescr OR rDocu
.IsDeprecated() OR rDocu
.IsOptional() OR NOT rDocu
.Tags().empty() )
341 StreamLock
aLocalLink(100);
342 aLocalLink() << "#" << get_LocalLinkName(io_env
, i_commentedRef
);
344 aDescription
.Out().Out() << "(";
345 aDescription
.Out().Out()
346 >> *new Html::Link( aLocalLink().c_str() )
348 aDescription
.Out().Out() << ")";
351 aDescription
.Out().Leave();
356 HF_IdlCommentedRelationElement::produce_LinkDoc( Environment
& io_env
,
358 Xml::Element
& io_context
,
359 const comref
& i_commentedRef
,
360 const E_DocType i_docType
)
362 if ( i_commentedRef
.Info() != 0 )
364 if ( i_docType
== doctype_complete
)
366 HF_DocEntryList
aDocList(io_context
);
367 HF_IdlDocu
aDocuDisplay(io_env
, aDocList
);
369 aDocuDisplay
.Produce_fromReference(*i_commentedRef
.Info(), i_ce
);
373 produce_Summary(io_env
, io_context
, i_commentedRef
, i_ce
);
378 HF_DocEntryList
aDocList(io_context
);
381 pCe
= io_env
.Linker().Search_CeFromType(i_commentedRef
.Type());
384 ? Get_IdlDocu(pCe
->Docu())
385 : (const ce_info
*)(0);
388 aDocList
.Produce_NormalTerm("(referenced entity's summary:)");
390 rDef
= aDocList
.Produce_Definition();
391 HF_IdlDocuTextDisplay
392 aShortDisplay( io_env
, &rDef
, *pCe
);
393 pShort
->Short().DisplayAt(aShortDisplay
);
394 } // end if (pShort != 0)
395 } // endif ( (*i_commentedRef).Info() != 0 ) else
400 HF_IdlCommentedRelationElement::get_LocalLinkName( Environment
& io_env
,
401 const comref
& i_commentedRef
)
403 StringVector aModules
;
406 int nSequenceCount
= 0;
408 const ary::idl::Type
&
409 rType
= io_env
.Data().Find_Type(i_commentedRef
.Type());
410 io_env
.Data().Get_TypeText(aModules
, sLocalName
, nCe
, nSequenceCount
, rType
);
412 // speaking strictly, this is not correct: If we have two interfaces with the same local
413 // name, but in different modules, then the link name will be ambiguous. However, this should
414 // be too seldom a case to really make the link names that ugly by adding the module information.
419 HF_IdlCommentedRelationElement::write_Title( const client
& /*i_ce*/ ) const
424 >> *new Html::Label(get_LocalLinkName(Env(), m_relation
))
425 << new Html::ClassAttr(C_sMemberTitle
);
428 aText(Env(), rAnchor
);
429 aText
.Produce_byData(m_relation
.Type());
433 HF_IdlCommentedRelationElement::write_Declaration( const client
& /*i_ce*/ ) const
435 // nothing to do here - an entity which is a commented relation does not have a declaration
439 HF_IdlCommentedRelationElement::write_Description( const client
& i_ce
) const
441 produce_LinkDoc( Env(), i_ce
, CurOut(), m_relation
, doctype_complete
);
444 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */