1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: pm_aldef.cxx,v $
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 ************************************************************************/
32 #include "pm_aldef.hxx"
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/tpl/tpltools.hxx>
37 #include <ary/cpp/c_gate.hxx>
38 #include <ary/cpp/c_define.hxx>
39 #include <ary/cpp/c_macro.hxx>
40 #include <ary/cpp/cp_def.hxx>
41 #include <ary/loc/loc_file.hxx>
42 #include <ary/loc/locp_le.hxx>
43 #include <ary/getncast.hxx>
44 #include "hd_docu.hxx"
45 #include "html_kit.hxx"
46 #include "navibar.hxx"
47 #include "opageenv.hxx"
48 #include "pagemake.hxx"
49 #include "strconst.hxx"
53 using csi::html::HorizontalLine
;
54 using csi::html::Link
;
55 using csi::html::Label
;
56 using csi::html::AlignAttr
;
60 PageMaker_AllDefs::PageMaker_AllDefs( PageDisplay
& io_rPage
)
61 : SpecializedPageMaker(io_rPage
),
62 pDocuDisplay( new Docu_Display(io_rPage
.Env()) ),
67 PageMaker_AllDefs::~PageMaker_AllDefs()
72 PageMaker_AllDefs::MakePage()
74 pNavi
= new NavigationBar( Env(), NavigationBar::LOC_AllDefs
);
82 pNavi
->Write_SubRows();
86 PageMaker_AllDefs::Write_NavBar()
88 pNavi
->MakeSubRow( "" );
89 pNavi
->AddItem( "Defines", "defines", true );
90 pNavi
->AddItem( "Macros", "macros", true );
91 pNavi
->Write( CurOut() );
92 CurOut() << new HorizontalLine
;
96 PageMaker_AllDefs::Write_TopArea()
98 adcdisp::PageTitle_Std fTitle
;
99 fTitle( CurOut(), "Defines and ", "Macros" );
101 CurOut() << new HorizontalLine
;
105 PageMaker_AllDefs::Write_DocuArea()
111 PageMaker_AllDefs::Write_DefinesList()
114 << new html::LineBreak
115 << new html::LineBreak
116 >> *new xml::AnElement("div")
117 << new html::ClassAttr("define")
118 >> *new html::Label("defines")
119 >> *new html::Headline(3)
122 ary::cpp::DefsResultList
123 aAllDefines
= Env().Gate().Defs().AllDefines();
124 ary::cpp::DefsConstIterator
125 itEnd
= aAllDefines
.end();
127 if (aAllDefines
.begin() != itEnd
)
129 for ( ary::cpp::DefsConstIterator it
= aAllDefines
.begin();
141 CurOut() << new HorizontalLine
;
145 PageMaker_AllDefs::Write_MacrosList()
149 << new html::LineBreak
150 << new html::LineBreak
151 >> *new xml::AnElement("div")
152 << new html::ClassAttr("define")
153 >> *new html::Label("macros")
154 >> *new html::Headline(3)
157 ary::cpp::DefsResultList
158 aAllMacros
= Env().Gate().Defs().AllMacros();
159 ary::cpp::DefsConstIterator
160 itEnd
= aAllMacros
.end();
162 if (aAllMacros
.begin() != itEnd
)
164 for ( ary::cpp::DefsConstIterator it
= aAllMacros
.begin();
176 CurOut() << new HorizontalLine
;
180 PageMaker_AllDefs::Write_Define(De_id i_nId
)
182 csv_assert( ary::is_type
<ary::cpp::Define
>( Env().Gate().Defs().Find_Def(i_nId
)) );
183 const ary::cpp::Define
&
184 rDef
= static_cast< const ary::cpp::Define
& >( Env().Gate().Defs().Find_Def(i_nId
) );
186 CurOut() << new html::HorizontalLine
;
188 adcdisp::ExplanationList
aDocu( CurOut(), true );
192 >> *new html::Label( rDef
.LocalName() )
197 Write_DefsDocu( aDocu
.Def(), rDef
);
201 PageMaker_AllDefs::Write_Macro(De_id i_nId
)
203 csv_assert( Env().Gate().Defs().Find_Def(i_nId
).AryClass() == ary::cpp::Macro::class_id
);
204 const ary::cpp::Macro
&
205 rDef
= static_cast< const ary::cpp::Macro
& >( Env().Gate().Defs().Find_Def(i_nId
) );
207 CurOut() << new html::HorizontalLine
;
209 adcdisp::ExplanationList
aDocu( CurOut(), true );
213 >> *new html::Label( rDef
.LocalName() )
218 WriteOut_TokenList( aDocu
.Term(), rDef
.Params(), ", " );
222 Write_DefsDocu( aDocu
.Def(), rDef
);
227 PageMaker_AllDefs::Write_DefsDocu( csi::xml::Element
& o_rOut
,
228 const ary::cpp::DefineEntity
& i_rTextReplacement
)
230 if ( i_rTextReplacement
.DefinitionText().size() > 0 )
232 EraseLeadingSpace( *const_cast< String
* >(
233 &(*i_rTextReplacement
.DefinitionText().begin())
237 adcdisp::ExplanationTable
rList( o_rOut
);
239 rList
.AddEntry( "Defined As" );
240 WriteOut_TokenList( rList
.Def(), i_rTextReplacement
.DefinitionText(), " " );
242 const ary::loc::File
&
243 rFile
= Env().Gate().Locations().Find_File( i_rTextReplacement
.Location() );
244 rList
.AddEntry( "In File" );
245 rList
.Def() << rFile
.LocalName();
247 ShowDocu_On( o_rOut
, *pDocuDisplay
, i_rTextReplacement
);