1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
12 * OpenOffice.org is free software: you can redistribute it and/or modify
13 * it under the terms of the GNU Lesser General Public License version 3
14 * only, as published by the Free Software Foundation.
16 * OpenOffice.org is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License version 3 for more details
20 * (a copy is included in the LICENSE file that accompanied this code).
22 * You should have received a copy of the GNU Lesser General Public License
23 * version 3 along with OpenOffice.org. If not, see
24 * <http://www.openoffice.org/license.html>
25 * for a copy of the LGPLv3 License.
27 ************************************************************************/
30 #include "hi_main.hxx"
33 // NOT FULLY DEFINED SERVICES
35 #include <cosv/ploc.hxx>
36 #include <cosv/file.hxx>
37 #include <ary/idl/i_ce.hxx>
38 #include <ary/idl/ik_ce.hxx>
39 #include <ary/idl/ik_enum.hxx>
40 #include <ary/idl/ik_typedef.hxx>
41 #include <ary/idl/ik_interface.hxx>
42 #include <ary/idl/ik_struct.hxx>
43 #include <ary/idl/ik_exception.hxx>
44 #include <ary/idl/i_constant.hxx>
45 #include <ary/idl/i_constgroup.hxx>
46 #include <ary/idl/i_enum.hxx>
47 #include <ary/idl/i_singleton.hxx>
48 #include <ary/idl/i_sisingleton.hxx>
49 #include <ary/idl/i_exception.hxx>
50 #include <ary/idl/i_interface.hxx>
51 #include <ary/idl/i_service.hxx>
52 #include <ary/idl/i_siservice.hxx>
53 #include <ary/idl/i_struct.hxx>
54 #include <ary/idl/i_typedef.hxx>
55 #include <ary/idl/i_module.hxx>
57 #include <toolkit/htmlfile.hxx>
58 #include <toolkit/out_position.hxx>
59 #include <toolkit/out_tree.hxx>
60 #include "hfi_constgroup.hxx"
61 #include "hfi_enum.hxx"
62 #include "hfi_globalindex.hxx"
63 #include "hfi_interface.hxx"
64 #include "hfi_module.hxx"
65 #include "hfi_struct.hxx"
66 #include "hfi_service.hxx"
67 #include "hfi_singleton.hxx"
68 #include "hfi_siservice.hxx"
69 #include "hfi_typedef.hxx"
70 #include "hfi_xrefpage.hxx"
72 #include "hi_linkhelper.hxx"
75 using ::ary::idl::Ce_id
;
76 using ::ary::idl::Type_id
;
77 using ::ary::idl::ifc_ce::Dyn_CeIterator
;
81 extern const String
C_sCssFilename_Idl("idl.css");
87 Inits (constructor) and creates (destructor) the current
88 html documentation file ( MainDisplay_Idl.pMyFile ).
93 Guard_CurFile( /// For CodeEntities
94 DocuFile_Html
& io_client
,
97 const ary::idl::CodeEntity
&
99 const String
& i_titlePrefix
);
100 Guard_CurFile( /// For Use pages
101 DocuFile_Html
& io_client
,
102 HtmlEnvironment_Idl
&
104 const String
& i_fileName
,
105 const String
& i_titlePrefix
);
106 Guard_CurFile( /// For Modules
107 DocuFile_Html
& io_client
,
108 HtmlEnvironment_Idl
&
110 const ary::idl::CodeEntity
&
112 Guard_CurFile( /// For Indices
113 DocuFile_Html
& io_client
,
114 HtmlEnvironment_Idl
&
119 DocuFile_Html
& rClient
;
120 HtmlEnvironment_Idl
&
126 Sets and releases the current factory pointer
127 ( MainDisplay_Idl.pCurFactory ).
129 class Guard_CurFactoryPtr
133 HtmlFactory_Idl
*& io_client
,
134 HtmlFactory_Idl
& i_factory
)
135 : rpClient(io_client
)
136 { rpClient
= &i_factory
; }
138 ~Guard_CurFactoryPtr()
142 HtmlFactory_Idl
*& rpClient
;
147 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
148 HtmlEnvironment_Idl
& io_env
,
149 const ary::idl::CodeEntity
& i_ce
,
150 const String
& i_titlePrefix
)
151 : rClient(io_client
),
155 io_env
.Set_CurFile( sl() << i_ce
.LocalName()
158 StreamLock
aCurFilePath(700);
159 io_env
.Get_CurFilePath(aCurFilePath());
163 aLocation(aCurFilePath().c_str());
164 rClient
.SetLocation(aLocation
);
166 rClient
.SetTitle( sl() << i_titlePrefix
171 rClient
.SetRelativeCssPath(
172 sl() << io_env
.CurPosition().LinkToRoot()
173 << C_sCssFilename_Idl
176 io_env
.Set_CurPageCe(&i_ce
);
179 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
180 HtmlEnvironment_Idl
& io_env
,
181 const String
& i_fileName
,
182 const String
& i_titlePrefix
)
183 : rClient(io_client
),
187 io_env
.Set_CurFile( sl() << i_fileName
190 StreamLock
aCurFilePath(700);
191 io_env
.Get_CurFilePath(aCurFilePath());
193 aLocation(aCurFilePath().c_str());
196 rClient
.SetLocation(aLocation
);
198 rClient
.SetTitle( sl() << i_titlePrefix
<< " " << i_fileName
<< c_str
);
200 rClient
.SetRelativeCssPath(
201 sl() << io_env
.CurPosition().LinkToRoot()
202 << C_sCssFilename_Idl
205 io_env
.Set_CurPageCe(0);
208 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
209 HtmlEnvironment_Idl
& io_env
,
210 const ary::idl::CodeEntity
& i_ce
)
211 : rClient(io_client
),
214 io_env
.Set_CurFile( output::ModuleFileName() );
215 StreamLock
aCurFilePath(700);
216 io_env
.Get_CurFilePath(aCurFilePath());
218 aLocation(aCurFilePath().c_str());
221 rClient
.SetLocation(aLocation
);
223 rClient
.SetTitle( sl() << "Module " << io_env
.CurPosition().Name() << c_str
);
225 rClient
.SetRelativeCssPath(
226 sl() << io_env
.CurPosition().LinkToRoot()
227 << C_sCssFilename_Idl
230 io_env
.Set_CurPageCe(&i_ce
);
233 Guard_CurFile::Guard_CurFile( DocuFile_Html
& io_client
,
234 HtmlEnvironment_Idl
& io_env
,
236 : rClient(io_client
),
240 io_env
.Set_CurFile( sl() << "index-"
242 ? int(i_letter
)-'a'+1
246 StreamLock
aCurFilePath(700);
247 io_env
.Get_CurFilePath(aCurFilePath());
249 aLocation(aCurFilePath().c_str());
252 rClient
.SetLocation(aLocation
);
254 rClient
.SetTitle( sl() << "Global Index "
256 ? char(i_letter
-'a'+'A')
260 rClient
.SetRelativeCssPath(
262 << C_sCssFilename_Idl
266 Guard_CurFile::~Guard_CurFile()
268 rClient
.CreateFile();
269 rEnv
.Set_CurPageCe(0);
273 } // anonymous namespace
278 MainDisplay_Idl::MainDisplay_Idl( HtmlEnvironment_Idl
& io_rEnv
)
280 pMyFile(new DocuFile_Html
),
283 // pMyFile->SetStyle( Env().Layout().CssStyle() );
284 pMyFile
->SetCopyright( Env().Layout().CopyrightText() );
287 MainDisplay_Idl::~MainDisplay_Idl()
293 MainDisplay_Idl::WriteGlobalIndices()
295 for ( const char * pLetter
= "abcdefghijklmnopqrstuvwxyz_X"; *pLetter
!= 'X'; ++pLetter
)
297 Guard_CurFile
gFile( *pMyFile
, Env(), *pLetter
);
299 HF_IdlGlobalIndex
aFactory( *pEnv
, pMyFile
->Body() );
300 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
302 aFactory
.Produce_Page( ary::idl::alphabetical_index::E_Letter(*pLetter
) );
308 MainDisplay_Idl::do_Process( const ary::idl::Module
& i_ce
)
310 Guard_CurFile
gFile( *pMyFile
,
313 HF_IdlModule
aFactory( *pEnv
, pMyFile
->Body() );
314 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
316 aFactory
.Produce_byData(i_ce
);
320 MainDisplay_Idl::do_Process( const ary::idl::Interface
& i_ce
)
322 do_InterfaceDescr(i_ce
);
323 do_Interface2s(i_ce
);
327 MainDisplay_Idl::do_Process( const ary::idl::Service
& i_ce
)
329 do_ServiceDescr(i_ce
);
334 MainDisplay_Idl::do_Process( const ary::idl::SglIfcService
& i_ce
)
336 do_SglIfcServiceDescr(i_ce
);
340 MainDisplay_Idl::do_Process( const ary::idl::Struct
& i_ce
)
342 do_StructDescr(i_ce
);
347 MainDisplay_Idl::do_Process( const ary::idl::Exception
& i_ce
)
349 do_ExceptionDescr(i_ce
);
350 do_Exception2s(i_ce
);
354 MainDisplay_Idl::do_Process( const ary::idl::Enum
& i_ce
)
361 MainDisplay_Idl::do_Process( const ary::idl::Typedef
& i_ce
)
363 do_TypedefDescr(i_ce
);
368 MainDisplay_Idl::do_Process( const ary::idl::ConstantsGroup
& i_ce
)
370 Guard_CurFile
gFile( *pMyFile
,
373 "Constants' Group" );
374 HF_IdlConstGroup
aFactory( *pEnv
, pMyFile
->Body() );
375 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
377 aFactory
.Produce_byData(i_ce
);
381 MainDisplay_Idl::do_Process( const ary::idl::Singleton
& i_ce
)
383 Guard_CurFile
gFile( *pMyFile
,
387 HF_IdlSingleton
aFactory( *pEnv
, pMyFile
->Body() );
388 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
390 aFactory
.Produce_byData_ServiceBased(i_ce
);
394 MainDisplay_Idl::do_Process( const ary::idl::SglIfcSingleton
& i_ce
)
396 Guard_CurFile
gFile( *pMyFile
,
400 HF_IdlSingleton
aFactory( *pEnv
, pMyFile
->Body() );
401 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
403 aFactory
.Produce_byData_InterfaceBased(i_ce
);
407 MainDisplay_Idl::do_InterfaceDescr( const ary::idl::CodeEntity
& i_ce
)
409 Guard_CurFile
gFile( *pMyFile
,
413 HF_IdlInterface
aInterface( *pEnv
, pMyFile
->Body() );
414 Guard_CurFactoryPtr
gFactory(pCurFactory
,aInterface
);
416 aInterface
.Produce_byData(i_ce
);
420 MainDisplay_Idl::do_ServiceDescr( const ary::idl::CodeEntity
& i_ce
)
422 Guard_CurFile
gFile( *pMyFile
,
426 HF_IdlService
aFactory( *pEnv
, pMyFile
->Body() );
427 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
429 aFactory
.Produce_byData(i_ce
);
433 MainDisplay_Idl::do_SglIfcServiceDescr( const ary::idl::CodeEntity
& i_ce
)
435 Guard_CurFile
gFile( *pMyFile
,
439 HF_IdlSglIfcService
aFactory( *pEnv
, pMyFile
->Body() );
440 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
442 aFactory
.Produce_byData(i_ce
);
446 MainDisplay_Idl::do_StructDescr( const ary::idl::CodeEntity
& i_ce
)
448 Guard_CurFile
gFile( *pMyFile
,
452 HF_IdlStruct
aFactory( *pEnv
, pMyFile
->Body(), false );
453 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
455 aFactory
.Produce_byData(i_ce
);
459 MainDisplay_Idl::do_ExceptionDescr( const ary::idl::CodeEntity
& i_ce
)
461 Guard_CurFile
gFile( *pMyFile
,
465 HF_IdlStruct
aFactory( *pEnv
, pMyFile
->Body(), true );
466 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
468 aFactory
.Produce_byData(i_ce
);
472 MainDisplay_Idl::do_EnumDescr( const ary::idl::CodeEntity
& i_ce
)
474 Guard_CurFile
gFile( *pMyFile
,
478 HF_IdlEnum
aFactory( *pEnv
, pMyFile
->Body() );
479 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
481 aFactory
.Produce_byData(i_ce
);
485 MainDisplay_Idl::do_TypedefDescr( const ary::idl::CodeEntity
& i_ce
)
487 Guard_CurFile
gFile( *pMyFile
,
491 HF_IdlTypedef
aFactory( *pEnv
, pMyFile
->Body() );
492 Guard_CurFactoryPtr
gFactory(pCurFactory
,aFactory
);
494 aFactory
.Produce_byData(i_ce
);
498 MainDisplay_Idl::do_Interface2s( const ary::idl::CodeEntity
& i_ce
)
501 String
sUsesFileName(
504 << Env().Linker().XrefsSuffix()
506 Guard_CurFile
gFile( *pMyFile
,
509 "Uses of Interface" );
510 HF_IdlXrefs
aUses( *pEnv
,
512 C_sCePrefix_Interface
,
517 "Derived Interfaces",
520 &ary::idl::ifc_interface::xref::Get_Derivations
);
522 Dyn_CeIterator pXrefList
;
524 ary::idl::ifc_interface::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
529 ary::idl::ifc_interface::xref::Get_ExportingServices(pXrefList
,i_ce
);
531 "Services which Support this Interface",
532 "#SupportingServices",
534 ary::idl::ifc_interface::xref::Get_ExportingSingletons(pXrefList
,i_ce
);
536 "Singletons which Support this Interface",
537 "#SupportingSingletons",
539 ary::idl::ifc_interface::xref::Get_AsReturns(pXrefList
,i_ce
);
541 "Uses as Return Type",
544 ary::idl::ifc_interface::xref::Get_AsParameters(pXrefList
,i_ce
);
549 ary::idl::ifc_interface::xref::Get_AsDataTypes(pXrefList
,i_ce
);
554 aUses
.Write_ManualLinks(i_ce
);
558 MainDisplay_Idl::do_Service2s( const ary::idl::CodeEntity
& i_ce
)
561 String
sUsesFileName(
564 << Env().Linker().XrefsSuffix()
566 Guard_CurFile
gFile( *pMyFile
,
570 HF_IdlXrefs
aUses( *pEnv
,
574 Dyn_CeIterator pXrefList
;
575 ary::idl::ifc_service::xref::Get_IncludingServices(pXrefList
,i_ce
);
577 "Services which Include this Service",
578 "#IncludingServices",
581 ary::idl::ifc_service::xref::Get_InstantiatingSingletons(pXrefList
,i_ce
);
583 "Singletons which Instantiate this Service",
586 aUses
.Write_ManualLinks(i_ce
);
590 MainDisplay_Idl::do_Struct2s( const ary::idl::CodeEntity
& i_ce
)
593 String
sUsesFileName(
596 << Env().Linker().XrefsSuffix()
598 Guard_CurFile
gFile( *pMyFile
,
602 HF_IdlXrefs
aUses( *pEnv
,
611 &ary::idl::ifc_struct::xref::Get_Derivations
);
613 Dyn_CeIterator pXrefList
;
615 ary::idl::ifc_struct::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
620 ary::idl::ifc_struct::xref::Get_AsReturns(pXrefList
,i_ce
);
622 "Uses as Return Type",
625 ary::idl::ifc_struct::xref::Get_AsParameters(pXrefList
,i_ce
);
630 ary::idl::ifc_struct::xref::Get_AsDataTypes(pXrefList
,i_ce
);
635 aUses
.Write_ManualLinks(i_ce
);
639 MainDisplay_Idl::do_Exception2s( const ary::idl::CodeEntity
& i_ce
)
642 String
sUsesFileName(
645 << Env().Linker().XrefsSuffix()
647 Guard_CurFile
gFile( *pMyFile
,
650 "Uses of Exception" );
651 HF_IdlXrefs
aUses( *pEnv
,
653 C_sCePrefix_Exception
,
657 "Derived Exceptions",
660 &ary::idl::ifc_exception::xref::Get_Derivations
);
662 Dyn_CeIterator pXrefList
;
664 ary::idl::ifc_exception::xref::Get_RaisingFunctions(pXrefList
,i_ce
);
669 aUses
.Write_ManualLinks(i_ce
);
673 MainDisplay_Idl::do_Enum2s( const ary::idl::CodeEntity
& i_ce
)
676 String
sUsesFileName(
679 << Env().Linker().XrefsSuffix()
681 Guard_CurFile
gFile( *pMyFile
,
685 HF_IdlXrefs
aUses( *pEnv
,
689 Dyn_CeIterator pXrefList
;
690 ary::idl::ifc_enum::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
695 ary::idl::ifc_enum::xref::Get_AsReturns(pXrefList
,i_ce
);
697 "Uses as Return Type",
700 ary::idl::ifc_enum::xref::Get_AsParameters(pXrefList
,i_ce
);
705 ary::idl::ifc_enum::xref::Get_AsDataTypes(pXrefList
,i_ce
);
710 aUses
.Write_ManualLinks(i_ce
);
714 MainDisplay_Idl::do_Typedef2s( const ary::idl::CodeEntity
& i_ce
)
717 String
sUsesFileName(
718 sl() << i_ce
.LocalName()
719 << Env().Linker().XrefsSuffix()
721 Guard_CurFile
gFile( *pMyFile
,
725 HF_IdlXrefs
aUses( *pEnv
,
729 Dyn_CeIterator pXrefList
;
730 ary::idl::ifc_typedef::xref::Get_SynonymTypedefs(pXrefList
,i_ce
);
735 ary::idl::ifc_typedef::xref::Get_AsReturns(pXrefList
,i_ce
);
737 "Uses as Return Type",
740 ary::idl::ifc_typedef::xref::Get_AsParameters(pXrefList
,i_ce
);
745 ary::idl::ifc_typedef::xref::Get_AsDataTypes(pXrefList
,i_ce
);
750 aUses
.Write_ManualLinks(i_ce
);
753 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */