fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hfi_property.cxx
blob8c7cbb5f2907d6d36e5e53c016e5a1b7e0ab51c4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <precomp.h>
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"
36 #include "hi_env.hxx"
37 #include "hi_ary.hxx"
38 #include "hi_linkhelper.hxx"
40 void
41 HF_IdlDataMember::Produce_byData( const client & ce ) const
43 write_Title(ce);
44 enter_ContentCell();
45 write_Declaration(ce);
46 write_Description(ce);
47 leave_ContentCell();
50 HF_IdlDataMember::HF_IdlDataMember( Environment & io_rEnv,
51 HF_SubTitleTable & o_table )
52 : HtmlFactory_Idl( io_rEnv,
53 &(o_table.Add_Row()
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");
68 void
69 HF_IdlDataMember::write_Title( const client & i_ce ) const
71 CurOut()
72 >> *new Html::Label(i_ce.LocalName())
73 << new Html::ClassAttr(C_sMemberTitle)
74 << i_ce.LocalName();
77 void
78 HF_IdlDataMember::write_Description( const client & i_ce ) const
80 CurOut() << new Html::HorizontalLine;
81 write_Docu(CurOut(), i_ce);
84 void
85 HF_IdlDataMember::enter_ContentCell() const
88 Xml::Element &
89 rContentCell = CurOut()
90 >> *new Html::Table( sContentBorder,
91 sContentWidth,
92 sContentPadding,
93 sContentSpacing )
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);
103 void
104 HF_IdlDataMember::leave_ContentCell() const
106 Out().Leave();
110 HF_IdlProperty::~HF_IdlProperty()
114 typedef ary::idl::ifc_property::attr PropertyAttr;
116 void
117 HF_IdlProperty::write_Declaration( const client & i_ce ) const
119 if (PropertyAttr::HasAnyStereotype(i_ce))
121 CurOut() << "[ ";
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 ";
138 CurOut() << "] ";
139 } // end if
141 HF_IdlTypeText
142 aType( Env(), CurOut() );
143 aType.Produce_byData( PropertyAttr::Type(i_ce) );
145 CurOut() << " " >> *new Html::Bold << i_ce.LocalName();
146 CurOut() << ";";
152 HF_IdlAttribute::~HF_IdlAttribute()
156 typedef ary::idl::ifc_attribute::attr AttributeAttr;
158 void
159 HF_IdlAttribute::write_Declaration( const client & i_ce ) const
161 if (AttributeAttr::HasAnyStereotype(i_ce))
163 CurOut() << "[ ";
164 if (AttributeAttr::IsReadOnly(i_ce))
165 CurOut() << "readonly ";
166 if (AttributeAttr::IsBound(i_ce))
167 CurOut() << "bound ";
168 CurOut() << "] ";
171 HF_IdlTypeText
172 aType( Env(), CurOut() );
173 aType.Produce_byData( AttributeAttr::Type(i_ce) );
175 CurOut()
176 << " "
177 >> *new Html::Bold
178 << i_ce.LocalName();
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;
188 if (bRaises)
190 HF_DocEntryList aSub(CurOut());
192 if (bGetRaises)
194 Xml::Element &
195 rGet = aSub.Produce_Definition();
196 HF_IdlTypeText
197 aExc(Env(), rGet);
198 type_list & itExc = *pGetExceptions;
200 rGet << "get raises (";
201 aExc.Produce_byData(*itExc);
202 for (++itExc; itExc.operator bool(); ++itExc)
204 rGet
205 << ",";
206 aExc.Produce_byData(*itExc);
207 } // end for
208 rGet << ")";
209 if (NOT bSetRaises)
210 rGet << ";";
211 } // end if (bGetRaises)
213 if (bSetRaises)
215 Xml::Element &
216 rSet = aSub.Produce_Definition();
217 HF_IdlTypeText
218 aExc(Env(), rSet);
219 type_list & itExc = *pSetExceptions;
221 rSet << "set raises (";
222 aExc.Produce_byData(*itExc);
223 for (++itExc; itExc.operator bool(); ++itExc)
225 rSet
226 << ",";
227 aExc.Produce_byData(*itExc);
228 } // end for
229 rSet << ");";
230 } // end if (bSetRaises)
232 else
234 CurOut() << ";";
241 HF_IdlEnumValue::~HF_IdlEnumValue()
245 typedef ary::idl::ifc_enumvalue::attr EnumValueAttr;
247 void
248 HF_IdlEnumValue::write_Declaration( const client & i_ce ) const
250 CurOut()
251 >> *new Html::Bold
252 << i_ce.LocalName();
254 const String &
255 rValue = EnumValueAttr::Value(i_ce);
256 if ( NOT rValue.empty() )
257 { CurOut() << " " // << " = " // In the moment this is somehow in the value
258 << rValue;
259 // CurOut() << ","; // In the moment this is somehow in the value
261 else
262 CurOut() << ",";
266 HF_IdlConstant::~HF_IdlConstant()
270 typedef ary::idl::ifc_constant::attr ConstantAttr;
272 void
273 HF_IdlConstant::write_Declaration( const client & i_ce ) const
275 CurOut() << "const ";
276 HF_IdlTypeText
277 aType( Env(), CurOut() );
278 aType.Produce_byData(ConstantAttr::Type(i_ce));
279 CurOut()
280 << " "
281 >> *new Html::Bold
282 << i_ce.LocalName();
283 const String &
284 rValue = ConstantAttr::Value(i_ce);
285 CurOut() << " " // << " = " // In the moment this is somehow in the value
286 << rValue;
287 // << ";"; // In the moment this is somehow in the value
291 HF_IdlStructElement::~HF_IdlStructElement()
295 typedef ary::idl::ifc_structelement::attr StructElementAttr;
297 void
298 HF_IdlStructElement::write_Declaration( const client & i_ce ) const
300 HF_IdlTypeText
301 aType( Env(), CurOut() );
302 aType.Produce_byData(StructElementAttr::Type(i_ce));
303 CurOut()
304 << " "
305 >> *new Html::Bold
306 << i_ce.LocalName();
307 CurOut()
308 << ";";
311 HF_IdlCommentedRelationElement::~HF_IdlCommentedRelationElement()
315 void
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();
328 if ( bShort )
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() )
347 << "details";
348 aDescription.Out().Out() << ")";
351 aDescription.Out().Leave();
355 void
356 HF_IdlCommentedRelationElement::produce_LinkDoc( Environment & io_env,
357 const client & i_ce,
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);
371 else
373 produce_Summary(io_env, io_context, i_commentedRef, i_ce);
376 else
378 HF_DocEntryList aDocList(io_context);
380 const client *
381 pCe = io_env.Linker().Search_CeFromType(i_commentedRef.Type());
382 const ce_info *
383 pShort = pCe != 0
384 ? Get_IdlDocu(pCe->Docu())
385 : (const ce_info *)(0);
386 if ( pShort != 0 )
388 aDocList.Produce_NormalTerm("(referenced entity's summary:)");
389 Xml::Element &
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
399 String
400 HF_IdlCommentedRelationElement::get_LocalLinkName( Environment & io_env,
401 const comref & i_commentedRef )
403 StringVector aModules;
404 String sLocalName;
405 ce_id nCe;
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.
415 return sLocalName;
418 void
419 HF_IdlCommentedRelationElement::write_Title( const client & /*i_ce*/ ) const
422 Xml::Element &
423 rAnchor = CurOut()
424 >> *new Html::Label(get_LocalLinkName(Env(), m_relation))
425 << new Html::ClassAttr(C_sMemberTitle);
427 HF_IdlTypeText
428 aText(Env(), rAnchor);
429 aText.Produce_byData(m_relation.Type());
432 void
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
438 void
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: */