| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | /*************************************************************************
 | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * Copyright 2008 by Sun Microsystems, Inc. | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * OpenOffice.org - a multi-platform office productivity suite | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * $RCSfile: dsply_op.cxx,v $ | 
					
						
							|  |  |  |  * $Revision: 1.6 $ | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * This file is part of OpenOffice.org. | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * OpenOffice.org is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Lesser General Public License version 3 | 
					
						
							|  |  |  |  * only, as published by the Free Software Foundation. | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * OpenOffice.org is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Lesser General Public License version 3 for more details | 
					
						
							|  |  |  |  * (a copy is included in the LICENSE file that accompanied this code). | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2008-04-10 13:33:26 +00:00
										 |  |  |  * You should have received a copy of the GNU Lesser General Public License | 
					
						
							|  |  |  |  * version 3 along with OpenOffice.org.  If not, see | 
					
						
							|  |  |  |  * <http://www.openoffice.org/license.html>
 | 
					
						
							|  |  |  |  * for a copy of the LGPLv3 License. | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  ************************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <precomp.h>
 | 
					
						
							|  |  |  | #include "dsply_op.hxx"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // NOT FULLY DEFINED SERVICES
 | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  | #include <cosv/tpl/tpltools.hxx>
 | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | #include <ary/cpp/c_funct.hxx>
 | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  | #include <ary/cpp/c_gate.hxx>
 | 
					
						
							|  |  |  | #include <ary/loc/locp_le.hxx>
 | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | #include <udm/html/htmlitem.hxx>
 | 
					
						
							|  |  |  | #include "hd_docu.hxx"
 | 
					
						
							|  |  |  | #include "hdimpl.hxx"
 | 
					
						
							|  |  |  | #include "html_kit.hxx"
 | 
					
						
							|  |  |  | #include "opageenv.hxx"
 | 
					
						
							|  |  |  | #include "pagemake.hxx"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using namespace csi; | 
					
						
							|  |  |  | using namespace adcdisp; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | OperationsDisplay::OperationsDisplay( OuputPage_Environment & io_rEnv ) | 
					
						
							|  |  |  |     :   // aMap_GlobalFunctionsDisplay,
 | 
					
						
							|  |  |  |         // pClassMembersDisplay,
 | 
					
						
							|  |  |  |         pEnv( &io_rEnv ), | 
					
						
							|  |  |  |         pDocuShow( new Docu_Display(io_rEnv) ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | OperationsDisplay::~OperationsDisplay() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::PrepareForGlobals() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (pClassMembersDisplay) | 
					
						
							|  |  |  |         pClassMembersDisplay = 0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::PrepareForStdMembers() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     pClassMembersDisplay = new PageDisplay(*pEnv); | 
					
						
							|  |  |  |     const ary::cpp::Class * pClass = pEnv->CurClass(); | 
					
						
							|  |  |  |     csv_assert( pClass != 0 ); | 
					
						
							|  |  |  |     pClassMembersDisplay->Setup_OperationsFile_for(*pClass); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::PrepareForStaticMembers() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     // Doesn't need to do anything yet.
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::Create_Files() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if (pClassMembersDisplay) | 
					
						
							|  |  |  |         pClassMembersDisplay->Create_File(); | 
					
						
							|  |  |  |     else | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |          for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalFunctionsDisplay.begin(); | 
					
						
							|  |  |  |               it != aMap_GlobalFunctionsDisplay.end(); | 
					
						
							|  |  |  |               ++it ) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |              (*it).second->Create_File(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::do_Process( const ary::cpp::Function & i_rData ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if ( Ce_IsInternal(i_rData) ) | 
					
						
							|  |  |  |         return; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     PageDisplay & rPage = FindPage_for( i_rData ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     csi::xml::Element & rOut = rPage.CurOut(); | 
					
						
							|  |  |  |     Display_SglOperation( rOut, i_rData ); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | const ary::cpp::Gate * | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | OperationsDisplay::inq_Get_ReFinder() const | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     return & pEnv->Gate(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PageDisplay & | 
					
						
							|  |  |  | OperationsDisplay::FindPage_for( const ary::cpp::Function & i_rData ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     if ( pClassMembersDisplay ) | 
					
						
							|  |  |  |         return *pClassMembersDisplay; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     SourceFileId | 
					
						
							|  |  |  |             nSourceFile = i_rData.Location(); | 
					
						
							|  |  |  |     PageDisplay * | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  |             pFound = csv::value_from_map( aMap_GlobalFunctionsDisplay, nSourceFile, (PageDisplay*)0 ); | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |     if ( pFound == 0 ) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |          pFound = new PageDisplay( *pEnv ); | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  |         const ary::loc::File & | 
					
						
							|  |  |  |                 rFile = pEnv->Gate().Locations().Find_File( nSourceFile ); | 
					
						
							|  |  |  |         pFound->Setup_OperationsFile_for(rFile); | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |         aMap_GlobalFunctionsDisplay[nSourceFile] = pFound; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return *pFound; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void | 
					
						
							|  |  |  | OperationsDisplay::Display_SglOperation( csi::xml::Element &        rOut, | 
					
						
							|  |  |  |                                          const ary::cpp::Function & i_rData ) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     adcdisp::ExplanationList aDocu(rOut, true); | 
					
						
							|  |  |  |     aDocu.AddEntry( 0 ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |     adcdisp::OperationTitle fTitle; | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  |     fTitle( aDocu.Term(), | 
					
						
							|  |  |  |             i_rData.LocalName(), | 
					
						
							|  |  |  |             i_rData.CeId(), | 
					
						
							|  |  |  |             pEnv->Gate() ); | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |     // Syntax
 | 
					
						
							|  |  |  |     adcdisp::ExplanationList aSyntaxHeader(aDocu.Def()); | 
					
						
							|  |  |  |     aSyntaxHeader.AddEntry( 0, "simple" ); | 
					
						
							|  |  |  |     csi::xml::Element & rHeader = aSyntaxHeader.Term(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     adcdisp::ParameterTable | 
					
						
							|  |  |  |         aParams( aSyntaxHeader.Def() ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if (i_rData.TemplateParameters().size() > 0) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         TemplateClause fTemplateClause; | 
					
						
							|  |  |  |         fTemplateClause( rHeader, i_rData.TemplateParameters() ); | 
					
						
							|  |  |  |         rHeader << new html::LineBreak; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if ( i_rData.Flags().IsExternC() ) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |          rHeader | 
					
						
							|  |  |  |                 << "extern \"C\"" | 
					
						
							|  |  |  |                 << new html::LineBreak; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     bool bConst = false; | 
					
						
							|  |  |  |     bool bVolatile = false; | 
					
						
							|  |  |  |     WriteOut_LinkedFunctionText( rHeader, aParams, i_rData, *pEnv, | 
					
						
							|  |  |  |                                  &bConst, &bVolatile ); | 
					
						
							|  |  |  |     aDocu.Def() << new html::LineBreak; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Flags
 | 
					
						
							|  |  |  |     aDocu.AddEntry_NoTerm(); | 
					
						
							|  |  |  |     adcdisp::FlagTable | 
					
						
							|  |  |  |         aFlags( aDocu.Def(), 8 ); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     const ary::cpp::FunctionFlags & | 
					
						
							|  |  |  |         rFFlags = i_rData.Flags(); | 
					
						
							|  |  |  |     aFlags.SetColumn( 0, "virtual", | 
					
						
							|  |  |  |                       i_rData.Virtuality() != ary::cpp::VIRTUAL_none ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 1, "abstract", | 
					
						
							|  |  |  |                       i_rData.Virtuality() == ary::cpp::VIRTUAL_abstract ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 2, "const", bConst ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 3, "volatile", bVolatile ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 4, "template", | 
					
						
							|  |  |  |                       i_rData.TemplateParameters().size() > 0 ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 5, "static", | 
					
						
							|  |  |  |                       rFFlags.IsStaticLocal() OR rFFlags.IsStaticMember() ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 6, "inline", | 
					
						
							|  |  |  |                       rFFlags.IsInline() ); | 
					
						
							|  |  |  |     aFlags.SetColumn( 7, "C-linkage", | 
					
						
							|  |  |  |                       rFFlags.IsExternC() ); | 
					
						
							|  |  |  |     aDocu.Def() << new html::LineBreak; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // Docu
 | 
					
						
							|  |  |  |     aDocu.AddEntry_NoTerm(); | 
					
						
							| 
									
										
										
										
											2007-11-02 15:25:51 +00:00
										 |  |  |     pDocuShow->Assign_Out(aDocu.Def()); | 
					
						
							|  |  |  |     pDocuShow->Process(i_rData.Docu()); | 
					
						
							| 
									
										
										
										
											2002-03-08 13:45:36 +00:00
										 |  |  |     pDocuShow->Unassign_Out(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     rOut << new html::HorizontalLine; | 
					
						
							|  |  |  | } |