1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #include <precomp.h> 29 #include <toolkit/hf_linachain.hxx> 30 31 32 // NOT FULLY DEFINED SERVICES 33 #include <toolkit/out_position.hxx> 34 35 36 37 HF_LinkedNameChain::HF_LinkedNameChain( Xml::Element & o_rOut ) 38 : HtmlMaker( o_rOut 39 >> *new Html::Paragraph 40 << new Html::ClassAttr("namechain") ) 41 { 42 } 43 44 HF_LinkedNameChain::~HF_LinkedNameChain() 45 { 46 } 47 48 void 49 HF_LinkedNameChain::Produce_CompleteChain( const output::Position & i_curPosition, 50 F_LinkMaker i_linkMaker ) const 51 { 52 produce_Level(i_curPosition.RelatedNode(), i_curPosition, i_linkMaker); 53 } 54 55 void 56 HF_LinkedNameChain::Produce_CompleteChain_forModule( const output::Position & i_curPosition, 57 F_LinkMaker i_linkMaker ) const 58 { 59 if (i_curPosition.Depth() == 0) 60 return; 61 produce_Level(*i_curPosition.RelatedNode().Parent(), i_curPosition, i_linkMaker); 62 } 63 64 65 66 namespace 67 { 68 69 StreamStr aLinkBuf(200); 70 71 } 72 73 void 74 HF_LinkedNameChain::produce_Level( output::Node & i_levelNode, 75 const output::Position & i_startPosition, 76 F_LinkMaker i_linkMaker ) const 77 { 78 if ( i_levelNode.Depth() > 0 ) 79 { 80 produce_Level( *i_levelNode.Parent(), 81 i_startPosition, 82 i_linkMaker ); 83 } 84 85 aLinkBuf.reset(); 86 87 String 88 sFileName = (*i_linkMaker)(i_levelNode.Name()); 89 output::Position 90 aLevelPos(i_levelNode, sFileName); 91 92 i_startPosition.Get_LinkTo(aLinkBuf, aLevelPos); 93 94 if ( i_levelNode.Depth() > 0 ) 95 { 96 CurOut() 97 >> *new Html::Link(aLinkBuf.c_str()) 98 << new Html::ClassAttr("namechain") 99 << i_levelNode.Name(); 100 CurOut() << " :: "; 101 } 102 else 103 { 104 CurOut() 105 >> *new Html::Link(aLinkBuf.c_str()) 106 << new Html::ClassAttr("namechain") 107 << "::"; 108 CurOut() << " "; 109 } 110 } 111