1*0841af79SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*0841af79SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*0841af79SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*0841af79SAndrew Rist * distributed with this work for additional information 6*0841af79SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*0841af79SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*0841af79SAndrew Rist * "License"); you may not use this file except in compliance 9*0841af79SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*0841af79SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*0841af79SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*0841af79SAndrew Rist * software distributed under the License is distributed on an 15*0841af79SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*0841af79SAndrew Rist * KIND, either express or implied. See the License for the 17*0841af79SAndrew Rist * specific language governing permissions and limitations 18*0841af79SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*0841af79SAndrew Rist *************************************************************/ 21cdf0e10cSrcweir 22cdf0e10cSrcweir #include <precomp.h> 23cdf0e10cSrcweir #include "hfi_xrefpage.hxx" 24cdf0e10cSrcweir 25cdf0e10cSrcweir 26cdf0e10cSrcweir // NOT FULLY DEFINED SERVICES 27cdf0e10cSrcweir #include <ary/idl/i_ce.hxx> 28cdf0e10cSrcweir #include <ary/idl/i_gate.hxx> 29cdf0e10cSrcweir #include <ary/idl/ip_ce.hxx> 30cdf0e10cSrcweir #include <toolkit/hf_title.hxx> 31cdf0e10cSrcweir #include "hfi_navibar.hxx" 32cdf0e10cSrcweir #include "hfi_typetext.hxx" 33cdf0e10cSrcweir #include "hi_env.hxx" 34cdf0e10cSrcweir 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace 37cdf0e10cSrcweir { 38cdf0e10cSrcweir 39cdf0e10cSrcweir const String 40cdf0e10cSrcweir C_sTitleStart("uses of "); 41cdf0e10cSrcweir const String 42cdf0e10cSrcweir C_sCRLF("\n"); 43cdf0e10cSrcweir const String 44cdf0e10cSrcweir C_sDevMan("References in Developers Guide"); 45cdf0e10cSrcweir 46cdf0e10cSrcweir } // anonymous namespace 47cdf0e10cSrcweir 48cdf0e10cSrcweir 49cdf0e10cSrcweir 50cdf0e10cSrcweir HF_IdlXrefs::HF_IdlXrefs( Environment & io_rEnv, 51cdf0e10cSrcweir Xml::Element & o_rOut, 52cdf0e10cSrcweir const String & i_prefix, 53cdf0e10cSrcweir const client & i_ce ) 54cdf0e10cSrcweir : HtmlFactory_Idl(io_rEnv, &o_rOut), 55cdf0e10cSrcweir rContentDirectory(*new Html::Paragraph), 56cdf0e10cSrcweir pClient(&i_ce) 57cdf0e10cSrcweir { 58cdf0e10cSrcweir produce_Main(i_prefix, i_ce); 59cdf0e10cSrcweir } 60cdf0e10cSrcweir 61cdf0e10cSrcweir HF_IdlXrefs::~HF_IdlXrefs() 62cdf0e10cSrcweir { 63cdf0e10cSrcweir } 64cdf0e10cSrcweir 65cdf0e10cSrcweir void 66cdf0e10cSrcweir HF_IdlXrefs::Write_ManualLinks( const client & i_ce ) const 67cdf0e10cSrcweir { 68cdf0e10cSrcweir const StringVector & 69cdf0e10cSrcweir rLinks2Refs = i_ce.Secondaries().Links2RefsInManual(); 70cdf0e10cSrcweir if ( rLinks2Refs.size() == 0 ) 71cdf0e10cSrcweir { 72cdf0e10cSrcweir rContentDirectory 73cdf0e10cSrcweir << C_sDevMan 74cdf0e10cSrcweir << new Html::LineBreak 75cdf0e10cSrcweir << C_sCRLF; 76cdf0e10cSrcweir return; 77cdf0e10cSrcweir } 78cdf0e10cSrcweir 79cdf0e10cSrcweir 80cdf0e10cSrcweir rContentDirectory 81cdf0e10cSrcweir >> *new Html::Link("#devmanrefs") 82cdf0e10cSrcweir << C_sDevMan 83cdf0e10cSrcweir << new Html::LineBreak 84cdf0e10cSrcweir << C_sCRLF; 85cdf0e10cSrcweir 86cdf0e10cSrcweir HF_SubTitleTable 87cdf0e10cSrcweir aList(CurOut(), "devmanrefs", C_sDevMan, 1); 88cdf0e10cSrcweir Xml::Element & 89cdf0e10cSrcweir rOutCell = aList.Add_Row() >>* new Html::TableCell; 90cdf0e10cSrcweir 91cdf0e10cSrcweir csv_assert(rLinks2Refs.size() % 2 == 0); 92cdf0e10cSrcweir for ( StringVector::const_iterator it = rLinks2Refs.begin(); 93cdf0e10cSrcweir it != rLinks2Refs.end(); 94cdf0e10cSrcweir ++it ) 95cdf0e10cSrcweir { 96cdf0e10cSrcweir Xml::Element & 97cdf0e10cSrcweir rLink = rOutCell >> *new Html::Link( Env().Link2Manual(*it)); 98cdf0e10cSrcweir if ( (*(it+1)).empty() ) 99cdf0e10cSrcweir 100cdf0e10cSrcweir // HACK KORR_FUTURE 101cdf0e10cSrcweir // Research what happens with manual links which contain normal characters 102cdf0e10cSrcweir // in non-utf-8 texts. And research, why utfF-8 does not work here. 103cdf0e10cSrcweir rLink << new Xml::XmlCode(*it); 104cdf0e10cSrcweir else 105cdf0e10cSrcweir // HACK KORR_FUTURE, see above. 106cdf0e10cSrcweir rLink << new Xml::XmlCode( *(it+1) ); 107cdf0e10cSrcweir rOutCell 108cdf0e10cSrcweir << new Html::LineBreak 109cdf0e10cSrcweir << C_sCRLF; 110cdf0e10cSrcweir ++it; 111cdf0e10cSrcweir } // end for 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir void 115cdf0e10cSrcweir HF_IdlXrefs::Produce_List( const char * i_title, 116cdf0e10cSrcweir const char * i_label, 117cdf0e10cSrcweir ce_list & i_iterator ) const 118cdf0e10cSrcweir { 119cdf0e10cSrcweir if (NOT i_iterator) 120cdf0e10cSrcweir { 121cdf0e10cSrcweir rContentDirectory 122cdf0e10cSrcweir << i_title 123cdf0e10cSrcweir << new Html::LineBreak 124cdf0e10cSrcweir << C_sCRLF; 125cdf0e10cSrcweir return; 126cdf0e10cSrcweir } 127cdf0e10cSrcweir 128cdf0e10cSrcweir csv_assert(*i_label == '#'); 129cdf0e10cSrcweir 130cdf0e10cSrcweir rContentDirectory 131cdf0e10cSrcweir >> *new Html::Link(i_label) 132cdf0e10cSrcweir << i_title 133cdf0e10cSrcweir << new Html::LineBreak 134cdf0e10cSrcweir << C_sCRLF; 135cdf0e10cSrcweir 136cdf0e10cSrcweir HF_SubTitleTable 137cdf0e10cSrcweir aList(CurOut(), i_label+1, i_title, 1); 138cdf0e10cSrcweir Xml::Element & 139cdf0e10cSrcweir rOutCell = aList.Add_Row() >>* new Html::TableCell; 140cdf0e10cSrcweir HF_IdlTypeText 141cdf0e10cSrcweir aTypeWriter(Env(), rOutCell, true, pClient); 142cdf0e10cSrcweir for ( ce_list & it = i_iterator; it; ++it ) 143cdf0e10cSrcweir { 144cdf0e10cSrcweir aTypeWriter.Produce_byData(*it); 145cdf0e10cSrcweir rOutCell << new Html::LineBreak; 146cdf0e10cSrcweir } // end for 147cdf0e10cSrcweir } 148cdf0e10cSrcweir 149cdf0e10cSrcweir void 150cdf0e10cSrcweir HF_IdlXrefs::Produce_Tree( const char * i_title, 151cdf0e10cSrcweir const char * i_label, 152cdf0e10cSrcweir const client & i_ce, 153cdf0e10cSrcweir F_GET_SUBLIST i_sublistcreator ) const 154cdf0e10cSrcweir { 155cdf0e10cSrcweir dyn_ce_list pResult; 156cdf0e10cSrcweir (*i_sublistcreator)(pResult, i_ce); 157cdf0e10cSrcweir 158cdf0e10cSrcweir if (NOT (*pResult).operator bool()) 159cdf0e10cSrcweir { 160cdf0e10cSrcweir rContentDirectory 161cdf0e10cSrcweir << i_title 162cdf0e10cSrcweir << new Html::LineBreak 163cdf0e10cSrcweir << C_sCRLF; 164cdf0e10cSrcweir return; 165cdf0e10cSrcweir } 166cdf0e10cSrcweir 167cdf0e10cSrcweir csv_assert(*i_label == '#'); 168cdf0e10cSrcweir 169cdf0e10cSrcweir rContentDirectory 170cdf0e10cSrcweir >> *new Html::Link(i_label) 171cdf0e10cSrcweir << i_title 172cdf0e10cSrcweir << new Html::LineBreak 173cdf0e10cSrcweir << C_sCRLF; 174cdf0e10cSrcweir 175cdf0e10cSrcweir HF_SubTitleTable 176cdf0e10cSrcweir aList(CurOut(), i_label+1, i_title, 1); 177cdf0e10cSrcweir Xml::Element & 178cdf0e10cSrcweir rOut = aList.Add_Row() 179cdf0e10cSrcweir >>* new Html::TableCell 180cdf0e10cSrcweir >> *new csi::xml::AnElement("pre") 181cdf0e10cSrcweir << new csi::html::StyleAttr("font-family:monospace;"); 182cdf0e10cSrcweir 183cdf0e10cSrcweir recursive_make_ListInTree( rOut, 184cdf0e10cSrcweir 0, 185cdf0e10cSrcweir i_ce, 186cdf0e10cSrcweir *pResult, 187cdf0e10cSrcweir i_sublistcreator ); 188cdf0e10cSrcweir } 189cdf0e10cSrcweir 190cdf0e10cSrcweir void 191cdf0e10cSrcweir HF_IdlXrefs::produce_Main( const String & i_prefix, 192cdf0e10cSrcweir const client & i_ce ) const 193cdf0e10cSrcweir { 194cdf0e10cSrcweir make_Navibar(i_ce); 195cdf0e10cSrcweir 196cdf0e10cSrcweir HF_TitleTable 197cdf0e10cSrcweir aTitle(CurOut()); 198cdf0e10cSrcweir StreamLock sl(200); 199cdf0e10cSrcweir aTitle.Produce_Title( sl() 200cdf0e10cSrcweir << C_sTitleStart 201cdf0e10cSrcweir << i_prefix 202cdf0e10cSrcweir << " " 203cdf0e10cSrcweir << i_ce.LocalName() 204cdf0e10cSrcweir << c_str ); 205cdf0e10cSrcweir 206cdf0e10cSrcweir aTitle.Add_Row() << &rContentDirectory; 207cdf0e10cSrcweir sl().reset(); 208cdf0e10cSrcweir rContentDirectory 209cdf0e10cSrcweir >> *new Html::Link( sl() << i_ce.LocalName() 210cdf0e10cSrcweir << ".html" 211cdf0e10cSrcweir << c_str ) 212cdf0e10cSrcweir >> *new Html::Bold 213cdf0e10cSrcweir << "back to " 214cdf0e10cSrcweir << i_prefix 215cdf0e10cSrcweir << " " 216cdf0e10cSrcweir << i_ce.LocalName(); 217cdf0e10cSrcweir rContentDirectory 218cdf0e10cSrcweir << new Html::LineBreak 219cdf0e10cSrcweir << new Html::LineBreak 220cdf0e10cSrcweir << C_sCRLF; 221cdf0e10cSrcweir 222cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 223cdf0e10cSrcweir } 224cdf0e10cSrcweir 225cdf0e10cSrcweir void 226cdf0e10cSrcweir HF_IdlXrefs::make_Navibar( const client & i_ce ) const 227cdf0e10cSrcweir { 228cdf0e10cSrcweir HF_IdlNavigationBar 229cdf0e10cSrcweir aNaviBar(Env(), CurOut()); 230cdf0e10cSrcweir aNaviBar.Produce_CeXrefsMainRow(i_ce); 231cdf0e10cSrcweir CurOut() << new Html::HorizontalLine(); 232cdf0e10cSrcweir } 233cdf0e10cSrcweir 234cdf0e10cSrcweir void 235cdf0e10cSrcweir HF_IdlXrefs::recursive_make_ListInTree( Xml::Element & o_rDisplay, 236cdf0e10cSrcweir uintt i_level, 237cdf0e10cSrcweir const client & i_ce, 238cdf0e10cSrcweir ce_list & i_iterator, 239cdf0e10cSrcweir F_GET_SUBLIST i_sublistcreator ) const 240cdf0e10cSrcweir { 241cdf0e10cSrcweir const char * sLevelIndentation = " "; 242cdf0e10cSrcweir 243cdf0e10cSrcweir HF_IdlTypeText 244cdf0e10cSrcweir aTypeWriter(Env(), o_rDisplay, true, &i_ce); 245cdf0e10cSrcweir for ( ; i_iterator.operator bool(); ++i_iterator ) 246cdf0e10cSrcweir { 247cdf0e10cSrcweir for (uintt i = 0; i < i_level; ++i) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir o_rDisplay << sLevelIndentation; 250cdf0e10cSrcweir } // end for 251cdf0e10cSrcweir 252cdf0e10cSrcweir aTypeWriter.Produce_byData(*i_iterator); 253cdf0e10cSrcweir o_rDisplay << C_sCRLF; 254cdf0e10cSrcweir 255cdf0e10cSrcweir dyn_ce_list pResult; 256cdf0e10cSrcweir const client & rCe = Env().Gate().Ces().Find_Ce(*i_iterator); 257cdf0e10cSrcweir (*i_sublistcreator)(pResult, rCe); 258cdf0e10cSrcweir if ( (*pResult).operator bool() ) 259cdf0e10cSrcweir { 260cdf0e10cSrcweir recursive_make_ListInTree( o_rDisplay, 261cdf0e10cSrcweir i_level + 1, 262cdf0e10cSrcweir rCe, 263cdf0e10cSrcweir *pResult, 264cdf0e10cSrcweir i_sublistcreator ); 265cdf0e10cSrcweir } 266cdf0e10cSrcweir } // end for 267cdf0e10cSrcweir } 268