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: hi_display.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 <idl/hi_display.hxx>
35 // NOT FULLY DEFINED SERVICES
36 #include <cosv/file.hxx>
37 #include <ary/idl/i_ce.hxx>
38 #include <ary/idl/i_module.hxx>
39 #include <ary/getncast.hxx>
40 #include <toolkit/out_tree.hxx>
44 #include "hi_main.hxx"
47 extern const String C_sCssFilename_Idl
;
51 HtmlDisplay_Idl::IsModule( const ary::idl::CodeEntity
& i_ce
) const
53 return ary::is_type
<ary::idl::Module
>(i_ce
);
56 inline const ary::idl::Module
&
57 HtmlDisplay_Idl::Module_Cast( const ary::idl::CodeEntity
& i_ce
) const
59 return ary::ary_cast
<ary::idl::Module
>(i_ce
);
65 HtmlDisplay_Idl::HtmlDisplay_Idl()
71 HtmlDisplay_Idl::~HtmlDisplay_Idl()
76 HtmlDisplay_Idl::do_Run( const char * i_sOutputDirectory
,
77 const ary::idl::Gate
& i_rAryGate
,
78 const display::CorporateFrame
& i_rLayout
)
80 SetRunData( i_sOutputDirectory
, i_rAryGate
, i_rLayout
);
84 Create_FilesInNameTree();
86 Create_FilesInProjectTree();
92 HtmlDisplay_Idl::SetRunData( const char * i_sOutputDirectory
,
93 const ary::idl::Gate
& i_rAryGate
,
94 const display::CorporateFrame
& i_rLayout
)
96 csv::ploc::Path
aOutputDir( i_sOutputDirectory
, true );
97 pCurPageEnv
= new HtmlEnvironment_Idl( aOutputDir
, i_rAryGate
, i_rLayout
);
98 pMainDisplay
= new MainDisplay_Idl(*pCurPageEnv
);
102 HtmlDisplay_Idl::Create_StartFile()
107 HtmlDisplay_Idl::Create_FilesInNameTree()
109 Cout() << "\nCreate files in subtree namespaces ..." << Endl();
111 const ary::idl::Module
&
112 rGlobalNamespace
= pCurPageEnv
->Data().GlobalNamespace();
113 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().NamesRoot(), true );
115 RecursiveDisplay_Module(rGlobalNamespace
);
117 Cout() << "... done." << Endl();
121 HtmlDisplay_Idl::Create_IndexFiles()
123 Cout() << "\nCreate files in subtree index ..." << Endl();
124 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().IndexRoot(), true );
125 pMainDisplay
->WriteGlobalIndices();
126 Cout() << "... done.\n" << Endl();
129 typedef ary::Dyn_StdConstIterator
<ary::idl::Ce_id
> Dyn_CeIterator
;
130 typedef ary::StdConstIterator
<ary::idl::Ce_id
> CeIterator
;
133 HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module
& i_module
)
135 i_module
.Accept(*pMainDisplay
);
139 i_module
.Get_Names(aMembers
);
141 for ( CeIterator
& iter
= *aMembers
;
145 const ary::idl::CodeEntity
&
146 rCe
= pCurPageEnv
->Data().Find_Ce(*iter
);
148 if ( NOT
IsModule(rCe
) )
149 rCe
.Accept(*pMainDisplay
);
152 pCurPageEnv
->Goto_DirectoryLevelDown( rCe
.LocalName(), true );
153 RecursiveDisplay_Module( Module_Cast(rCe
) );
154 pCurPageEnv
->Goto_DirectoryLevelUp();
160 HtmlDisplay_Idl::Create_FilesInProjectTree()
165 HtmlDisplay_Idl::Create_PackageList()
168 Cout() << "\nCreate package list ..." << std::flush
;
170 pCurPageEnv
->CurPosition() = pCurPageEnv
->OutputTree().Root();
175 Cout() << " done." << Endl();
180 HtmlDisplay_Idl::Create_HelpFile()
185 HtmlDisplay_Idl::Create_CssFile()
187 Cout() << "\nCreate css file ..." << Endl();
189 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().Root(), true );
190 pCurPageEnv
->Set_CurFile( C_sCssFilename_Idl
);
194 pCurPageEnv
->Get_CurFilePath(slCurFilePath());
197 aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE
);
199 aOpenGuard(aCssFile
);
202 Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl();
206 aCssFile
.write("/* Autodoc css file for IDL documentation */\n\n\n");
207 aCssFile
.write(pCurPageEnv
->Layout().CssStyle());
208 aCssFile
.write("\n\n\n");
209 aCssFile
.write(pCurPageEnv
->Layout().CssStylesExplanation());