1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "hfi_property.hxx"
33 // NOT FULLY DEFINED SERVICES
34 #include <ary/idl/i_ce.hxx>
35 #include <ary/idl/ik_attribute.hxx>
36 #include <ary/idl/ik_constant.hxx>
37 #include <ary/idl/ik_enumvalue.hxx>
38 #include <ary/idl/ik_property.hxx>
39 #include <ary/idl/ik_structelem.hxx>
40 #include <toolkit/hf_docentry.hxx>
41 #include <toolkit/hf_title.hxx>
42 #include "hfi_typetext.hxx"
43 #include "hfi_doc.hxx"
44 #include "hfi_tag.hxx"
47 #include "hi_linkhelper.hxx"
50 HF_IdlDataMember::Produce_byData( const client
& ce
) const
54 write_Declaration(ce
);
55 write_Description(ce
);
59 HF_IdlDataMember::HF_IdlDataMember( Environment
& io_rEnv
,
60 HF_SubTitleTable
& o_table
)
61 : HtmlFactory_Idl( io_rEnv
,
63 >> *new Html::TableCell
64 << new Html::ClassAttr(C_sCellStyle_MDetail
))
69 const String
sContentBorder("0");
70 const String
sContentWidth("96%");
71 const String
sContentPadding("5");
72 const String
sContentSpacing("0");
74 const String
sBgWhite("#ffffff");
75 const String
sCenter("center");
78 HF_IdlDataMember::write_Title( const client
& i_ce
) const
81 >> *new Html::Label(i_ce
.LocalName())
82 << new Html::ClassAttr(C_sMemberTitle
)
87 HF_IdlDataMember::write_Description( const client
& i_ce
) const
89 CurOut() << new Html::HorizontalLine
;
90 write_Docu(CurOut(), i_ce
);
94 HF_IdlDataMember::enter_ContentCell() const
98 rContentCell
= CurOut()
99 >> *new Html::Table( sContentBorder
,
103 << new Html::ClassAttr("table-in-data")
104 << new Html::BgColorAttr(sBgWhite
)
105 << new Html::AlignAttr(sCenter
)
106 >> *new Html::TableRow
107 >> *new Html::TableCell
;
108 Out().Enter(rContentCell
);
113 HF_IdlDataMember::leave_ContentCell() const
119 HF_IdlProperty::~HF_IdlProperty()
123 typedef ary::idl::ifc_property::attr PropertyAttr
;
126 HF_IdlProperty::write_Declaration( const client
& i_ce
) const
128 if (PropertyAttr::HasAnyStereotype(i_ce
))
131 if (PropertyAttr::IsReadOnly(i_ce
))
132 CurOut() << "readonly ";
133 if (PropertyAttr::IsBound(i_ce
))
134 CurOut() << "bound ";
135 if (PropertyAttr::IsConstrained(i_ce
))
136 CurOut() << "constrained ";
137 if (PropertyAttr::IsMayBeAmbiguous(i_ce
))
138 CurOut() << "maybeambiguous ";
139 if (PropertyAttr::IsMayBeDefault(i_ce
))
140 CurOut() << "maybedefault ";
141 if (PropertyAttr::IsMayBeVoid(i_ce
))
142 CurOut() << "maybevoid ";
143 if (PropertyAttr::IsRemovable(i_ce
))
144 CurOut() << "removable ";
145 if (PropertyAttr::IsTransient(i_ce
))
146 CurOut() << "transient ";
151 aType( Env(), CurOut(), true );
152 aType
.Produce_byData( PropertyAttr::Type(i_ce
) );
154 CurOut() << " " >> *new Html::Bold
<< i_ce
.LocalName();
161 HF_IdlAttribute::~HF_IdlAttribute()
165 typedef ary::idl::ifc_attribute::attr AttributeAttr
;
168 HF_IdlAttribute::write_Declaration( const client
& i_ce
) const
170 if (AttributeAttr::HasAnyStereotype(i_ce
))
173 if (AttributeAttr::IsReadOnly(i_ce
))
174 CurOut() << "readonly ";
175 if (AttributeAttr::IsBound(i_ce
))
176 CurOut() << "bound ";
181 aType( Env(), CurOut(), true );
182 aType
.Produce_byData( AttributeAttr::Type(i_ce
) );
189 dyn_type_list pGetExceptions
;
190 dyn_type_list pSetExceptions
;
191 AttributeAttr::Get_GetExceptions(pGetExceptions
, i_ce
);
192 AttributeAttr::Get_SetExceptions(pSetExceptions
, i_ce
);
194 bool bGetRaises
= (*pGetExceptions
).IsValid();
195 bool bSetRaises
= (*pSetExceptions
).IsValid();
196 bool bRaises
= bGetRaises OR bSetRaises
;
199 HF_DocEntryList
aSub(CurOut());
204 rGet
= aSub
.Produce_Definition();
206 aExc(Env(), rGet
, true);
207 type_list
& itExc
= *pGetExceptions
;
209 rGet
<< "get raises (";
210 aExc
.Produce_byData(*itExc
);
211 for (++itExc
; itExc
.operator bool(); ++itExc
)
215 aExc
.Produce_byData(*itExc
);
220 } // end if (bGetRaises)
225 rSet
= aSub
.Produce_Definition();
227 aExc(Env(), rSet
, true);
228 type_list
& itExc
= *pSetExceptions
;
230 rSet
<< "set raises (";
231 aExc
.Produce_byData(*itExc
);
232 for (++itExc
; itExc
.operator bool(); ++itExc
)
236 aExc
.Produce_byData(*itExc
);
239 } // end if (bSetRaises)
250 HF_IdlEnumValue::~HF_IdlEnumValue()
254 typedef ary::idl::ifc_enumvalue::attr EnumValueAttr
;
257 HF_IdlEnumValue::write_Declaration( const client
& i_ce
) const
264 rValue
= EnumValueAttr::Value(i_ce
);
265 if ( NOT rValue
.empty() )
266 { CurOut() << " " // << " = " // In the moment this is somehow in the value
268 // CurOut() << ","; // In the moment this is somehow in the value
275 HF_IdlConstant::~HF_IdlConstant()
279 typedef ary::idl::ifc_constant::attr ConstantAttr
;
282 HF_IdlConstant::write_Declaration( const client
& i_ce
) const
284 CurOut() << "const ";
286 aType( Env(), CurOut(), true );
287 aType
.Produce_byData(ConstantAttr::Type(i_ce
));
293 rValue
= ConstantAttr::Value(i_ce
);
294 CurOut() << " " // << " = " // In the moment this is somehow in the value
296 // << ";"; // In the moment this is somehow in the value
300 HF_IdlStructElement::~HF_IdlStructElement()
304 typedef ary::idl::ifc_structelement::attr StructElementAttr
;
307 HF_IdlStructElement::write_Declaration( const client
& i_ce
) const
310 aType( Env(), CurOut(), true );
311 aType
.Produce_byData(StructElementAttr::Type(i_ce
));
320 HF_IdlCommentedRelationElement::~HF_IdlCommentedRelationElement()
325 HF_IdlCommentedRelationElement::produce_Summary( Environment
& io_env
,
326 Xml::Element
& io_context
,
327 const comref
& i_commentedRef
,
328 const client
& i_rScopeGivingCe
)
330 csv_assert( i_commentedRef
.Info() );
332 const ce_info
& rDocu
= *i_commentedRef
.Info();
334 bool bShort
= NOT rDocu
.Short().IsEmpty();
335 bool bDescr
= NOT rDocu
.Description().IsEmpty();
339 HF_IdlDocuTextDisplay
340 aDescription(io_env
, 0, i_rScopeGivingCe
);
342 Xml::Element
& rPara
= io_context
>> *new Html::Paragraph
;
343 aDescription
.Out().Enter( rPara
);
344 rDocu
.Short().DisplayAt( aDescription
);
346 // if there's more than just the summary - i.e. a description, or usage restrictions, or tags -,
347 // then add a link to the details section
348 if ( bDescr OR rDocu
.IsDeprecated() OR rDocu
.IsOptional() OR NOT rDocu
.Tags().empty() )
350 StreamLock
aLocalLink(100);
351 aLocalLink() << "#" << get_LocalLinkName(io_env
, i_commentedRef
);
353 aDescription
.Out().Out() << "(";
354 aDescription
.Out().Out()
355 >> *new Html::Link( aLocalLink().c_str() )
357 aDescription
.Out().Out() << ")";
360 aDescription
.Out().Leave();
365 HF_IdlCommentedRelationElement::produce_LinkDoc( Environment
& io_env
,
367 Xml::Element
& io_context
,
368 const comref
& i_commentedRef
,
369 const E_DocType i_docType
)
371 if ( i_commentedRef
.Info() != 0 )
373 if ( i_docType
== doctype_complete
)
375 HF_DocEntryList
aDocList(io_context
);
376 HF_IdlDocu
aDocuDisplay(io_env
, aDocList
);
378 aDocuDisplay
.Produce_fromReference(*i_commentedRef
.Info(), i_ce
);
382 produce_Summary(io_env
, io_context
, i_commentedRef
, i_ce
);
387 HF_DocEntryList
aDocList(io_context
);
390 pCe
= io_env
.Linker().Search_CeFromType(i_commentedRef
.Type());
393 ? Get_IdlDocu(pCe
->Docu())
394 : (const ce_info
*)(0);
397 aDocList
.Produce_NormalTerm("(referenced entity's summary:)");
399 rDef
= aDocList
.Produce_Definition();
400 HF_IdlDocuTextDisplay
401 aShortDisplay( io_env
, &rDef
, *pCe
);
402 pShort
->Short().DisplayAt(aShortDisplay
);
403 } // end if (pShort != 0)
404 } // endif ( (*i_commentedRef).Info() != 0 ) else
409 HF_IdlCommentedRelationElement::get_LocalLinkName( Environment
& io_env
,
410 const comref
& i_commentedRef
)
412 StringVector aModules
;
415 int nSequenceCount
= 0;
417 const ary::idl::Type
&
418 rType
= io_env
.Data().Find_Type(i_commentedRef
.Type());
419 io_env
.Data().Get_TypeText(aModules
, sLocalName
, nCe
, nSequenceCount
, rType
);
421 // speaking strictly, this is not correct: If we have two interfaces with the same local
422 // name, but in different modules, then the link name will be ambiguous. However, this should
423 // be too seldom a case to really make the link names that ugly by adding the module information.
428 HF_IdlCommentedRelationElement::write_Title( const client
& /*i_ce*/ ) const
433 >> *new Html::Label(get_LocalLinkName(Env(), m_relation
))
434 << new Html::ClassAttr(C_sMemberTitle
);
437 aText(Env(), rAnchor
, true);
438 aText
.Produce_byData(m_relation
.Type());
442 HF_IdlCommentedRelationElement::write_Declaration( const client
& /*i_ce*/ ) const
444 // nothing to do here - an entity which is a commented relation does not have a declaration
448 HF_IdlCommentedRelationElement::write_Description( const client
& i_ce
) const
450 produce_LinkDoc( Env(), i_ce
, CurOut(), m_relation
, doctype_complete
);
453 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */