Update ooo320-m1
[ooovba.git] / autodoc / source / display / html / dsply_da.cxx
blob8aa5937d24e93072c8c2f333386de399bd93707c
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_da.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_da.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/cpp/c_gate.hxx>
38 #include <ary/cpp/c_vari.hxx>
39 #include <ary/doc/d_docu.hxx>
40 #include <ary/loc/loc_file.hxx>
41 #include <ary/loc/locp_le.hxx>
42 #include <udm/html/htmlitem.hxx>
43 #include "hd_docu.hxx"
44 #include "hdimpl.hxx"
45 #include "html_kit.hxx"
46 #include "opageenv.hxx"
47 #include "pagemake.hxx"
50 using namespace csi;
54 DataDisplay::DataDisplay( OuputPage_Environment & io_rEnv )
55 : aMap_GlobalDataDisplay(),
56 pClassMembersDisplay(0),
57 pEnv( &io_rEnv ),
58 pDocuShow( new Docu_Display(io_rEnv) )
62 DataDisplay::~DataDisplay()
64 csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
67 void
68 DataDisplay::PrepareForConstants()
70 if (pClassMembersDisplay)
71 pClassMembersDisplay = 0;
73 csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
76 void
77 DataDisplay::PrepareForVariables()
79 // Doesn't need to do anything yet.
82 void
83 DataDisplay::PrepareForStdMembers()
85 csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
87 pClassMembersDisplay = new PageDisplay(*pEnv);
88 const ary::cpp::Class * pClass = pEnv->CurClass();
89 csv_assert( pClass != 0 );
90 pClassMembersDisplay->Setup_DataFile_for(*pClass);
93 void
94 DataDisplay::PrepareForStaticMembers()
96 // Doesn't need to do anything yet.
99 void
100 DataDisplay::Create_Files()
102 if (pClassMembersDisplay)
104 pClassMembersDisplay->Create_File();
105 pClassMembersDisplay = 0;
107 else
109 for ( Map_FileId2PagePtr::const_iterator it = aMap_GlobalDataDisplay.begin();
110 it != aMap_GlobalDataDisplay.end();
111 ++it )
113 (*it).second->Create_File();
115 csv::erase_map_of_heap_ptrs( aMap_GlobalDataDisplay );
119 void
120 DataDisplay::do_Process( const ary::cpp::Variable & i_rData )
122 if ( Ce_IsInternal(i_rData) )
123 return;
125 PageDisplay & rPage = FindPage_for( i_rData );
127 csi::xml::Element & rOut = rPage.CurOut();
128 Display_SglDatum( rOut, i_rData );
131 const ary::cpp::Gate *
132 DataDisplay::inq_Get_ReFinder() const
134 return & pEnv->Gate();
137 PageDisplay &
138 DataDisplay::FindPage_for( const ary::cpp::Variable & i_rData )
140 if ( pClassMembersDisplay )
141 return *pClassMembersDisplay;
143 SourceFileId
144 nSourceFile = i_rData.Location();
145 PageDisplay *
146 pFound = csv::value_from_map( aMap_GlobalDataDisplay, nSourceFile, (PageDisplay*)0 );
147 if ( pFound == 0 )
149 pFound = new PageDisplay( *pEnv );
150 const ary::loc::File &
151 rFile = pEnv->Gate().Locations().Find_File( nSourceFile );
152 pFound->Setup_DataFile_for(rFile);
153 aMap_GlobalDataDisplay[nSourceFile] = pFound;
156 return *pFound;
159 void
160 DataDisplay::Display_SglDatum( csi::xml::Element & rOut,
161 const ary::cpp::Variable & i_rData )
163 adcdisp::ExplanationList aDocu(rOut, true);
164 aDocu.AddEntry( 0 );
166 aDocu.Term()
167 >> *new html::Label( DataLabel(i_rData.LocalName()) )
168 << " ";
169 aDocu.Term()
170 << i_rData.LocalName();
172 dshelp::Get_LinkedTypeText( aDocu.Def(), *pEnv, i_rData.Type() );
173 aDocu.Def()
174 << " "
175 >> *new html::Strong
176 << i_rData.LocalName();
177 if ( i_rData.ArraySize().length() > 0 )
179 aDocu.Def()
180 << "["
181 << i_rData.ArraySize()
182 << "]";
184 if ( i_rData.Initialisation().length() > 0 )
186 aDocu.Def()
187 << " = "
188 << i_rData.Initialisation();
190 aDocu.Def()
191 << ";"
192 << new html::LineBreak
193 << new html::LineBreak;
195 aDocu.AddEntry_NoTerm();
197 pDocuShow->Assign_Out(aDocu.Def());
198 pDocuShow->Process(i_rData.Docu());
199 pDocuShow->Unassign_Out();
201 rOut << new html::HorizontalLine;