1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include <idl/hi_display.hxx>
24 // NOT FULLY DEFINED SERVICES
25 #include <cosv/file.hxx>
26 #include <ary/idl/i_ce.hxx>
27 #include <ary/idl/i_module.hxx>
28 #include <ary/getncast.hxx>
29 #include <toolkit/out_tree.hxx>
33 #include "hi_main.hxx"
36 extern const String C_sCssFilename_Idl
;
40 HtmlDisplay_Idl::IsModule( const ary::idl::CodeEntity
& i_ce
) const
42 return ary::is_type
<ary::idl::Module
>(i_ce
);
45 inline const ary::idl::Module
&
46 HtmlDisplay_Idl::Module_Cast( const ary::idl::CodeEntity
& i_ce
) const
48 return ary::ary_cast
<ary::idl::Module
>(i_ce
);
54 HtmlDisplay_Idl::HtmlDisplay_Idl()
60 HtmlDisplay_Idl::~HtmlDisplay_Idl()
65 HtmlDisplay_Idl::do_Run( const char * i_sOutputDirectory
,
66 const ary::idl::Gate
& i_rAryGate
,
67 const display::CorporateFrame
& i_rLayout
)
69 SetRunData( i_sOutputDirectory
, i_rAryGate
, i_rLayout
);
73 Create_FilesInNameTree();
75 Create_FilesInProjectTree();
81 HtmlDisplay_Idl::SetRunData( const char * i_sOutputDirectory
,
82 const ary::idl::Gate
& i_rAryGate
,
83 const display::CorporateFrame
& i_rLayout
)
85 csv::ploc::Path
aOutputDir( i_sOutputDirectory
, true );
86 pCurPageEnv
= new HtmlEnvironment_Idl( aOutputDir
, i_rAryGate
, i_rLayout
);
87 pMainDisplay
= new MainDisplay_Idl(*pCurPageEnv
);
91 HtmlDisplay_Idl::Create_StartFile()
96 HtmlDisplay_Idl::Create_FilesInNameTree()
98 Cout() << "\nCreate files in subtree namespaces ..." << Endl();
100 const ary::idl::Module
&
101 rGlobalNamespace
= pCurPageEnv
->Data().GlobalNamespace();
102 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().NamesRoot(), true );
104 RecursiveDisplay_Module(rGlobalNamespace
);
106 Cout() << "... done." << Endl();
110 HtmlDisplay_Idl::Create_IndexFiles()
112 Cout() << "\nCreate files in subtree index ..." << Endl();
113 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().IndexRoot(), true );
114 pMainDisplay
->WriteGlobalIndices();
115 Cout() << "... done.\n" << Endl();
118 typedef ary::Dyn_StdConstIterator
<ary::idl::Ce_id
> Dyn_CeIterator
;
119 typedef ary::StdConstIterator
<ary::idl::Ce_id
> CeIterator
;
122 HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module
& i_module
)
124 i_module
.Accept(*pMainDisplay
);
128 i_module
.Get_Names(aMembers
);
130 for ( CeIterator
& iter
= *aMembers
;
134 const ary::idl::CodeEntity
&
135 rCe
= pCurPageEnv
->Data().Find_Ce(*iter
);
137 if ( NOT
IsModule(rCe
) )
138 rCe
.Accept(*pMainDisplay
);
141 pCurPageEnv
->Goto_DirectoryLevelDown( rCe
.LocalName(), true );
142 RecursiveDisplay_Module( Module_Cast(rCe
) );
143 pCurPageEnv
->Goto_DirectoryLevelUp();
149 HtmlDisplay_Idl::Create_FilesInProjectTree()
154 HtmlDisplay_Idl::Create_PackageList()
159 HtmlDisplay_Idl::Create_HelpFile()
164 HtmlDisplay_Idl::Create_CssFile()
166 Cout() << "\nCreate css file ..." << Endl();
168 pCurPageEnv
->Goto_Directory( pCurPageEnv
->OutputTree().Root(), true );
169 pCurPageEnv
->Set_CurFile( C_sCssFilename_Idl
);
173 pCurPageEnv
->Get_CurFilePath(slCurFilePath());
176 aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE
);
178 aOpenGuard(aCssFile
);
181 Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl();
185 aCssFile
.write("/* Autodoc css file for IDL documentation */\n\n\n");
186 aCssFile
.write(pCurPageEnv
->Layout().CssStyle());
187 aCssFile
.write("\n\n\n");
188 aCssFile
.write(pCurPageEnv
->Layout().CssStylesExplanation());
191 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */