Update ooo320-m1
[ooovba.git] / autodoc / source / display / html / dsply_op.cxx
blob3bd8fd37220d94955b50861effbdf14c52601de3
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dsply_op.cxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include <precomp.h>
32 #include "dsply_op.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/cpp/c_funct.hxx>
38 #include <ary/cpp/c_gate.hxx>
39 #include <ary/loc/locp_le.hxx>
40 #include <udm/html/htmlitem.hxx>
41 #include "hd_docu.hxx"
42 #include "hdimpl.hxx"
43 #include "html_kit.hxx"
44 #include "opageenv.hxx"
45 #include "pagemake.hxx"
47 using namespace csi;
48 using namespace adcdisp;
53 OperationsDisplay::OperationsDisplay( OuputPage_Environment & io_rEnv )
54 : // aMap_GlobalFunctionsDisplay,
55 // pClassMembersDisplay,
56 pEnv( &io_rEnv ),
57 pDocuShow( new Docu_Display(io_rEnv) )
61 OperationsDisplay::~OperationsDisplay()
63 csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay );
66 void
67 OperationsDisplay::PrepareForStdMembers()
69 csv::erase_map_of_heap_ptrs( aMap_GlobalFunctionsDisplay );
71 pClassMembersDisplay = new PageDisplay(*pEnv);
72 const ary::cpp::Class * pClass = pEnv->CurClass();
73 csv_assert( pClass != 0 );
74 pClassMembersDisplay->Setup_OperationsFile_for(*pClass);
77 void
78 OperationsDisplay::PrepareForStaticMembers()
80 // Doesn't need to do anything yet.
83 void
84 OperationsDisplay::Create_Files()
86 if (pClassMembersDisplay)
87 pClassMembersDisplay->Create_File();
88 else
90 for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalFunctionsDisplay.begin();
91 it != aMap_GlobalFunctionsDisplay.end();
92 ++it )
94 (*it).second->Create_File();
99 void
100 OperationsDisplay::do_Process( const ary::cpp::Function & i_rData )
102 if ( Ce_IsInternal(i_rData) )
103 return;
105 PageDisplay & rPage = FindPage_for( i_rData );
107 csi::xml::Element & rOut = rPage.CurOut();
108 Display_SglOperation( rOut, i_rData );
111 const ary::cpp::Gate *
112 OperationsDisplay::inq_Get_ReFinder() const
114 return & pEnv->Gate();
117 PageDisplay &
118 OperationsDisplay::FindPage_for( const ary::cpp::Function & i_rData )
120 if ( pClassMembersDisplay )
121 return *pClassMembersDisplay;
123 SourceFileId
124 nSourceFile = i_rData.Location();
125 PageDisplay *
126 pFound = csv::value_from_map( aMap_GlobalFunctionsDisplay, nSourceFile, (PageDisplay*)0 );
127 if ( pFound == 0 )
129 pFound = new PageDisplay( *pEnv );
130 const ary::loc::File &
131 rFile = pEnv->Gate().Locations().Find_File( nSourceFile );
132 pFound->Setup_OperationsFile_for(rFile);
133 aMap_GlobalFunctionsDisplay[nSourceFile] = pFound;
136 return *pFound;
139 void
140 OperationsDisplay::Display_SglOperation( csi::xml::Element & rOut,
141 const ary::cpp::Function & i_rData )
143 adcdisp::ExplanationList aDocu(rOut, true);
144 aDocu.AddEntry( 0 );
147 adcdisp::OperationTitle fTitle;
148 fTitle( aDocu.Term(),
149 i_rData.LocalName(),
150 i_rData.CeId(),
151 pEnv->Gate() );
153 // Syntax
154 adcdisp::ExplanationList aSyntaxHeader(aDocu.Def());
155 aSyntaxHeader.AddEntry( 0, "simple" );
156 csi::xml::Element & rHeader = aSyntaxHeader.Term();
158 adcdisp::ParameterTable
159 aParams( aSyntaxHeader.Def() );
161 if (i_rData.TemplateParameters().size() > 0)
163 TemplateClause fTemplateClause;
164 fTemplateClause( rHeader, i_rData.TemplateParameters() );
165 rHeader << new html::LineBreak;
167 if ( i_rData.Flags().IsExternC() )
169 rHeader
170 << "extern \"C\""
171 << new html::LineBreak;
174 bool bConst = false;
175 bool bVolatile = false;
176 WriteOut_LinkedFunctionText( rHeader, aParams, i_rData, *pEnv,
177 &bConst, &bVolatile );
178 aDocu.Def() << new html::LineBreak;
180 // Flags
181 aDocu.AddEntry_NoTerm();
182 adcdisp::FlagTable
183 aFlags( aDocu.Def(), 8 );
185 const ary::cpp::FunctionFlags &
186 rFFlags = i_rData.Flags();
187 aFlags.SetColumn( 0, "virtual",
188 i_rData.Virtuality() != ary::cpp::VIRTUAL_none );
189 aFlags.SetColumn( 1, "abstract",
190 i_rData.Virtuality() == ary::cpp::VIRTUAL_abstract );
191 aFlags.SetColumn( 2, "const", bConst );
192 aFlags.SetColumn( 3, "volatile", bVolatile );
193 aFlags.SetColumn( 4, "template",
194 i_rData.TemplateParameters().size() > 0 );
195 aFlags.SetColumn( 5, "static",
196 rFFlags.IsStaticLocal() OR rFFlags.IsStaticMember() );
197 aFlags.SetColumn( 6, "inline",
198 rFFlags.IsInline() );
199 aFlags.SetColumn( 7, "C-linkage",
200 rFFlags.IsExternC() );
201 aDocu.Def() << new html::LineBreak;
203 // Docu
204 aDocu.AddEntry_NoTerm();
205 pDocuShow->Assign_Out(aDocu.Def());
206 pDocuShow->Process(i_rData.Docu());
207 pDocuShow->Unassign_Out();
209 rOut << new html::HorizontalLine;