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 ************************************************************************/
33 // NOT FULLY DEFINED SERVICES
34 #include <cosv/ploc_dir.hxx>
36 #include <toolkit/out_tree.hxx>
38 #include "hi_linkhelper.hxx"
42 const String
C_s_index_files("index-files");
44 const String
C_sUseFileSuffix("-use.html");
45 const String
C_IndexA_FileName("index-1.html");
48 HtmlEnvironment_Idl::HtmlEnvironment_Idl( const csv::ploc::Path
& i_rOutputDir
,
49 const ary::idl::Gate
& i_rGate
,
50 const display::CorporateFrame
& i_rLayout
)
51 : aOutputRoot(i_rOutputDir
),
52 pData(new AryAccess(i_rGate
)),
54 pOutputTree(new output::Tree
),
55 aCurPosition(pOutputTree
->Root()),
61 pOutputTree
->Set_NamesRoot(aHelp
);
63 aHelp
.push_back(output::IndexFilesDirName());
64 pOutputTree
->Set_IndexRoot(aHelp
);
66 (*aHelp
.begin()) = String("com");
67 aHelp
.push_back(String("sun"));
68 aHelp
.push_back(String("star"));
69 pOutputTree
->Set_Overview(aHelp
, output::ModuleFileName() );
71 pLinker
= new LinkHelper(*this);
74 HtmlEnvironment_Idl::~HtmlEnvironment_Idl()
80 StringVector G_aChain
;
84 HtmlEnvironment_Idl::Goto_Directory( output::Position i_pos
,
85 bool i_bCreateDirectoryIfNecessary
)
88 aCurPath
= aOutputRoot
.MyPath();
90 aCurPosition
.Get_Chain(G_aChain
);
91 for ( StringVector::const_iterator it
= G_aChain
.begin();
95 aCurPath
.DirChain() += *it
;
98 if (i_bCreateDirectoryIfNecessary
)
99 create_Directory(aCurPath
);
103 HtmlEnvironment_Idl::Goto_DirectoryLevelDown( const String
& i_subDirName
,
104 bool i_bCreateDirectoryIfNecessary
)
106 aCurPosition
+=(i_subDirName
);
108 aCurPath
.SetFile(String::Null_());
109 aCurPath
.DirChain() += i_subDirName
;
111 if (i_bCreateDirectoryIfNecessary
)
112 create_Directory(aCurPath
);
116 HtmlEnvironment_Idl::Goto_DirectoryLevelUp()
120 aCurPath
.SetFile(String::Null_());
121 aCurPath
.DirChain() -= 1;
125 HtmlEnvironment_Idl::Set_CurFile( const String
& i_fileName
)
127 aCurPath
.SetFile(i_fileName
);
131 HtmlEnvironment_Idl::create_Directory( const csv::ploc::Path
& i_path
)
134 csv::ploc::Directory
aCurDir(i_path
);
135 if (NOT aCurDir
.Exists())
136 aCurDir
.PhysicalCreate();
140 IsAbsoluteLink(const char * i_link
)
147 csize
= sizeof shttp
- 1;
148 csv_assert(csize
== sizeof sfile
- 1);
150 return strncmp(i_link
,shttp
,csize
) == 0
151 OR
strncmp(i_link
,sfile
,csize
) == 0;
156 HtmlEnvironment_Idl::Link2Manual( const String
& i_link
) const
158 if ( IsAbsoluteLink(i_link
.c_str()) )
161 static StreamStr
aLink_(200);
164 sDvgRoot(pLayout
->DevelopersGuideHtmlRoot());
165 if (sDvgRoot
.empty())
166 sDvgRoot
= "../DevelopersGuide";
169 // Enhance performance by calculating this only one time:
170 if ( NOT
IsAbsoluteLink(sDvgRoot
.c_str()) )
171 aCurPosition
.Get_LinkToRoot(aLink_
);
175 return aLink_
.c_str();
179 HtmlEnvironment_Idl::CurPageCe_AsText() const
181 return CurPageCe_AsFile(".html");
185 HtmlEnvironment_Idl::CurPageCe_AsFile(const char * i_sEnding
) const
188 return String::Null_();
190 static StringVector aModule_
;
193 Data().Get_CeText(aModule_
, sCe
, sDummy
, *pCurPageCe
);
194 StreamLock
slCe(500);
195 if (aModule_
.size() > 0)
196 slCe().operator_join(aModule_
.begin(), aModule_
.end(), "/");
198 slCe() << "/" << sCe
<< i_sEnding
;
199 return String(slCe().c_str());
202 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */