fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / autodoc / source / display / idl / hi_display.cxx
blobfc1d93088be2888c51db9d771ca6bc778f393529
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <precomp.h>
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>
30 #include <cfrstd.hxx>
31 #include "hi_ary.hxx"
32 #include "hi_env.hxx"
33 #include "hi_main.hxx"
36 extern const String C_sCssFilename_Idl;
39 inline bool
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()
55 : pCurPageEnv(),
56 pMainDisplay()
60 HtmlDisplay_Idl::~HtmlDisplay_Idl()
64 void
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 );
71 Create_StartFile();
72 Create_CssFile();
73 Create_FilesInNameTree();
74 Create_IndexFiles();
75 Create_FilesInProjectTree();
76 Create_PackageList();
77 Create_HelpFile();
80 void
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);
90 void
91 HtmlDisplay_Idl::Create_StartFile()
95 void
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();
109 void
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;
121 void
122 HtmlDisplay_Idl::RecursiveDisplay_Module( const ary::idl::Module & i_module )
124 i_module.Accept(*pMainDisplay);
126 Dyn_CeIterator
127 aMembers;
128 i_module.Get_Names(aMembers);
130 for ( CeIterator & iter = *aMembers;
131 iter;
132 ++iter )
134 const ary::idl::CodeEntity &
135 rCe = pCurPageEnv->Data().Find_Ce(*iter);
137 if ( NOT IsModule(rCe) )
138 rCe.Accept(*pMainDisplay);
139 else
141 pCurPageEnv->Goto_DirectoryLevelDown( rCe.LocalName(), true );
142 RecursiveDisplay_Module( Module_Cast(rCe) );
143 pCurPageEnv->Goto_DirectoryLevelUp();
145 } // end for
148 void
149 HtmlDisplay_Idl::Create_FilesInProjectTree()
153 void
154 HtmlDisplay_Idl::Create_PackageList()
158 void
159 HtmlDisplay_Idl::Create_HelpFile()
163 void
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 );
171 StreamLock
172 slCurFilePath(700);
173 pCurPageEnv->Get_CurFilePath(slCurFilePath());
175 csv::File
176 aCssFile(slCurFilePath().c_str(), csv::CFM_CREATE);
177 csv::OpenCloseGuard
178 aOpenGuard(aCssFile);
179 if (NOT aOpenGuard)
181 Cerr() << "Can't create file " << slCurFilePath().c_str() << "." << Endl();
182 return;
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: */