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 .
24 // NOT FULLY DEFINED SERVICES
25 #include <cosv/ploc_dir.hxx>
27 #include <toolkit/out_tree.hxx>
29 #include "hi_linkhelper.hxx"
33 const String
C_s_index_files("index-files");
35 const String
C_sUseFileSuffix("-use.html");
36 const String
C_IndexA_FileName("index-1.html");
39 HtmlEnvironment_Idl::HtmlEnvironment_Idl( const csv::ploc::Path
& i_rOutputDir
,
40 const ary::idl::Gate
& i_rGate
,
41 const display::CorporateFrame
& i_rLayout
)
42 : aOutputRoot(i_rOutputDir
),
43 pData(new AryAccess(i_rGate
)),
45 pOutputTree(new output::Tree
),
46 aCurPosition(pOutputTree
->Root()),
52 pOutputTree
->Set_NamesRoot(aHelp
);
54 aHelp
.push_back(output::IndexFilesDirName());
55 pOutputTree
->Set_IndexRoot(aHelp
);
57 (*aHelp
.begin()) = String("com");
58 aHelp
.push_back(String("sun"));
59 aHelp
.push_back(String("star"));
60 pOutputTree
->Set_Overview(aHelp
, output::ModuleFileName() );
62 pLinker
= new LinkHelper(*this);
65 HtmlEnvironment_Idl::~HtmlEnvironment_Idl()
71 StringVector G_aChain
;
75 HtmlEnvironment_Idl::Goto_Directory( output::Position i_pos
,
76 bool i_bCreateDirectoryIfNecessary
)
79 aCurPath
= aOutputRoot
.MyPath();
81 aCurPosition
.Get_Chain(G_aChain
);
82 for ( StringVector::const_iterator it
= G_aChain
.begin();
86 aCurPath
.DirChain() += *it
;
89 if (i_bCreateDirectoryIfNecessary
)
90 create_Directory(aCurPath
);
94 HtmlEnvironment_Idl::Goto_DirectoryLevelDown( const String
& i_subDirName
,
95 bool i_bCreateDirectoryIfNecessary
)
97 aCurPosition
+=(i_subDirName
);
99 aCurPath
.SetFile(String::Null_());
100 aCurPath
.DirChain() += i_subDirName
;
102 if (i_bCreateDirectoryIfNecessary
)
103 create_Directory(aCurPath
);
107 HtmlEnvironment_Idl::Goto_DirectoryLevelUp()
111 aCurPath
.SetFile(String::Null_());
112 aCurPath
.DirChain() -= 1;
116 HtmlEnvironment_Idl::Set_CurFile( const String
& i_fileName
)
118 aCurPath
.SetFile(i_fileName
);
122 HtmlEnvironment_Idl::create_Directory( const csv::ploc::Path
& i_path
)
125 csv::ploc::Directory
aCurDir(i_path
);
126 if (NOT aCurDir
.Exists())
127 aCurDir
.PhysicalCreate();
131 IsAbsoluteLink(const char * i_link
)
138 csize
= sizeof shttp
- 1;
139 csv_assert(csize
== sizeof sfile
- 1);
141 return strncmp(i_link
,shttp
,csize
) == 0
142 OR
strncmp(i_link
,sfile
,csize
) == 0;
147 HtmlEnvironment_Idl::Link2Manual( const String
& i_link
) const
149 if ( IsAbsoluteLink(i_link
.c_str()) )
152 static StreamStr
aLink_(200);
155 sDvgRoot(pLayout
->DevelopersGuideHtmlRoot());
156 if (sDvgRoot
.empty())
157 sDvgRoot
= "../DevelopersGuide";
160 // Enhance performance by calculating this only one time:
161 if ( NOT
IsAbsoluteLink(sDvgRoot
.c_str()) )
162 aCurPosition
.Get_LinkToRoot(aLink_
);
166 return aLink_
.c_str();
170 HtmlEnvironment_Idl::CurPageCe_AsText() const
172 return CurPageCe_AsFile(".html");
176 HtmlEnvironment_Idl::CurPageCe_AsFile(const char * i_sEnding
) const
179 return String::Null_();
181 static StringVector aModule_
;
184 Data().Get_CeText(aModule_
, sCe
, sDummy
, *pCurPageCe
);
185 StreamLock
slCe(500);
186 if (aModule_
.size() > 0)
187 slCe().operator_join(aModule_
.begin(), aModule_
.end(), "/");
189 slCe() << "/" << sCe
<< i_sEnding
;
190 return String(slCe().c_str());
193 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */