summaryrefslogtreecommitdiff
path: root/l10ntools
diff options
context:
space:
mode:
authorobo <obo@openoffice.org>2010-09-14 13:03:44 +0200
committerobo <obo@openoffice.org>2010-09-14 13:03:44 +0200
commit073f3f201aa0b95314ba595383e179afed26ca79 (patch)
tree4733bb5df826c584a81bbe7cc10fe5ab51115ace /l10ntools
parente0e658081ec7e11faf0e0003a435ef87b73f206d (diff)
parent6114961f52943bc4039ab76e59b23d57363f88bd (diff)
CWS-TOOLING: integrate CWS jl158
Diffstat (limited to 'l10ntools')
-rw-r--r--l10ntools/source/help/HelpIndexerTool.java24
-rw-r--r--l10ntools/source/help/HelpLinker.cxx117
2 files changed, 111 insertions, 30 deletions
diff --git a/l10ntools/source/help/HelpIndexerTool.java b/l10ntools/source/help/HelpIndexerTool.java
index 2a49f964d48f..a39b5399e38d 100644
--- a/l10ntools/source/help/HelpIndexerTool.java
+++ b/l10ntools/source/help/HelpIndexerTool.java
@@ -72,6 +72,9 @@ public class HelpIndexerTool
String aSegmentName = "";
// Scan arguments
+ //If this tool is invoked in the build process for extensions help,
+ //then -extension must be set.
+ boolean bExtension = false;
boolean bLang = false;
boolean bMod = false;
boolean bZipDir = false;
@@ -83,7 +86,11 @@ public class HelpIndexerTool
int nArgCount = args.length;
for( int i = 0 ; i < nArgCount ; i++ )
{
- if( "-lang".equals(args[i]) )
+ if( "-extension".equals(args[i]) )
+ {
+ bExtension = true;
+ }
+ else if( "-lang".equals(args[i]) )
{
if( i + 1 < nArgCount )
{
@@ -142,20 +149,21 @@ public class HelpIndexerTool
bSegmentName = true;
}
i++;
- if (!(bCfsName && bSegmentName))
- {
- System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
- System.exit( -1 );
- }
+ if (!(bCfsName && bSegmentName))
+ {
+ System.out.println("Usage: HelpIndexer -checkcfsandsegname _0 _3 (2 arguments needed)");
+ System.exit( -1 );
+ }
}
}
- if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode) )
+ if( !bLang || !bMod || !bZipDir || (!bOutput && !bExtensionMode && !bExtension) )
{
if( bExtensionMode )
return;
System.out.println("Usage: HelpIndexer -lang ISOLangCode -mod HelpModule -zipdir TempZipDir -o OutputZipFile");
+ System.out.println("Usage: HelpIndexer -extension -lang ISOLangCode -mod HelpModule -zipdir PathToLangDir");
System.exit( -1 );
}
@@ -199,7 +207,7 @@ public class HelpIndexerTool
System.out.println( "Checking segment file " + aSegmentName+ ": " + (bSegmentFileOk ? "Found" : "Not found") );
}
- if( bExtensionMode )
+ if( bExtensionMode || bExtension)
{
if( !bSrcDir )
{
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