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 "hi_main.hxx"
24 // NOT FULLY DEFINED SERVICES
26 #include <cosv/ploc.hxx>
27 #include <cosv/file.hxx>
28 #include <ary/idl/i_ce.hxx>
29 #include <ary/idl/ik_ce.hxx>
30 #include <ary/idl/ik_enum.hxx>
31 #include <ary/idl/ik_typedef.hxx>
32 #include <ary/idl/ik_interface.hxx>
33 #include <ary/idl/ik_struct.hxx>
34 #include <ary/idl/ik_exception.hxx>
35 #include <ary/idl/i_constant.hxx>
36 #include <ary/idl/i_constgroup.hxx>
37 #include <ary/idl/i_enum.hxx>
38 #include <ary/idl/i_singleton.hxx>
39 #include <ary/idl/i_sisingleton.hxx>
40 #include <ary/idl/i_exception.hxx>
41 #include <ary/idl/i_interface.hxx>
42 #include <ary/idl/i_service.hxx>
43 #include <ary/idl/i_siservice.hxx>
44 #include <ary/idl/i_struct.hxx>
45 #include <ary/idl/i_typedef.hxx>
46 #include <ary/idl/i_module.hxx>
48 #include <toolkit/htmlfile.hxx>
49 #include <toolkit/out_position.hxx>
50 #include <toolkit/out_tree.hxx>
51 #include "hfi_constgroup.hxx"
52 #include "hfi_enum.hxx"
53 #include "hfi_globalindex.hxx"
54 #include "hfi_interface.hxx"
55 #include "hfi_module.hxx"
56 #include "hfi_struct.hxx"
57 #include "hfi_service.hxx"
58 #include "hfi_singleton.hxx"
59 #include "hfi_siservice.hxx"
60 #include "hfi_typedef.hxx"
61 #include "hfi_xrefpage.hxx"
63 #include "hi_linkhelper.hxx"
66 using ::ary::idl::Ce_id
;
67 using ::ary::idl::Type_id
;
68 using ::ary::idl::ifc_ce::Dyn_CeIterator
;
72 extern const String
C_sCssFilename_Idl("idl.css");
78 Inits (constructor) and creates (destructor) the current
79 html documentation file ( MainDisplay_Idl.pMyFile ).
84 Guard_CurFile( /// For CodeEntities
85 DocuFile_Html
& io_client
,
88 const ary::idl::CodeEntity
&
90 const String
& i_titlePrefix
);
91 Guard_CurFile( /// For Use pages
92 DocuFile_Html
& io_client
,
95 const String
& i_fileName
,
96 const String
& i_titlePrefix
);
97 Guard_CurFile( /// For Modules
98 DocuFile_Html
& io_client
,
101 const ary::idl::CodeEntity
&
103 Guard_CurFile( /// For Indices
104 DocuFile_Html
& io_client
,
105 HtmlEnvironment_Idl
&
110 DocuFile_Html
& rClient
;
111 HtmlEnvironment_Idl
&
117 Sets and releases the current factory pointer
118 ( MainDisplay_Idl.pCurFactory ).
120 class Guard_CurFactoryPtr
124 HtmlFactory_Idl
*& io_client
,
125 HtmlFactory_Idl
& i_factory
)
126 : rpClient(io_client
)
127 { rpClient
= &i_factory
; }
129 ~Guard_CurFactoryPtr()
133 HtmlFactory_Idl
*& rpClient
;
138 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
139 HtmlEnvironment_Idl
& io_env
,
140 const ary::idl::CodeEntity
& i_ce
,
141 const String
& i_titlePrefix
)
142 : rClient(io_client
),
146 io_env
.Set_CurFile( sl() << i_ce
.LocalName()
149 StreamLock
aCurFilePath(700);
150 io_env
.Get_CurFilePath(aCurFilePath());
154 aLocation(aCurFilePath().c_str());
155 rClient
.SetLocation(aLocation
);
157 rClient
.SetTitle( sl() << i_titlePrefix
162 rClient
.SetRelativeCssPath(
163 sl() << io_env
.CurPosition().LinkToRoot()
164 << C_sCssFilename_Idl
167 io_env
.Set_CurPageCe(&i_ce
);
170 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
171 HtmlEnvironment_Idl
& io_env
,
172 const String
& i_fileName
,
173 const String
& i_titlePrefix
)
174 : rClient(io_client
),
178 io_env
.Set_CurFile( sl() << i_fileName
181 StreamLock
aCurFilePath(700);
182 io_env
.Get_CurFilePath(aCurFilePath());
184 aLocation(aCurFilePath().c_str());
187 rClient
.SetLocation(aLocation
);
189 rClient
.SetTitle( sl() << i_titlePrefix
<< " " << i_fileName
<< c_str
);
191 rClient
.SetRelativeCssPath(
192 sl() << io_env
.CurPosition().LinkToRoot()
193 << C_sCssFilename_Idl
196 io_env
.Set_CurPageCe(0);
199 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
200 HtmlEnvironment_Idl
& io_env
,
201 const ary::idl::CodeEntity
& i_ce
)
202 : rClient(io_client
),
205 io_env
.Set_CurFile( output::ModuleFileName() );
206 StreamLock
aCurFilePath(700);
207 io_env
.Get_CurFilePath(aCurFilePath());
209 aLocation(aCurFilePath().c_str());
212 rClient
.SetLocation(aLocation
);
214 rClient
.SetTitle( sl() << "Module " << io_env
.CurPosition().Name() << c_str
);
216 rClient
.SetRelativeCssPath(
217 sl() << io_env
.CurPosition().LinkToRoot()
218 << C_sCssFilename_Idl
221 io_env
.Set_CurPageCe(&i_ce
);
224 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
225 HtmlEnvironment_Idl
& io_env
,
227 : rClient(io_client
),
231 io_env
.Set_CurFile( sl() << "index-"
233 ? int(i_letter
)-'a'+1
237 StreamLock
aCurFilePath(700);
238 io_env
.Get_CurFilePath(aCurFilePath());
240 aLocation(aCurFilePath().c_str());
243 rClient
.SetLocation(aLocation
);
245 rClient
.SetTitle( sl() << "Global Index "
247 ? char(i_letter
-'a'+'A')
251 rClient
.SetRelativeCssPath(
253 << C_sCssFilename_Idl
257 Guard_CurFile::~Guard_CurFile()
259 rClient
.CreateFile();
260 rEnv
.Set_CurPageCe(0);
264 } // anonymous namespace
269 MainDisplay_Idl::MainDisplay_Idl( HtmlEnvironment_Idl
& io_rEnv
)
271 pMyFile(new DocuFile_Html
),
274 // pMyFile->SetStyle( Env().Layout().CssStyle() );
275 pMyFile
->SetCopyright( Env().Layout().CopyrightText() );
278 MainDisplay_Idl::~MainDisplay_Idl()
284 MainDisplay_Idl::WriteGlobalIndices()
286 for ( const char * pLetter
= "abcdefghijklmnopqrstuvwxyz_X"; *pLetter
!= 'X'; ++pLetter
)
288 Guard_CurFile
gFile( *pMyFile
, Env(), *pLetter
);
290 HF_IdlGlobalIndex
aFactory( *pEnv
, pMyFile
->Body() );
291 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
293 aFactory
.Produce_Page( ary::idl::alphabetical_index::E_Letter(*pLetter
) );
299 MainDisplay_Idl::do_Process( const ary::idl::Module
& i_ce
)
301 Guard_CurFile
gFile( *pMyFile
,
304 HF_IdlModule
aFactory( *pEnv
, pMyFile
->Body() );
305 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
307 aFactory
.Produce_byData(i_ce
);
311 MainDisplay_Idl::do_Process( const ary::idl::Interface
& i_ce
)
313 do_InterfaceDescr(i_ce
);
314 do_Interface2s(i_ce
);
318 MainDisplay_Idl::do_Process( const ary::idl::Service
& i_ce
)
320 do_ServiceDescr(i_ce
);
325 MainDisplay_Idl::do_Process( const ary::idl::SglIfcService
& i_ce
)
327 do_SglIfcServiceDescr(i_ce
);
331 MainDisplay_Idl::do_Process( const ary::idl::Struct
& i_ce
)
333 do_StructDescr(i_ce
);
338 MainDisplay_Idl::do_Process( const ary::idl::Exception
& i_ce
)
340 do_ExceptionDescr(i_ce
);
341 do_Exception2s(i_ce
);
345 MainDisplay_Idl::do_Process( const ary::idl::Enum
& i_ce
)
352 MainDisplay_Idl::do_Process( const ary::idl::Typedef
& i_ce
)
354 do_TypedefDescr(i_ce
);
359 MainDisplay_Idl::do_Process( const ary::idl::ConstantsGroup
& i_ce
)
361 Guard_CurFile
gFile( *pMyFile
,
364 "Constants' Group" );
365 HF_IdlConstGroup
aFactory( *pEnv
, pMyFile
->Body() );
366 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
368 aFactory
.Produce_byData(i_ce
);
372 MainDisplay_Idl::do_Process( const ary::idl::Singleton
& i_ce
)
374 Guard_CurFile
gFile( *pMyFile
,
378 HF_IdlSingleton
aFactory( *pEnv
, pMyFile
->Body() );
379 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
381 aFactory
.Produce_byData_ServiceBased(i_ce
);
385 MainDisplay_Idl::do_Process( const ary::idl::SglIfcSingleton
& i_ce
)
387 Guard_CurFile
gFile( *pMyFile
,
391 HF_IdlSingleton
aFactory( *pEnv
, pMyFile
->Body() );
392 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
394 aFactory
.Produce_byData_InterfaceBased(i_ce
);
398 MainDisplay_Idl::do_InterfaceDescr( const ary::idl::CodeEntity
& i_ce
)
400 Guard_CurFile
gFile( *pMyFile
,
404 HF_IdlInterface
aInterface( *pEnv
, pMyFile
->Body() );
405 Guard_CurFactoryPtr
gFactory(pCurFactory
,aInterface
);
407 aInterface
.Produce_byData(i_ce
);
411 MainDisplay_Idl::do_ServiceDescr( const ary::idl::CodeEntity
& i_ce
)
413 Guard_CurFile
gFile( *pMyFile
,
417 HF_IdlService
aFactory( *pEnv
, pMyFile
->Body() );
418 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
420 aFactory
.Produce_byData(i_ce
);
424 MainDisplay_Idl::do_SglIfcServiceDescr( const ary::idl::CodeEntity
& i_ce
)
426 Guard_CurFile
gFile( *pMyFile
,
430 HF_IdlSglIfcService
aFactory( *pEnv
, pMyFile
->Body() );
431 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
433 aFactory
.Produce_byData(i_ce
);
437 MainDisplay_Idl::do_StructDescr( const ary::idl::CodeEntity
& i_ce
)
439 Guard_CurFile
gFile( *pMyFile
,
443 HF_IdlStruct
aFactory( *pEnv
, pMyFile
->Body(), false );
444 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
446 aFactory
.Produce_byData(i_ce
);
450 MainDisplay_Idl::do_ExceptionDescr( const ary::idl::CodeEntity
& i_ce
)
452 Guard_CurFile
gFile( *pMyFile
,
456 HF_IdlStruct
aFactory( *pEnv
, pMyFile
->Body(), true );
457 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
459 aFactory
.Produce_byData(i_ce
);
463 MainDisplay_Idl::do_EnumDescr( const ary::idl::CodeEntity
& i_ce
)
465 Guard_CurFile
gFile( *pMyFile
,
469 HF_IdlEnum
aFactory( *pEnv
, pMyFile
->Body() );
470 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
472 aFactory
.Produce_byData(i_ce
);
476 MainDisplay_Idl::do_TypedefDescr( const ary::idl::CodeEntity
& i_ce
)
478 Guard_CurFile
gFile( *pMyFile
,
482 HF_IdlTypedef
aFactory( *pEnv
, pMyFile
->Body() );
483 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
485 aFactory
.Produce_byData(i_ce
);
489 MainDisplay_Idl::do_Interface2s( const ary::idl::CodeEntity
& i_ce
)
492 String
sUsesFileName(
495 << Env().Linker().XrefsSuffix()
497 Guard_CurFile
gFile( *pMyFile
,
500 "Uses of Interface" );
501 HF_IdlXrefs
aUses( *pEnv
,
503 C_sCePrefix_Interface
,
508 "Derived Interfaces",
511 &ary::idl::ifc_interface::xref::Get_Derivations
);
513 Dyn_CeIterator pXrefList
;
515 ary::idl::ifc_interface::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
520 ary::idl::ifc_interface::xref::Get_ExportingServices(pXrefList
,i_ce
);
522 "Services which Support this Interface",
523 "#SupportingServices",
525 ary::idl::ifc_interface::xref::Get_ExportingSingletons(pXrefList
,i_ce
);
527 "Singletons which Support this Interface",
528 "#SupportingSingletons",
530 ary::idl::ifc_interface::xref::Get_AsReturns(pXrefList
,i_ce
);
532 "Uses as Return Type",
535 ary::idl::ifc_interface::xref::Get_AsParameters(pXrefList
,i_ce
);
540 ary::idl::ifc_interface::xref::Get_AsDataTypes(pXrefList
,i_ce
);
545 aUses
.Write_ManualLinks(i_ce
);
549 MainDisplay_Idl::do_Service2s( const ary::idl::CodeEntity
& i_ce
)
552 String
sUsesFileName(
555 << Env().Linker().XrefsSuffix()
557 Guard_CurFile
gFile( *pMyFile
,
561 HF_IdlXrefs
aUses( *pEnv
,
565 Dyn_CeIterator pXrefList
;
566 ary::idl::ifc_service::xref::Get_IncludingServices(pXrefList
,i_ce
);
568 "Services which Include this Service",
569 "#IncludingServices",
572 ary::idl::ifc_service::xref::Get_InstantiatingSingletons(pXrefList
,i_ce
);
574 "Singletons which Instantiate this Service",
577 aUses
.Write_ManualLinks(i_ce
);
581 MainDisplay_Idl::do_Struct2s( const ary::idl::CodeEntity
& i_ce
)
584 String
sUsesFileName(
587 << Env().Linker().XrefsSuffix()
589 Guard_CurFile
gFile( *pMyFile
,
593 HF_IdlXrefs
aUses( *pEnv
,
602 &ary::idl::ifc_struct::xref::Get_Derivations
);
604 Dyn_CeIterator pXrefList
;
606 ary::idl::ifc_struct::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
611 ary::idl::ifc_struct::xref::Get_AsReturns(pXrefList
,i_ce
);
613 "Uses as Return Type",
616 ary::idl::ifc_struct::xref::Get_AsParameters(pXrefList
,i_ce
);
621 ary::idl::ifc_struct::xref::Get_AsDataTypes(pXrefList
,i_ce
);
626 aUses
.Write_ManualLinks(i_ce
);
630 MainDisplay_Idl::do_Exception2s( const ary::idl::CodeEntity
& i_ce
)
633 String
sUsesFileName(
636 << Env().Linker().XrefsSuffix()
638 Guard_CurFile
gFile( *pMyFile
,
641 "Uses of Exception" );
642 HF_IdlXrefs
aUses( *pEnv
,
644 C_sCePrefix_Exception
,
648 "Derived Exceptions",
651 &ary::idl::ifc_exception::xref::Get_Derivations
);
653 Dyn_CeIterator pXrefList
;
655 ary::idl::ifc_exception::xref::Get_RaisingFunctions(pXrefList
,i_ce
);
660 aUses
.Write_ManualLinks(i_ce
);
664 MainDisplay_Idl::do_Enum2s( const ary::idl::CodeEntity
& i_ce
)
667 String
sUsesFileName(
670 << Env().Linker().XrefsSuffix()
672 Guard_CurFile
gFile( *pMyFile
,
676 HF_IdlXrefs
aUses( *pEnv
,
680 Dyn_CeIterator pXrefList
;
681 ary::idl::ifc_enum::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
686 ary::idl::ifc_enum::xref::Get_AsReturns(pXrefList
,i_ce
);
688 "Uses as Return Type",
691 ary::idl::ifc_enum::xref::Get_AsParameters(pXrefList
,i_ce
);
696 ary::idl::ifc_enum::xref::Get_AsDataTypes(pXrefList
,i_ce
);
701 aUses
.Write_ManualLinks(i_ce
);
705 MainDisplay_Idl::do_Typedef2s( const ary::idl::CodeEntity
& i_ce
)
708 String
sUsesFileName(
709 sl() << i_ce
.LocalName()
710 << Env().Linker().XrefsSuffix()
712 Guard_CurFile
gFile( *pMyFile
,
716 HF_IdlXrefs
aUses( *pEnv
,
720 Dyn_CeIterator pXrefList
;
721 ary::idl::ifc_typedef::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
726 ary::idl::ifc_typedef::xref::Get_AsReturns(pXrefList
,i_ce
);
728 "Uses as Return Type",
731 ary::idl::ifc_typedef::xref::Get_AsParameters(pXrefList
,i_ce
);
736 ary::idl::ifc_typedef::xref::Get_AsDataTypes(pXrefList
,i_ce
);
741 aUses
.Write_ManualLinks(i_ce
);
744 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */