summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/help/HelpLinker.cxx117
1 files changed, 95 insertions, 22 deletions
diff --git a/l10ntools/source/help/HelpLinker.cxx b/l10ntools/source/help/HelpLinker.cxx
index 94139f89de1e..411859bfe994 100644
--- a/l10ntools/source/help/HelpLinker.cxx
+++ b/l10ntools/source/help/HelpLinker.cxx
@@ -269,6 +269,8 @@ private:
fs::path idxContentStylesheet;
fs::path zipdir;
fs::path outputFile;
+ std::string extsource;
+ std::string extdestination;
std::string module;
std::string lang;
std::string hid;
@@ -762,18 +764,9 @@ void HelpLinker::main( std::vector<std::string> &args,
const rtl::OUString* pOfficeHelpPath )
throw( HelpProcessingException )
{
- rtl::OUString aOfficeHelpPath;
-
bExtensionMode = false;
- if( pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath )
- {
- helpFiles.clear();
- bExtensionMode = true;
- extensionPath = *pExtensionPath;
- sourceRoot = fs::path(extensionPath);
- extensionDestination = *pDestination;
- aOfficeHelpPath = *pOfficeHelpPath;
- }
+ helpFiles.clear();
+
if (args.size() > 0 && args[0][0] == '@')
{
std::vector<std::string> stringList;
@@ -793,10 +786,34 @@ void HelpLinker::main( std::vector<std::string> &args,
}
size_t i = 0;
-
+ bool bSrcOption = false;
while (i < args.size())
{
- if (args[i].compare("-src") == 0)
+ if (args[i].compare("-extlangsrc") == 0)
+ {
+ ++i;
+ if (i >= args.size())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "extension source missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ extsource = args[i];
+ }
+ else if (args[i].compare("-extlangdest") == 0)
+ {
+ //If this argument is not provided then the location provided in -extsource will
+ //also be the destination
+ ++i;
+ if (i >= args.size())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "extension destination missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ extdestination = args[i];
+ }
+ else if (args[i].compare("-src") == 0)
{
++i;
if (i >= args.size())
@@ -805,9 +822,8 @@ void HelpLinker::main( std::vector<std::string> &args,
aStrStream << "sourceroot missing" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
-
- if( !bExtensionMode )
- sourceRoot = fs::path(args[i], fs::native);
+ bSrcOption = true;
+ sourceRoot = fs::path(args[i], fs::native);
}
else if (args[i].compare("-sty") == 0)
{
@@ -933,21 +949,70 @@ void HelpLinker::main( std::vector<std::string> &args,
++i;
}
+ //We can be called from the helplinker executable or the extension manager
+ //In the latter case extsource is not used.
+ if( (pExtensionPath && pExtensionPath->length() > 0 && pOfficeHelpPath)
+ || !extsource.empty())
+ {
+ bExtensionMode = true;
+ if (!extsource.empty())
+ {
+ //called from helplinker.exe, pExtensionPath and pOfficeHelpPath
+ //should be NULL
+ sourceRoot = fs::path(extsource, fs::native);
+ extensionPath = sourceRoot.toUTF8();
+
+ if (extdestination.empty())
+ {
+ std::stringstream aStrStream;
+ aStrStream << "-extlangdest is missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ else
+ {
+ //Convert from system path to file URL!!!
+ fs::path p(extdestination, fs::native);
+ extensionDestination = p.toUTF8();
+ }
+ }
+ else
+ { //called from extension manager
+ extensionPath = *pExtensionPath;
+ sourceRoot = fs::path(extensionPath);
+ extensionDestination = *pDestination;
+ }
+ //check if -src option was used. This option must not be used
+ //when extension help is compiled.
+ if (bSrcOption)
+ {
+ std::stringstream aStrStream;
+ aStrStream << "-src must not be used together with -extsource missing" << std::endl;
+ throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
+ }
+ }
+
if (!bExtensionMode && zipdir.empty())
{
std::stringstream aStrStream;
aStrStream << "no index dir given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- if (!bExtensionMode && idxCaptionStylesheet.empty())
+
+ if (!bExtensionMode && idxCaptionStylesheet.empty()
+ || !extsource.empty() && idxCaptionStylesheet.empty())
{
+ //No extension mode and extension mode using commandline
+ //!extsource.empty indicates extension mode using commandline
+ // -idxcaption paramter is required
std::stringstream aStrStream;
aStrStream << "no index caption stylesheet given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- else if ( bExtensionMode )
+ else if ( bExtensionMode && extsource.empty())
{
- rtl::OUString aIdxCaptionPathFileURL( aOfficeHelpPath );
+ //This part is used when compileExtensionHelp is called from the extensions manager.
+ //If extension help is compiled using helplinker in the build process
+ rtl::OUString aIdxCaptionPathFileURL( *pOfficeHelpPath );
aIdxCaptionPathFileURL += rtl::OUString::createFromAscii( "/idxcaption.xsl" );
rtl::OString aOStr_IdxCaptionPathFileURL( rtl::OUStringToOString
@@ -956,15 +1021,23 @@ void HelpLinker::main( std::vector<std::string> &args,
idxCaptionStylesheet = fs::path( aStdStr_IdxCaptionPathFileURL );
}
- if (!bExtensionMode && idxContentStylesheet.empty())
+
+ if (!bExtensionMode && idxContentStylesheet.empty()
+ || !extsource.empty() && idxContentStylesheet.empty())
{
+ //No extension mode and extension mode using commandline
+ //!extsource.empty indicates extension mode using commandline
+ // -idxcontent paramter is required
std::stringstream aStrStream;
aStrStream << "no index content stylesheet given" << std::endl;
throw HelpProcessingException( HELPPROCESSING_GENERAL_ERROR, aStrStream.str() );
}
- else if ( bExtensionMode )
+ else if ( bExtensionMode && extsource.empty())
{
- rtl::OUString aIdxContentPathFileURL( aOfficeHelpPath );
+ //If extension help is compiled using helplinker in the build process
+ //then -idxcontent must be supplied
+ //This part is used when compileExtensionHelp is called from the extensions manager.
+ rtl::OUString aIdxContentPathFileURL( *pOfficeHelpPath );
aIdxContentPathFileURL += rtl::OUString::createFromAscii( "/idxcontent.xsl" );
rtl::OString aOStr_IdxContentPathFileURL( rtl::OUStringToOString