This is an automated email from the ASF dual-hosted git repository.
mseidel pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/openoffice.git
The following commit(s) were added to refs/heads/trunk by this push:
new b979193529 pre-commit auto clean up whitespace in JS files (#405)
b979193529 is described below
commit b979193529a53bac9c684a0a7e765235c16a6d91
Author: John Bampton <[email protected]>
AuthorDate: Thu Sep 4 05:25:34 2025 +1000
pre-commit auto clean up whitespace in JS files (#405)
For `JS` files enforced three hooks
- end-of-file-fixer
- mixed-line-ending
- trailing-whitespace
---
.pre-commit-config.yaml | 6 +-
main/odk/cfgWin.js | 254 +++---
.../openoffice/ooxml/schema/generator/html/code.js | 908 ++++++++++-----------
.../ExportSheetsToHTML/exportsheetstohtml.js | 22 +-
.../examples/javascript/HelloWorld/helloworld.js | 8 +-
.../javascript/Highlight/ButtonPressHandler.js | 18 +-
.../examples/javascript/Highlight/ShowDialog.js | 20 +-
.../framework/provider/javascript/template.js | 16 +-
8 files changed, 626 insertions(+), 626 deletions(-)
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index ae3471798a..8d50bf8263 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -51,12 +51,12 @@ repos:
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: end-of-file-fixer
- files:
(m|M)akefile$|\.(asp|bat|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|m|m4|md|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|vbs|xba|xcs|xcu|xdl|xhp|xlb|xmi|xml|xsd|xslt?|ya?ml)$|^ext_libraries/.*$|^test/.*$
+ files:
(m|M)akefile$|\.(asp|bat|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|js|m|m4|md|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|vbs|xba|xcs|xcu|xdl|xhp|xlb|xmi|xml|xsd|xslt?|ya?ml)$|^ext_libraries/.*$|^test/.*$
- id: fix-byte-order-marker
- id: mixed-line-ending
- files:
\.(asp|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|m|m4|md|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|xba|xcs|xcu|xdl|xhp|xlb|xmi|xsd|xslt?|ya?ml)$|^main/accessibility/.*$|^main/afms/.*$|^main/animations/.*$|^main/apache-commons/.*$|^test/testgui/.*$
+ files:
\.(asp|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|js|m|m4|md|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|xba|xcs|xcu|xdl|xhp|xlb|xmi|xsd|xslt?|ya?ml)$|^main/accessibility/.*$|^main/afms/.*$|^main/animations/.*$|^main/apache-commons/.*$|^test/testgui/.*$
- id: trailing-whitespace
- files:
(m|M)akefile$|\.(asp|bat|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|m|m4|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|vbs|xba|xcs|xcu|xdl|xhp|xlb|xmi|xml|xsd|ya?ml)$
+ files:
(m|M)akefile$|\.(asp|bat|c|cl|cmd|common|component|cxx|dxp|el|h|hrc|hxx|idl|in|ini|java|js|m|m4|mk|mm|mod|pas|php|pl|pm|pmk|py|rc|rdf|rng|sh|vbs|xba|xcs|xcu|xdl|xhp|xlb|xmi|xml|xsd|ya?ml)$
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
diff --git a/main/odk/cfgWin.js b/main/odk/cfgWin.js
index 64ebed843a..816c59d360 100644
--- a/main/odk/cfgWin.js
+++ b/main/odk/cfgWin.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,16 +7,16 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
// This script asks for variables, which are necessary for building the
@@ -106,7 +106,7 @@ function getSdkHome()
var scriptname = WScript.ScriptFullName;
sSuggestedHome = scriptname.substr(0,scriptname.length-10);
}
-
+
while(true)
{
stdout.Write("\n Enter the Office Software Development Kit directory
[" +
@@ -114,14 +114,14 @@ function getSdkHome()
var sHome = stdin.ReadLine();
if (sHome.length == 0)
{
- //No user input, use default.
+ //No user input, use default.
if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
{
stdout.WriteLine("\n Error: Could not find directory \"" +
sSuggestedHome + "\". An SDK is required,
please" +
" specify the
path to a valid installation.");
continue;
- }
+ }
sHome = sSuggestedHome;
}
else
@@ -129,7 +129,7 @@ function getSdkHome()
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist. Please enter the path to
a" +
"valid SDK
installation.");
continue;
@@ -150,7 +150,7 @@ function getSdkHome()
}
return sHome;
- }
+ }
}
function getOfficeOrUre()
@@ -175,16 +175,16 @@ function getOfficeHome()
var sSuggestedHome = WshSysEnv("OFFICE_HOME");
if (sSuggestedHome.length == 0)
{
- try {
+ try {
sSuggestedHome = WshShell.RegRead(regKeyOfficeCurrentUser6432Node);
- //The registry entry points to the program folder but we need the
+ //The registry entry points to the program folder but we need the
//installation folder
} catch(exc) {}
if (sSuggestedHome.length == 0)
{
try {
sSuggestedHome =
WshShell.RegRead(regKeyOfficeLocaleMachine6432Node);
- //The registry entry points to the program folder but we need
+ //The registry entry points to the program folder but we need
//the installation folder
} catch (exc) {}
}
@@ -192,7 +192,7 @@ function getOfficeHome()
{
try {
sSuggestedHome = WshShell.RegRead(regKeyOfficeLocaleMachine);
- //The registry entry points to the program folder but we need
+ //The registry entry points to the program folder but we need
//the installation folder
} catch (exc) {}
}
@@ -200,19 +200,19 @@ function getOfficeHome()
{
try {
sSuggestedHome = WshShell.RegRead(regKeyOfficeLocaleMachine);
- //The registry entry points to the program folder but we need
+ //The registry entry points to the program folder but we need
//the installation folder
} catch (exc) {}
}
var index=0;
- if ((index = sSuggestedHome.lastIndexOf("\\")) != -1)
+ if ((index = sSuggestedHome.lastIndexOf("\\")) != -1)
sSuggestedHome = sSuggestedHome.substr(0, index);
if (sSuggestedHome.length == 0)
sSuggestedHome = searchOffice();
}
-
+
while(true)
{
stdout.Write("\n Enter the Office base installation directory [" +
@@ -220,23 +220,23 @@ function getOfficeHome()
var sHome = stdin.ReadLine();
if (sHome.length == 0)
{
- //No user input, use default.
+ //No user input, use default.
if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
{
- stdout.WriteLine("\n Error: Could not find directory \"" +
+ stdout.WriteLine("\n Error: Could not find directory \"" +
sSuggestedHome + "\" An office installation
is " +
"required,
please specify the path to a valid " +
"office
installation.");
sSuggestedHome = "";
continue;
- }
+ }
sHome = sSuggestedHome;
} else
{
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist. Please specify the path
to " +
"a valid
office installation.");
continue;
@@ -270,7 +270,7 @@ function searchOffice()
if (aFileSystemObject.FileExists(tmp + "\\program\\soffice.exe")) {
return tmp;
}
-
+
return "";
}
@@ -279,7 +279,7 @@ function getOfficeBaseHome()
{
var officebase = oo_sdk_home;
var index=officebase.lastIndexOf("\\");
-
+
officebase = officebase.substr(0, index);
return officebase;
@@ -288,7 +288,7 @@ function getOfficeBaseHome()
function getMakeHome()
{
var sSuggestedHome = WshSysEnv("OO_SDK_MAKE_HOME");
-
+
while(true)
{
stdout.Write("\n Enter GNU make (3.79.1 or higher) tools directory [" +
@@ -296,7 +296,7 @@ function getMakeHome()
var sHome = stdin.ReadLine();
if (sHome.length == 0)
{
- //No user input, use default.
+ //No user input, use default.
if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
{
stdout.WriteLine("\n Error: Could not find directory \"" +
@@ -304,14 +304,14 @@ function getMakeHome()
"please
specify a GNU make tools directory.");
sSuggestedHome = "";
continue;
- }
+ }
sHome = sSuggestedHome;
} else
{
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist. GNU make is required, " +
"please
specify a GNU make tools directory.");
continue;
@@ -325,13 +325,13 @@ function getMakeHome()
}
if (! aFileSystemObject.FileExists(sMakePath))
{
- stdout.WriteLine("\n Error: Could not find \"" + sMakePath +
+ stdout.WriteLine("\n Error: Could not find \"" + sMakePath +
"\". GNU make is
required, please specify a GNU " +
"make tools
directory.");
continue;
}
return sHome;
- }
+ }
}
function getZipHome()
@@ -341,7 +341,7 @@ function getZipHome()
if (sSuggestedHome.length == 0 && oo_sdk_make_home.length > 0) {
sSuggestedHome = oo_sdk_make_home;
}
-
+
while(true)
{
stdout.Write("\n Enter a zip (2.3 or higher) tools directory [" +
@@ -349,15 +349,15 @@ function getZipHome()
var sHome = stdin.ReadLine();
if (sHome.length == 0)
{
- //No user input, use default.
+ //No user input, use default.
if ( ! aFileSystemObject.FolderExists(sSuggestedHome))
{
- stdout.WriteLine("\n Error: Could not find directory \"" +
+ stdout.WriteLine("\n Error: Could not find directory \"" +
sSuggestedHome
+ "\". zip is required, please " +
"specify a zip
tools directory.");
sSuggestedHome = "";
continue;
- }
+ }
sHome = sSuggestedHome;
}
else
@@ -365,7 +365,7 @@ function getZipHome()
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist. zip is required, please "
+
"specify a zip
tools directory.");
continue;
@@ -375,13 +375,13 @@ function getZipHome()
var sZipPath = sHome + "\\zip.exe";
if (! aFileSystemObject.FileExists(sZipPath))
{
- stdout.WriteLine("\n Error: Could not find \"" + sZipPath +
+ stdout.WriteLine("\n Error: Could not find \"" + sZipPath +
"\". zip is required, please specify a zip tools
" +
"directory.");
continue;
}
return sHome;
- }
+ }
}
function getCatHome()
@@ -500,7 +500,7 @@ function getCppHome()
{
var sSuggestedHome = WshSysEnv("OO_SDK_CPP_HOME");
if (sSuggestedHome.length == 0)
- {
+ {
var sVC="";
try {
sVC = WshShell.RegRead(regKeyVCExpress90);
@@ -516,11 +516,11 @@ function getCppHome()
try {
sVC = WshShell.RegRead(regKeyVC90);
}catch (exc) {}
- }
+ }
// check Windows SDK if VC 9
if (sVC.length > 0)
{
- oo_sdk_manifest_used="true";
+ oo_sdk_manifest_used="true";
try {
oo_sdk_windowssdk =
WshShell.RegRead(regKeyWindowsSDK);
}catch (exc) {}
@@ -532,7 +532,7 @@ function getCppHome()
}catch (exc) {}
if (sVC.length > 0)
oo_sdk_manifest_used="true";
- }
+ }
if (sVC.length == 0)
{
try {
@@ -540,22 +540,22 @@ function getCppHome()
}catch (exc) {}
if (sVC.length > 0)
oo_sdk_manifest_used="true";
- }
+ }
if (sVC.length == 0)
{
try {
sVC = WshShell.RegRead(regKeyVC71);
}catch (exc) {}
- }
+ }
if (sVC.length > 0)
{
sVC += "bin";
if (aFileSystemObject.FileExists(sVC + "\\cl.exe"))
- sSuggestedHome = sVC;
+ sSuggestedHome = sVC;
}
}
- var bSkip = false;
+ var bSkip = false;
while(true)
{
stdout.Write("\n Enter the directory of the C++ compiler (optional) ["
+
@@ -575,7 +575,7 @@ function getCppHome()
bSkip = true;
}
}
-
+
sHome = sSuggestedHome;
} else
{
@@ -592,21 +592,21 @@ function getCppHome()
//Check if the C++ compiler exist
var cl = sHome + "\\cl.exe";
var mt = sHome + "\\mt.exe";
-
+
if (! aFileSystemObject.FileExists(cl))
{
- stdout.WriteLine("\n Error: Could not find the
C++ compiler \""
+ stdout.WriteLine("\n Error: Could not find the
C++ compiler \""
+ cl + "\".");
sHome = "";
bSkip = true;
} else {
if (aFileSystemObject.FileExists(mt)) {
- oo_sdk_vc8_used="true";
+ oo_sdk_vc8_used="true";
}
}
}
- if ( bSkip ) {
+ if ( bSkip ) {
if ( skipChoice("the C++ compiler") ) {
return "";
} else {
@@ -616,13 +616,13 @@ function getCppHome()
}
return sHome;
- }
+ }
}
function getCliHome()
{
var sSuggestedHome = WshSysEnv("OO_SDK_CLI_HOME");
-
+
if (sSuggestedHome.length == 0)
{
try {
@@ -635,7 +635,7 @@ function getCliHome()
sSuggestedHome = "";
}
- if (sSuggestedHome.length == 0)
+ if (sSuggestedHome.length == 0)
{
_ver = WshShell.RegRead(regKeyDotNet1_1);
if (_ver.length > 0)
@@ -645,11 +645,11 @@ function getCliHome()
if ( !
aFileSystemObject.FolderExists(sSuggestedHome))
sSuggestedHome = "";
}
- }
+ }
} catch (exc) {}
}
-
- var bSkip = false;
+
+ var bSkip = false;
while(true)
{
stdout.Write("\n Enter the directory of the C# and VB.NET compilers
(optional) [" + sSuggestedHome + "]:");
@@ -662,11 +662,11 @@ function getCliHome()
} else {
if (
!aFileSystemObject.FolderExists(sSuggestedHome) )
{
- stdout.WriteLine("\n Error: Could not
find directory \"" +
+ stdout.WriteLine("\n Error: Could not
find directory \"" +
sSuggestedHome + "\".");
sSuggestedHome = "";
bSkip = true;
- }
+ }
}
sHome = sSuggestedHome;
@@ -676,7 +676,7 @@ function getCliHome()
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist.");
bSkip = true;
}
@@ -686,10 +686,10 @@ function getCliHome()
//Check if the C# and VB.NET compiler exist
var csc = sHome + "\\csc.exe";
var vbc = sHome + "\\vbc.exe";
-
- if (! aFileSystemObject.FileExists(csc))
+
+ if (! aFileSystemObject.FileExists(csc))
{
- stdout.WriteLine("\n Error: Could not find the
C# compiler \"" +
+ stdout.WriteLine("\n Error: Could not find the
C# compiler \"" +
csc + "\".");
bSkip = true;
}
@@ -701,7 +701,7 @@ function getCliHome()
}
}
- if ( bSkip ) {
+ if ( bSkip ) {
if ( skipChoice("the C# and VB.NET compilers") ) {
return "";
} else {
@@ -711,7 +711,7 @@ function getCliHome()
}
return sHome;
- }
+ }
}
function getJavaHome()
@@ -723,15 +723,15 @@ function getJavaHome()
var currentVersion = WshShell.RegRead(regKeyJDK +
"CurrentVersion");
if (currentVersion.length > 0)
{
- sSuggestedHome = WshShell.RegRead(regKeyJDK + currentVersion +
-
"\\JavaHome");
+ sSuggestedHome = WshShell.RegRead(regKeyJDK + currentVersion +
+
"\\JavaHome");
if ( ! aFileSystemObject.FolderExists(sSuggestedHome) )
sSuggestedHome = "";
}
} catch (exc) {}
}
-
- var bSkip = false;
+
+ var bSkip = false;
while(true)
{
stdout.Write("\n Enter JAVA SDK (1.4.1_01 or higher) installation
directory (optional) [" + sSuggestedHome + "]:");
@@ -744,20 +744,20 @@ function getJavaHome()
} else {
if (
!aFileSystemObject.FolderExists(sSuggestedHome) )
{
- stdout.WriteLine("\n Error: Could not
find directory \"" +
+ stdout.WriteLine("\n Error: Could not
find directory \"" +
sSuggestedHome + "\".");
sSuggestedHome = "";
bSkip=true;
}
- }
-
+ }
+
sHome = sSuggestedHome;
} else
{
//validate the user input
if ( ! aFileSystemObject.FolderExists(sHome))
{
- stdout.WriteLine("\n Error: The directory \"" + sHome +
+ stdout.WriteLine("\n Error: The directory \"" + sHome +
"\" does not exist.");
bSkip = true;
}
@@ -774,7 +774,7 @@ function getJavaHome()
}
}
- if ( bSkip ) {
+ if ( bSkip ) {
if ( skipChoice("the Java SDK") ) {
return "";
} else {
@@ -784,7 +784,7 @@ function getJavaHome()
}
return sHome;
- }
+ }
}
function getOutputDir()
@@ -794,14 +794,14 @@ function getOutputDir()
if (sSuggestedDir.length == 0)
sSuggestedDir = defaultdir;
- var bSkip = false;
+ var bSkip = false;
while(true)
{
stdout.Write(
"\n Default output directory is the \"c:\\" +
oo_sdk_name + "\".\n" +
" Enter an existent directory if you prefer a different one. But
note" +
" that only\n a path without spaces is allowed because
of a" +
- " limitation of gnu make. (optional) [" + sSuggestedDir
+ "]:");
+ " limitation of gnu make. (optional) [" + sSuggestedDir
+ "]:");
var sDir = stdin.ReadLine();
if (sDir.length == 0)
{
@@ -813,7 +813,7 @@ function getOutputDir()
var fso = new
ActiveXObject("Scripting.FileSystemObject");
if ( !fso.FolderExists(sSuggestedDir) )
fso.CreateFolder(sSuggestedDir);
- }
+ }
if ( !aFileSystemObject.FolderExists(sSuggestedDir)
)
{
stdout.WriteLine("\n Error: Could not
find directory \"" +
@@ -822,14 +822,14 @@ function getOutputDir()
bSkip = true;
}
}
-
+
sDir = sSuggestedDir;
}
else
{
if (sDir.indexOf(' ') != -1) {
stdout.WriteLine("\n Error: your specified
output directory " +
- "\"" + sDir +
"\" " +
+ "\"" + sDir +
"\" " +
"contains one
or more spaces.\n That " +
"causes
problems with gnu make. Please specify" +
" a directory
without spaces.");
@@ -844,7 +844,7 @@ function getOutputDir()
}
}
- if ( bSkip ) {
+ if ( bSkip ) {
if ( skipChoice("a special output directory") ) {
return "";
} else {
@@ -852,9 +852,9 @@ function getOutputDir()
continue;
}
}
-
+
return sDir;
- }
+ }
}
function getAutoDeployment()
@@ -862,11 +862,11 @@ function getAutoDeployment()
var sSuggestedAuto = WshSysEnv("SDK_AUTO_DEPLOYMENT");
if (sSuggestedAuto.length == 0)
sSuggestedAuto = "YES";
-
+
while(true)
{
stdout.Write("\n Automatic deployment of UNO components (YES/NO) ["+
- sSuggestedAuto + "]:");
+ sSuggestedAuto + "]:");
var sAuto = stdin.ReadLine();
if (sAuto.length == 0)
sAuto = sSuggestedAuto;
@@ -882,7 +882,7 @@ function getAutoDeployment()
sAuto = sAutoU;
}
return sAuto;
- }
+ }
}
//The function uses sp2bv.exe to obtain a file URL from a
@@ -934,12 +934,12 @@ function writeBatFile(fdir, file)
"@set \"OFFICE_HOME=" + office_home +
"\"\n\n" +
"REM Directory of the make command.\n" +
- "REM Example: @set
\"OO_SDK_MAKE_HOME=C:\\UnxUtils\\usr\\local\\wbin\"\n" +
- "@set \"OO_SDK_MAKE_HOME=" + oo_sdk_make_home +
+ "REM Example: @set
\"OO_SDK_MAKE_HOME=C:\\UnxUtils\\usr\\local\\wbin\"\n" +
+ "@set \"OO_SDK_MAKE_HOME=" + oo_sdk_make_home +
"\"\n\n" +
"REM Directory of the zip tool.\n" +
"REM Example: @set
\"OO_SDK_ZIP_HOME=C:\\UnxUtils\\usr\\local\\wbin\"\n" +
- "@set \"OO_SDK_ZIP_HOME=" + oo_sdk_zip_home +
+ "@set \"OO_SDK_ZIP_HOME=" + oo_sdk_zip_home +
"\"\n\n" +
"REM Directory of the cat tool.\n" +
"REM Example: @set
\"OO_SDK_CAT_HOME=C:\\UnxUtils\\usr\\local\\wbin\"\n" +
@@ -949,25 +949,25 @@ function writeBatFile(fdir, file)
"REM Example: @set
\"OO_SDK_SED_HOME=C:\\UnxUtils\\usr\\local\\wbin\"\n" +
"@set \"OO_SDK_SED_HOME=" + oo_sdk_sed_home +
"\"\n\n" +
- "REM Directory of the C++ compiler.\n" +
- "REM Example: @set \"OO_SDK_CPP_HOME=C:\\Program Files\\Microsoft
Visual Studio 9.0\\VC\\bin\"\n" +
- "@set \"OO_SDK_CPP_HOME=" + oo_sdk_cpp_home +
+ "REM Directory of the C++ compiler.\n" +
+ "REM Example: @set \"OO_SDK_CPP_HOME=C:\\Program Files\\Microsoft
Visual Studio 9.0\\VC\\bin\"\n" +
+ "@set \"OO_SDK_CPP_HOME=" + oo_sdk_cpp_home +
"\"\n@set \"CPP_MANIFEST=" + oo_sdk_manifest_used +
"\"\n@set \"CPP_WINDOWS_SDK=" + oo_sdk_windowssdk +
- "\"\n\n" +
- "REM Directory of the C# and VB.NET compilers.\n" +
+ "\"\n\n" +
+ "REM Directory of the C# and VB.NET compilers.\n" +
"REM Example: @set
\"OO_SDK_CLI_HOME=C:\\WINXP\\Microsoft.NET\\Framework\\v1.0.3705\"\n" +
- "@set \"OO_SDK_CLI_HOME=" + oo_sdk_cli_home +
+ "@set \"OO_SDK_CLI_HOME=" + oo_sdk_cli_home +
+ "\"\n\n" +
+ "REM Java SDK installation directory.\n" +
+ "REM Example: @set \"OO_SDK_JAVA_HOME=C:\\Program
Files\\Java\\jdk1.6.0_05\"\n" +
+ "@set \"OO_SDK_JAVA_HOME=" + oo_sdk_java_home +
"\"\n\n" +
- "REM Java SDK installation directory.\n" +
- "REM Example: @set \"OO_SDK_JAVA_HOME=C:\\Program
Files\\Java\\jdk1.6.0_05\"\n" +
- "@set \"OO_SDK_JAVA_HOME=" + oo_sdk_java_home +
- "\"\n\n" +
- "REM Special output directory\n" +
+ "REM Special output directory\n" +
"REM Example: @set \"OO_SDK_OUT=C:\\" + oo_sdk_name + "\"\n" +
- "@set \"OO_SDK_OUT=" + oo_sdk_out +
+ "@set \"OO_SDK_OUT=" + oo_sdk_out +
"\"\n\n" +
- "REM Automatic deployment\n" +
+ "REM Automatic deployment\n" +
"REM Example: @set \"SDK_AUTO_DEPLOYMENT=YES\"\n" +
"@set \"SDK_AUTO_DEPLOYMENT=" + sdk_auto_deployment +
"\"\n\n" +
@@ -975,17 +975,17 @@ function writeBatFile(fdir, file)
"if not defined OO_SDK_HOME (\n" +
" echo Error: the variable OO_SDK_HOME is missing!\n" +
" goto :error\n" +
- " )\n" +
+ " )\n" +
"\n\n" +
- "REM Check installation path for GNU make.\n" +
- "if not defined OO_SDK_MAKE_HOME (\n" +
+ "REM Check installation path for GNU make.\n" +
+ "if not defined OO_SDK_MAKE_HOME (\n" +
" echo Error: the variable OO_SDK_MAKE_HOME is missing!\n" +
" goto :error\n" +
- " )\n" +
+ " )\n" +
"\n" +
- "REM Check installation path for the zip tool.\n" +
+ "REM Check installation path for the zip tool.\n" +
"if not defined OO_SDK_ZIP_HOME (\n" +
- " echo Error: the variable OO_SDK_ZIP_HOME is missing!\n" +
+ " echo Error: the variable OO_SDK_ZIP_HOME is missing!\n" +
" goto :error\n" +
" )\n" +
"\n" +
@@ -1001,7 +1001,7 @@ function writeBatFile(fdir, file)
" goto :error\n" +
" )\n" +
"\n" +
- "REM Set library path. \n" +
+ "REM Set library path. \n" +
"@set \"LIB=%OO_SDK_HOME%\\lib;%LIB%\"\n" +
"if defined CPP_WINDOWS_SDK (\n" +
" @set \"LIB=%LIB%;%CPP_WINDOWS_SDK%\\lib\"\n" +
@@ -1030,34 +1030,34 @@ function writeBatFile(fdir, file)
"set
\"PATH=%OO_SDK_HOME%\\bin;%OO_SDK_OFFICE_BIN_DIR%;%OO_SDK_OFFICE_BIN_DIR%;%OO_SDK_HOME%\\WINexample.out\\bin;%OO_SDK_MAKE_HOME%;%OO_SDK_ZIP_HOME%;%OO_SDK_CAT_HOME%;%OO_SDK_SED_HOME%;%PATH%\"\n"
+
"\n" +
"REM Set PATH appropriate to the output directory\n" +
- "if defined OO_SDK_OUT (\n" +
- " @set \"PATH=%OO_SDK_OUT%\\WINexample.out\\bin;%PATH%\"\n" +
- " ) else (\n" +
- " @set \"PATH=%OO_SDK_HOME%\\WINexample.out\\bin;%PATH%\"\n" +
- " )\n" +
+ "if defined OO_SDK_OUT (\n" +
+ " @set \"PATH=%OO_SDK_OUT%\\WINexample.out\\bin;%PATH%\"\n" +
+ " ) else (\n" +
+ " @set \"PATH=%OO_SDK_HOME%\\WINexample.out\\bin;%PATH%\"\n" +
+ " )\n" +
"\n" +
"REM Add directory of the Win SDK to the path, if necessary.\n" +
"if defined CPP_WINDOWS_SDK (\n" +
- " @set \"PATH=%CPP_WINDOWS_SDK\\bin%;%PATH%\"\n" +
- " @set \"INCLUDE=%CPP_WINDOWS_SDK\\Include%;%INCLUDE%\"\n" +
+ " @set \"PATH=%CPP_WINDOWS_SDK\\bin%;%PATH%\"\n" +
+ " @set \"INCLUDE=%CPP_WINDOWS_SDK\\Include%;%INCLUDE%\"\n" +
")\n" +
- "REM Add directory of the C# and VB.NET compilers to the path, if
necessary.\n" +
- "if defined OO_SDK_CLI_HOME @set \"PATH=%OO_SDK_CLI_HOME%;%PATH%\"\n"
+
- "\n" +
- "REM Add directory of the Java tools to the path, if necessary.\n" +
+ "REM Add directory of the C# and VB.NET compilers to the path, if
necessary.\n" +
+ "if defined OO_SDK_CLI_HOME @set \"PATH=%OO_SDK_CLI_HOME%;%PATH%\"\n" +
+ "\n" +
+ "REM Add directory of the Java tools to the path, if necessary.\n" +
"if defined OO_SDK_JAVA_HOME @set
\"PATH=%OO_SDK_JAVA_HOME%\\bin;%OO_SDK_JAVA_HOME%\\jre\\bin;%PATH%\"\n" +
"\n" +
- "REM Set environment for C++ compiler tools, if necessary.\n" +
+ "REM Set environment for C++ compiler tools, if necessary.\n" +
"if defined OO_SDK_CPP_HOME call
\"%OO_SDK_CPP_HOME%\\VCVARS32.bat\"\n" +
"\n" +
- "REM Set tilte to identify the prepared shell.\n" +
- "title Shell prepared for SDK\n" +
+ "REM Set tilte to identify the prepared shell.\n" +
+ "title Shell prepared for SDK\n" +
"\nREM Prepare shell with all necessary environment variables.\n" +
"echo.\n" +
"echo
******************************************************************\n" +
- "echo *\n" +
+ "echo *\n" +
"echo * SDK environment is prepared for Windows\n" +
- "echo *\n" +
+ "echo *\n" +
"echo * SDK = %OO_SDK_HOME%\n" +
"echo * Office = %OFFICE_HOME%\n" +
"echo * Make = %OO_SDK_MAKE_HOME%\n" +
@@ -1072,12 +1072,12 @@ function writeBatFile(fdir, file)
"echo *\n" +
"echo
******************************************************************\n" +
"echo.\n" +
- "goto end\n" +
+ "goto end\n" +
"\n" +
" :error\n" +
- "Error: Please insert the necessary environment variables into the
batch file.\n" +
- "\n" +
- " :end\n"
+ "Error: Please insert the necessary environment variables into the
batch file.\n" +
+ "\n" +
+ " :end\n"
);
- newFile.Close();
+ newFile.Close();
}
diff --git
a/main/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/code.js
b/main/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/code.js
index 2d76991276..9231af50aa 100644
---
a/main/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/code.js
+++
b/main/ooxml/source/framework/SchemaParser/src/org/apache/openoffice/ooxml/schema/generator/html/code.js
@@ -1,454 +1,454 @@
-// Licensed under the Apache License, Version 2.0 (the "License"); you may not
-// use this file except in compliance with the License. You may obtain a copy
of
-// the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-// License for the specific language governing permissions and limitations
under
-// the License.
-
-function LoadData ()
-{
- gTypeNames = [];
- ComplexTypeNames = [];
- SimpleTypeNames = [];
- for (var sName in Data)
- {
- gTypeNames.push(sName);
- switch(Data[sName].type)
- {
- case "complex-type":
- ComplexTypeNames.push(sName);
- break;
-
- case "simple-type":
- SimpleTypeNames.push(sName);
- break;
- }
- }
- document.getElementById("message").innerHTML = "there are " +
ComplexTypeNames.length + " complex types and "
- + SimpleTypeNames.length +" simple types";
-}
-
-
-
-
-function InitializeSearch ()
-{
- CurrentTypeName = "";
- TypeHistory = Array();
- LoadData();
- ShowType("A:ST_Overlap");
-}
-
-
-
-
-function CheckInput (aField, aEvent)
-{
- switch(aEvent.keyCode)
- {
- case 38:
- --selection_index;
- if (selection_index < 0)
- selection_index = matches.length-1;
- break;
- case 40:
- ++selection_index;
- if (selection_index >= matches.length)
- selection_index = 0;
- break;
- default:
- matches = GetMatches(aField.value);
- selection_index = 0;
- }
-
- ShowMatches(matches, selection_index);
-}
-
-
-
-
-function GetMatches (sPattern)
-{
- var aLcPatterns = sPattern.toLowerCase().split(/\s+/);
-
- var nTypeCount = gTypeNames.length;
-
- var aMatches = [];
- for (index=0; index<nTypeCount; ++index)
- {
- var sTypeName = gTypeNames[index];
- var aParts = new Array(sTypeName);
- var sLcTypeName = sTypeName.toLowerCase();
- var bIsMatch = true;
- var nSearchStart = 0;
- for (nPatternIndex=0; nPatternIndex<aLcPatterns.length && bIsMatch;
++nPatternIndex)
- {
- var sPattern = aLcPatterns[nPatternIndex];
- var nMatchStart = sLcTypeName.indexOf(sPattern, nSearchStart);
- if (nMatchStart >= 0)
- {
- var nMatchEnd = nMatchStart + sPattern.length;
- aParts.push(sTypeName.substring(nSearchStart, nMatchStart));
- aParts.push(sTypeName.substring(nMatchStart, nMatchEnd));
- nSearchStart = nMatchEnd;
- }
- else
- {
- // Only some patterns are matched.
- bIsMatch = false;
- }
- }
- if (bIsMatch)
- {
- if (nMatchEnd < sTypeName.length-1)
- aParts.push(sTypeName.substring(nMatchEnd));
- aMatches.push(aParts);
- }
- }
- return aMatches;
-}
-
-
-
-
-/** Show the matching types.
- * As there can be a great many matching types, some sort of abbreviation is
necessary.
- * Format all matches into lines of n entries.
- * Show the line containing the selected match and the ones before and after.
- * Show also the number of omitted matches.
- */
-function ShowMatches (aMatches, nSelectionIndex)
-{
- var sText = "";
-
- var nHalfRange = 10;
- var nMatchesPerLine = 5;
- var nLineCount = Math.floor((aMatches.length+nMatchesPerLine-1) /
nMatchesPerLine);
- var nLineOfSelection = Math.floor(nSelectionIndex / nMatchesPerLine);
- var nFirstDisplayedLine = nLineOfSelection>0 ? nLineOfSelection-1 : 0;
- var nLastDisplayedLine = nLineOfSelection<nLineCount-1 ?
nLineOfSelection+1 : nLineCount-1;
-
- for (nLineIndex=nFirstDisplayedLine; nLineIndex<=nLastDisplayedLine;
++nLineIndex)
- {
- var nLineStartIndex = nLineIndex * nMatchesPerLine;
- var nLineEndIndex = nLineStartIndex + nMatchesPerLine - 1;
- if (nLineEndIndex >= aMatches.length)
- nLineEndIndex = aMatches.length-1;
-
- sText += "<tr>"
- for (nIndex=nLineStartIndex; nIndex<=nLineEndIndex; ++nIndex)
- {
- var aMatch = aMatches[nIndex];
- var sTypeName = aMatch[0];
- var sMatch = "";
- for (nPartIndex=1; nPartIndex<aMatch.length; ++nPartIndex)
- {
- if ((nPartIndex%2)==0)
- sMatch += "<span
class=\"match-highlight\">"+aMatch[nPartIndex]+"</span>";
- else
- sMatch += aMatch[nPartIndex];
- }
- sText += "<td>"
- if (nIndex == nSelectionIndex)
- {
- sText += " <span class=\"typelink current-match\">" + sMatch +
"</span>";
- }
- else
- {
- sText += " " + GetTypeLink(sMatch, sTypeName, -1);
- }
- sText += "</td>"
- }
-
- sText += "</tr>";
- }
- if (nFirstDisplayedLine > 0)
- sText = "<tr><td>["+(nFirstDisplayedLine*nMatchesPerLine)+" matches]
...</td><tr>" + sText;
- if (nLastDisplayedLine+1 < nLineCount)
- sText += "<tr><td>...
["+((nLineCount-nLastDisplayedLine-1)*nMatchesPerLine)+" matches]</td></tr>";
-
- document.getElementById('matches').innerHTML = "<table>"+sText+"</table>";
- if (aMatches.length == 0)
- {
- document.getElementById('match-count').innerHTML = "no match:";
- }
- else
- {
- if (aMatches.length == 1)
- document.getElementById('match-count').innerHTML = "single match:";
- else
- document.getElementById('match-count').innerHTML =
aMatches.length+" matches:";
-
- ShowType(aMatches[nSelectionIndex][0]);
- }
-}
-
-
-
-
-function GetTopLevelNodeForTypeName(sTypeName)
-{
- if (sTypeName in Data)
- return Data[sTypeName];
- else
- alert(sTypeName +" is not a known complex type, simple type, or group");
-}
-
-
-
-
-/** Show the specified type.
- * When nHistoryIndex is not -1 then the history is shortened to that (before
that) index.
- */
-function ShowType (sTypeName, nHistoryIndex)
-{
- if (nHistoryIndex == -1)
- {
- if (CurrentTypeName != "")
- {
- TypeHistory.push(CurrentTypeName);
- ShowHistory();
- }
- }
- else
- {
- TypeHistory = TypeHistory.slice(0,nHistoryIndex);
- ShowHistory();
- }
- CurrentTypeName = sTypeName;
-
- var aElement = document.getElementById('result');
-
- // Remove the old content.
- while(aElement.childNodes.length > 0)
- aElement.removeChild(aElement.firstChild);
-
- // Create the new content.
- var list = CreateDomTreeForType(GetTopLevelNodeForTypeName(sTypeName),
"ul");
-
- // Show the new content.
- aElement.appendChild(list);
-}
-
-
-
-
-/** Create a dom sub tree for the given OOXML type that is ready for insertion
into the global DOM tree.
- */
-function CreateDomTreeForType (aNode, sType)
-{
- var aEntry = document.createElement(sType);
-
- if (typeof aNode==='undefined')
- {
- aEntry.innerHTML = "undefined node";
- }
- else if (typeof aNode.type==='undefined')
- {
- aEntry.innerHTML = "unknown type";
- }
- else
- {
- switch(aNode.type)
- {
- case "attribute":
- aEntry.innerHTML = CreateValueTable([
- "attribute",
- "type:",
GetTypeLink(aNode["value-type"], aNode["value-type"], -1),
- "use:", aNode.use]);
- break;
-
- case "attribute-reference":
- aEntry.innerHTML =
CreateReference(aNode["referenced-attribute"]);
- break;
-
- case "builtin":
- aEntry.innerHTML = CreateValueTable(
- ["builtin",
- "name:", aNode['builtin-type']
- ]);
- break;
-
- case "complex-type":
- aEntry.innerHTML = aNode.type + " " + aNode.name;
- break;
-
- case "complex-type-reference":
- aEntry.innerHTML =
CreateReference(aNode["referenced-complex-type"]);
- break;
-
- case "group":
- aEntry.innerHTML = aNode.type + " " + aNode.name;
- break;
-
- case "group-reference":
- aEntry.innerHTML = CreateReference("group",
aNode["referenced-group"]);
- break;
-
- case "element":
- aEntry.innerHTML = "element <b>" + aNode["tag"] + "</b>
-> " + GetTypeLink(aNode["result-type"], aNode["result-type"], -1);
- break;
-
- case "occurrence":
- aEntry.innerHTML = aNode.minimum +" -> " + aNode.maximum;
- break;
-
- case "restriction":
- aEntry.innerHTML = CreateRestrictionRepresentation(aNode);
- break;
-
- case "sequence":
- aEntry.innerHTML = "sequence";
- break;
-
- case "simple-type":
- aEntry.innerHTML = aNode.type + " " + aNode.name;
- break;
-
- case "simple-type-reference":
- aEntry.innerHTML = CreateReference("simple-type",
aNode["referenced-simple-type"]);
- break;
-
- default:
- aEntry.innerHTML = aNode.type;
- break;
- }
-
- // Add nodes for attributes.
- var aAttributes= aNode["attributes"];
- if ( ! (typeof aAttributes==='undefined' || aAttributes.length ==
0))
- {
- var aAttributeList = document.createElement("ul");
- aEntry.appendChild(aAttributeList);
-
- for (var nIndex=0; nIndex<aAttributes.length; ++nIndex)
- {
- var aAttributeEntry =
CreateDomTreeForType(aAttributes[nIndex], "li");
- aAttributeList.appendChild(aAttributeEntry);
- }
- }
-
- // Add nodes for children.
- var aChildren = aNode["children"];
- if ( ! (typeof aChildren==='undefined' || aChildren.length == 0))
- {
- var aChildrenList = document.createElement("ul");
- aEntry.appendChild(aChildrenList);
-
- for (var nIndex=0; nIndex<aChildren.length; ++nIndex)
- {
- var aChildrenEntry =
CreateDomTreeForType(aChildren[nIndex], "li");
- aChildrenList.appendChild(aChildrenEntry);
- }
- }
- }
- return aEntry;
-}
-
-
-
-
-function GetTypeLink (sText, sTarget, nIndex)
-{
- return "<span class=\"typelink\" id=\""+sTarget+"\"
onclick=\"ShowType('"+sTarget+"',"+nIndex+")\">"+sText+"</span>";
-}
-
-
-
-
-function CreateValueTable (aValues)
-{
- var sResult = "<table
class=\"value-table\"><tr><td>"+aValues[0]+"</td><td>"+aValues[1]+"</td><td>"+aValues[2]+"</td></tr>";
- for (nIndex=3; nIndex<aValues.length; nIndex+=2)
- {
- sResult +=
"<tr><td></td><td>"+aValues[nIndex]+"</td><td>"+aValues[nIndex+1]+"</td></tr>";
- }
- sResult += "</table>";
- return sResult;
-}
-
-
-
-
-function CreateReference (sWhat, sTypeName)
-{
- return "reference to "+sWhat+" "+GetTypeLink(sTypeName, sTypeName, -1) + "
"
- +CreateButton(
- sTypeName,
- "show",
- "ToggleTypeReferenceExpansion('"+sTypeName+"')")
- +"<br><span id=\"expansion-"+sTypeName+"\"></span>";
-}
-
-
-
-
-function CreateButton (sId, sText, sExpandAction)
-{
- return "<span class=\"button\" id=\"button-"+sId+"\"
onClick=\""+sExpandAction+"\">"+sText+"</span>";
-}
-
-
-
-
-function ToggleTypeReferenceExpansion(sTypeName)
-{
- var aButton = document.getElementById("button-"+sTypeName);
- var aExpansion = document.getElementById("expansion-"+sTypeName);
- if (aButton.innerHTML == "show")
- {
- aExpansion.appendChild(CreateDomTreeForType(Data[sTypeName], "span"));
- aButton.innerHTML = "hide";
- }
- else
- {
- aExpansion.innerHTML = "";
- aButton.innerHTML = "show";
- }
-}
-
-
-
-
-function ShowHistory ()
-{
- var aElement = document.getElementById('history');
- var sContent = "History:";
- for (nIndex=0; nIndex<TypeHistory.length; ++nIndex)
- {
- if (nIndex == 0)
- sContent += " ";
- else
- sContent += ", ";
- sContent += GetTypeLink(TypeHistory[nIndex],
TypeHistory[nIndex], nIndex);
- }
- aElement.innerHTML = sContent;
-}
-
-
-
-
-function CreateRestrictionRepresentation (aNode)
-{
- var aTableData = ["restriction", "based on:",
GetTypeLink(aNode['base-type'], aNode['base-type'], -1)];
- AddValue(aNode, "enumeration", aTableData);
- AddValue(aNode, "pattern", aTableData);
- AddValue(aNode, "length", aTableData);
- return CreateValueTable(aTableData);
-}
-
-
-
-function AddValue (aMap, sKey, aTableData)
-{
- if (sKey in aMap)
- {
- aTableData.push(sKey+":");
- aTableData.push(aMap[sKey]);
- }
-}
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy
of
+// the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations
under
+// the License.
+
+function LoadData ()
+{
+ gTypeNames = [];
+ ComplexTypeNames = [];
+ SimpleTypeNames = [];
+ for (var sName in Data)
+ {
+ gTypeNames.push(sName);
+ switch(Data[sName].type)
+ {
+ case "complex-type":
+ ComplexTypeNames.push(sName);
+ break;
+
+ case "simple-type":
+ SimpleTypeNames.push(sName);
+ break;
+ }
+ }
+ document.getElementById("message").innerHTML = "there are " +
ComplexTypeNames.length + " complex types and "
+ + SimpleTypeNames.length +" simple types";
+}
+
+
+
+
+function InitializeSearch ()
+{
+ CurrentTypeName = "";
+ TypeHistory = Array();
+ LoadData();
+ ShowType("A:ST_Overlap");
+}
+
+
+
+
+function CheckInput (aField, aEvent)
+{
+ switch(aEvent.keyCode)
+ {
+ case 38:
+ --selection_index;
+ if (selection_index < 0)
+ selection_index = matches.length-1;
+ break;
+ case 40:
+ ++selection_index;
+ if (selection_index >= matches.length)
+ selection_index = 0;
+ break;
+ default:
+ matches = GetMatches(aField.value);
+ selection_index = 0;
+ }
+
+ ShowMatches(matches, selection_index);
+}
+
+
+
+
+function GetMatches (sPattern)
+{
+ var aLcPatterns = sPattern.toLowerCase().split(/\s+/);
+
+ var nTypeCount = gTypeNames.length;
+
+ var aMatches = [];
+ for (index=0; index<nTypeCount; ++index)
+ {
+ var sTypeName = gTypeNames[index];
+ var aParts = new Array(sTypeName);
+ var sLcTypeName = sTypeName.toLowerCase();
+ var bIsMatch = true;
+ var nSearchStart = 0;
+ for (nPatternIndex=0; nPatternIndex<aLcPatterns.length && bIsMatch;
++nPatternIndex)
+ {
+ var sPattern = aLcPatterns[nPatternIndex];
+ var nMatchStart = sLcTypeName.indexOf(sPattern, nSearchStart);
+ if (nMatchStart >= 0)
+ {
+ var nMatchEnd = nMatchStart + sPattern.length;
+ aParts.push(sTypeName.substring(nSearchStart, nMatchStart));
+ aParts.push(sTypeName.substring(nMatchStart, nMatchEnd));
+ nSearchStart = nMatchEnd;
+ }
+ else
+ {
+ // Only some patterns are matched.
+ bIsMatch = false;
+ }
+ }
+ if (bIsMatch)
+ {
+ if (nMatchEnd < sTypeName.length-1)
+ aParts.push(sTypeName.substring(nMatchEnd));
+ aMatches.push(aParts);
+ }
+ }
+ return aMatches;
+}
+
+
+
+
+/** Show the matching types.
+ * As there can be a great many matching types, some sort of abbreviation is
necessary.
+ * Format all matches into lines of n entries.
+ * Show the line containing the selected match and the ones before and after.
+ * Show also the number of omitted matches.
+ */
+function ShowMatches (aMatches, nSelectionIndex)
+{
+ var sText = "";
+
+ var nHalfRange = 10;
+ var nMatchesPerLine = 5;
+ var nLineCount = Math.floor((aMatches.length+nMatchesPerLine-1) /
nMatchesPerLine);
+ var nLineOfSelection = Math.floor(nSelectionIndex / nMatchesPerLine);
+ var nFirstDisplayedLine = nLineOfSelection>0 ? nLineOfSelection-1 : 0;
+ var nLastDisplayedLine = nLineOfSelection<nLineCount-1 ?
nLineOfSelection+1 : nLineCount-1;
+
+ for (nLineIndex=nFirstDisplayedLine; nLineIndex<=nLastDisplayedLine;
++nLineIndex)
+ {
+ var nLineStartIndex = nLineIndex * nMatchesPerLine;
+ var nLineEndIndex = nLineStartIndex + nMatchesPerLine - 1;
+ if (nLineEndIndex >= aMatches.length)
+ nLineEndIndex = aMatches.length-1;
+
+ sText += "<tr>"
+ for (nIndex=nLineStartIndex; nIndex<=nLineEndIndex; ++nIndex)
+ {
+ var aMatch = aMatches[nIndex];
+ var sTypeName = aMatch[0];
+ var sMatch = "";
+ for (nPartIndex=1; nPartIndex<aMatch.length; ++nPartIndex)
+ {
+ if ((nPartIndex%2)==0)
+ sMatch += "<span
class=\"match-highlight\">"+aMatch[nPartIndex]+"</span>";
+ else
+ sMatch += aMatch[nPartIndex];
+ }
+ sText += "<td>"
+ if (nIndex == nSelectionIndex)
+ {
+ sText += " <span class=\"typelink current-match\">" + sMatch +
"</span>";
+ }
+ else
+ {
+ sText += " " + GetTypeLink(sMatch, sTypeName, -1);
+ }
+ sText += "</td>"
+ }
+
+ sText += "</tr>";
+ }
+ if (nFirstDisplayedLine > 0)
+ sText = "<tr><td>["+(nFirstDisplayedLine*nMatchesPerLine)+" matches]
...</td><tr>" + sText;
+ if (nLastDisplayedLine+1 < nLineCount)
+ sText += "<tr><td>...
["+((nLineCount-nLastDisplayedLine-1)*nMatchesPerLine)+" matches]</td></tr>";
+
+ document.getElementById('matches').innerHTML = "<table>"+sText+"</table>";
+ if (aMatches.length == 0)
+ {
+ document.getElementById('match-count').innerHTML = "no match:";
+ }
+ else
+ {
+ if (aMatches.length == 1)
+ document.getElementById('match-count').innerHTML = "single match:";
+ else
+ document.getElementById('match-count').innerHTML =
aMatches.length+" matches:";
+
+ ShowType(aMatches[nSelectionIndex][0]);
+ }
+}
+
+
+
+
+function GetTopLevelNodeForTypeName(sTypeName)
+{
+ if (sTypeName in Data)
+ return Data[sTypeName];
+ else
+ alert(sTypeName +" is not a known complex type, simple type, or group");
+}
+
+
+
+
+/** Show the specified type.
+ * When nHistoryIndex is not -1 then the history is shortened to that (before
that) index.
+ */
+function ShowType (sTypeName, nHistoryIndex)
+{
+ if (nHistoryIndex == -1)
+ {
+ if (CurrentTypeName != "")
+ {
+ TypeHistory.push(CurrentTypeName);
+ ShowHistory();
+ }
+ }
+ else
+ {
+ TypeHistory = TypeHistory.slice(0,nHistoryIndex);
+ ShowHistory();
+ }
+ CurrentTypeName = sTypeName;
+
+ var aElement = document.getElementById('result');
+
+ // Remove the old content.
+ while(aElement.childNodes.length > 0)
+ aElement.removeChild(aElement.firstChild);
+
+ // Create the new content.
+ var list = CreateDomTreeForType(GetTopLevelNodeForTypeName(sTypeName),
"ul");
+
+ // Show the new content.
+ aElement.appendChild(list);
+}
+
+
+
+
+/** Create a dom sub tree for the given OOXML type that is ready for insertion
into the global DOM tree.
+ */
+function CreateDomTreeForType (aNode, sType)
+{
+ var aEntry = document.createElement(sType);
+
+ if (typeof aNode==='undefined')
+ {
+ aEntry.innerHTML = "undefined node";
+ }
+ else if (typeof aNode.type==='undefined')
+ {
+ aEntry.innerHTML = "unknown type";
+ }
+ else
+ {
+ switch(aNode.type)
+ {
+ case "attribute":
+ aEntry.innerHTML = CreateValueTable([
+ "attribute",
+ "type:",
GetTypeLink(aNode["value-type"], aNode["value-type"], -1),
+ "use:", aNode.use]);
+ break;
+
+ case "attribute-reference":
+ aEntry.innerHTML =
CreateReference(aNode["referenced-attribute"]);
+ break;
+
+ case "builtin":
+ aEntry.innerHTML = CreateValueTable(
+ ["builtin",
+ "name:", aNode['builtin-type']
+ ]);
+ break;
+
+ case "complex-type":
+ aEntry.innerHTML = aNode.type + " " + aNode.name;
+ break;
+
+ case "complex-type-reference":
+ aEntry.innerHTML =
CreateReference(aNode["referenced-complex-type"]);
+ break;
+
+ case "group":
+ aEntry.innerHTML = aNode.type + " " + aNode.name;
+ break;
+
+ case "group-reference":
+ aEntry.innerHTML = CreateReference("group",
aNode["referenced-group"]);
+ break;
+
+ case "element":
+ aEntry.innerHTML = "element <b>" + aNode["tag"] + "</b>
-> " + GetTypeLink(aNode["result-type"], aNode["result-type"], -1);
+ break;
+
+ case "occurrence":
+ aEntry.innerHTML = aNode.minimum +" -> " + aNode.maximum;
+ break;
+
+ case "restriction":
+ aEntry.innerHTML = CreateRestrictionRepresentation(aNode);
+ break;
+
+ case "sequence":
+ aEntry.innerHTML = "sequence";
+ break;
+
+ case "simple-type":
+ aEntry.innerHTML = aNode.type + " " + aNode.name;
+ break;
+
+ case "simple-type-reference":
+ aEntry.innerHTML = CreateReference("simple-type",
aNode["referenced-simple-type"]);
+ break;
+
+ default:
+ aEntry.innerHTML = aNode.type;
+ break;
+ }
+
+ // Add nodes for attributes.
+ var aAttributes= aNode["attributes"];
+ if ( ! (typeof aAttributes==='undefined' || aAttributes.length ==
0))
+ {
+ var aAttributeList = document.createElement("ul");
+ aEntry.appendChild(aAttributeList);
+
+ for (var nIndex=0; nIndex<aAttributes.length; ++nIndex)
+ {
+ var aAttributeEntry =
CreateDomTreeForType(aAttributes[nIndex], "li");
+ aAttributeList.appendChild(aAttributeEntry);
+ }
+ }
+
+ // Add nodes for children.
+ var aChildren = aNode["children"];
+ if ( ! (typeof aChildren==='undefined' || aChildren.length == 0))
+ {
+ var aChildrenList = document.createElement("ul");
+ aEntry.appendChild(aChildrenList);
+
+ for (var nIndex=0; nIndex<aChildren.length; ++nIndex)
+ {
+ var aChildrenEntry =
CreateDomTreeForType(aChildren[nIndex], "li");
+ aChildrenList.appendChild(aChildrenEntry);
+ }
+ }
+ }
+ return aEntry;
+}
+
+
+
+
+function GetTypeLink (sText, sTarget, nIndex)
+{
+ return "<span class=\"typelink\" id=\""+sTarget+"\"
onclick=\"ShowType('"+sTarget+"',"+nIndex+")\">"+sText+"</span>";
+}
+
+
+
+
+function CreateValueTable (aValues)
+{
+ var sResult = "<table
class=\"value-table\"><tr><td>"+aValues[0]+"</td><td>"+aValues[1]+"</td><td>"+aValues[2]+"</td></tr>";
+ for (nIndex=3; nIndex<aValues.length; nIndex+=2)
+ {
+ sResult +=
"<tr><td></td><td>"+aValues[nIndex]+"</td><td>"+aValues[nIndex+1]+"</td></tr>";
+ }
+ sResult += "</table>";
+ return sResult;
+}
+
+
+
+
+function CreateReference (sWhat, sTypeName)
+{
+ return "reference to "+sWhat+" "+GetTypeLink(sTypeName, sTypeName, -1) + "
"
+ +CreateButton(
+ sTypeName,
+ "show",
+ "ToggleTypeReferenceExpansion('"+sTypeName+"')")
+ +"<br><span id=\"expansion-"+sTypeName+"\"></span>";
+}
+
+
+
+
+function CreateButton (sId, sText, sExpandAction)
+{
+ return "<span class=\"button\" id=\"button-"+sId+"\"
onClick=\""+sExpandAction+"\">"+sText+"</span>";
+}
+
+
+
+
+function ToggleTypeReferenceExpansion(sTypeName)
+{
+ var aButton = document.getElementById("button-"+sTypeName);
+ var aExpansion = document.getElementById("expansion-"+sTypeName);
+ if (aButton.innerHTML == "show")
+ {
+ aExpansion.appendChild(CreateDomTreeForType(Data[sTypeName], "span"));
+ aButton.innerHTML = "hide";
+ }
+ else
+ {
+ aExpansion.innerHTML = "";
+ aButton.innerHTML = "show";
+ }
+}
+
+
+
+
+function ShowHistory ()
+{
+ var aElement = document.getElementById('history');
+ var sContent = "History:";
+ for (nIndex=0; nIndex<TypeHistory.length; ++nIndex)
+ {
+ if (nIndex == 0)
+ sContent += " ";
+ else
+ sContent += ", ";
+ sContent += GetTypeLink(TypeHistory[nIndex],
TypeHistory[nIndex], nIndex);
+ }
+ aElement.innerHTML = sContent;
+}
+
+
+
+
+function CreateRestrictionRepresentation (aNode)
+{
+ var aTableData = ["restriction", "based on:",
GetTypeLink(aNode['base-type'], aNode['base-type'], -1)];
+ AddValue(aNode, "enumeration", aTableData);
+ AddValue(aNode, "pattern", aTableData);
+ AddValue(aNode, "length", aTableData);
+ return CreateValueTable(aTableData);
+}
+
+
+
+function AddValue (aMap, sKey, aTableData)
+{
+ if (sKey in aMap)
+ {
+ aTableData.push(sKey+":");
+ aTableData.push(aMap[sKey]);
+ }
+}
diff --git
a/main/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js
b/main/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js
index 698bfe8ba1..42332d9ede 100644
---
a/main/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js
+++
b/main/scripting/examples/javascript/ExportSheetsToHTML/exportsheetstohtml.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,21 +7,21 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
-// When this script is run on an existing, saved, spreadsheet,
+// When this script is run on an existing, saved, spreadsheet,
// eg. /home/testuser/myspreadsheet.sxc, the script will export
// each sheet to a separate HTML file,
-// eg. /home/testuser/myspreadsheet_sheet1.html,
+// eg. /home/testuser/myspreadsheet_sheet1.html,
// /home/testuser/myspreadsheet_sheet2.html etc
importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.com.sun.star.sheet.XSpreadsheetDocument);
@@ -42,15 +42,15 @@ oDoc = XSCRIPTCONTEXT.getDocument();
xSDoc = UnoRuntime.queryInterface(XSpreadsheetDocument, oDoc);
//get the XModel interface from the document
xModel = UnoRuntime.queryInterface(XModel,oDoc);
-//get the XIndexAccess interface used to access each sheet
+//get the XIndexAccess interface used to access each sheet
xSheetsIndexAccess = UnoRuntime.queryInterface(XIndexAccess,
xSDoc.getSheets());
//get the XStorable interface used to save the document
xStorable = UnoRuntime.queryInterface(XStorable,xSDoc);
-//get the XModifiable interface used to indicate if the document has been
+//get the XModifiable interface used to indicate if the document has been
//changed
xModifiable = UnoRuntime.queryInterface(XModifiable,xSDoc);
-//set up an array of PropertyValue objects used to save each sheet in the
+//set up an array of PropertyValue objects used to save each sheet in the
//document
storeProps = new Array;//PropertyValue[1];
storeProps[0] = new PropertyValue();
@@ -71,7 +71,7 @@ for(var i=0;i<xSheetsIndexAccess.getCount();i++)
for(var i=0;i<xSheetsIndexAccess.getCount();i++)
{
xPropSet = AnyConverter.toObject( new Type(XPropertySet),
xSheetsIndexAccess.getByIndex(i));
- xPropSet.setPropertyValue("IsVisible", true);
+ xPropSet.setPropertyValue("IsVisible", true);
}
function setAllButOneHidden(xSheetsIndexAccess,vis) {
@@ -88,4 +88,4 @@ function setAllButOneHidden(xSheetsIndexAccess,vis) {
xPropSet.setPropertyValue("IsVisible", false);
}
}
-}
+}
diff --git a/main/scripting/examples/javascript/HelloWorld/helloworld.js
b/main/scripting/examples/javascript/HelloWorld/helloworld.js
index 85cd2623f1..6733c60b8a 100644
--- a/main/scripting/examples/javascript/HelloWorld/helloworld.js
+++ b/main/scripting/examples/javascript/HelloWorld/helloworld.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,16 +7,16 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
// Hello World in JavaScript
importClass(Packages.com.sun.star.uno.UnoRuntime);
diff --git a/main/scripting/examples/javascript/Highlight/ButtonPressHandler.js
b/main/scripting/examples/javascript/Highlight/ButtonPressHandler.js
index 780ef33a97..868e015368 100644
--- a/main/scripting/examples/javascript/Highlight/ButtonPressHandler.js
+++ b/main/scripting/examples/javascript/Highlight/ButtonPressHandler.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,16 +7,16 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
//this script acts as a handler for the buttons in the Highlight dialog
importClass(Packages.com.sun.star.uno.UnoRuntime);
@@ -59,7 +59,7 @@ if (pset.getPropertyValue("Label").equals("Exit"))
// getContext() on the XControl interface
xDialog = UnoRuntime.queryInterface(
XDialog, control.getContext());
-
+
// Close the dialog
xDialog.endExecute();
}
@@ -81,7 +81,7 @@ else
red = java.awt.Color.red.getRGB();
replaceable =
- UnoRuntime.queryInterface(XReplaceable, XSCRIPTCONTEXT.getDocument());
+ UnoRuntime.queryInterface(XReplaceable, XSCRIPTCONTEXT.getDocument());
descriptor = replaceable.createReplaceDescriptor();
@@ -113,9 +113,9 @@ else
descriptor.setPropertyValue("SearchWords", new
java.lang.Boolean(true));
// Replaces all instances of searchKey with new Text properties
- // and gets the number of instances of the searchKey
- descriptor.setSearchString(searchKey);
- descriptor.setReplaceString(searchKey);
+ // and gets the number of instances of the searchKey
+ descriptor.setSearchString(searchKey);
+ descriptor.setReplaceString(searchKey);
replaceable.replaceAll(descriptor);
}
catch (e) {
diff --git a/main/scripting/examples/javascript/Highlight/ShowDialog.js
b/main/scripting/examples/javascript/Highlight/ShowDialog.js
index 5a6ca1f0f8..5aabfd1932 100644
--- a/main/scripting/examples/javascript/Highlight/ShowDialog.js
+++ b/main/scripting/examples/javascript/Highlight/ShowDialog.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,16 +7,16 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
importClass(Packages.com.sun.star.uno.UnoRuntime);
importClass(Packages.com.sun.star.lang.XMultiComponentFactory);
@@ -30,7 +30,7 @@ importClass(java.lang.System);
function tryLoadingLibrary( xmcf, context, name )
{
- try
+ try
{
obj = xmcf.createInstanceWithContext(
"com.sun.star.script.Application" + name + "LibraryContainer",
@@ -46,7 +46,7 @@ function tryLoadingLibrary( xmcf, context, name )
xme = AnyConverter.toObject(new Type(XMacroExpander), serviceObj);
bootstrapName = "bootstraprc";
- if (System.getProperty("os.name").startsWith("Windows"))
+ if (System.getProperty("os.name").startsWith("Windows"))
{
bootstrapName = "bootstrap.ini";
}
@@ -63,8 +63,8 @@ function tryLoadingLibrary( xmcf, context, name )
System.err.println("liblink created");
- }
- catch (e)
+ }
+ catch (e)
{
System.err.println("Got an exception loading lib: " + e.getMessage());
return false;
@@ -102,7 +102,7 @@ xDialogProvider = getDialogProvider();
if (xDialogProvider != null)
{
//try to create the Highlight dialog (found in the ScriptBinding library)
- try
+ try
{
findDialog = xDialogProvider.createDialog("vnd.sun.star.script:" +
"ScriptBindingLibrary.Highlight?location=application");
@@ -115,7 +115,7 @@ if (xDialogProvider != null)
}
else
{
- // try to create the Highlight dialog (found in the
+ // try to create the Highlight dialog (found in the
// ScriptBindingLibrary)
findDialog =
xDialogProvider.createDialog("vnd.sun.star.script:" +
"ScriptBindingLibrary.Highlight?location=application");
diff --git
a/main/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
b/main/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
index 7aea95e91d..2b70e34dd9 100644
---
a/main/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
+++
b/main/scripting/java/com/sun/star/script/framework/provider/javascript/template.js
@@ -1,5 +1,5 @@
// *************************************************************
-//
+//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
@@ -7,16 +7,16 @@
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
-//
+//
// http://www.apache.org/licenses/LICENSE-2.0
-//
+//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
-//
+//
// *************************************************************
// Hello World in JavaScript
// Import standard OpenOffice.org API classes. For more information on
@@ -34,9 +34,9 @@ importClass(Packages.com.sun.star.frame.XModel);
// to all JavaScript scripts in the global variable "XSCRIPTCONTEXT". This
// variable can be used to access the document for which this script
// was invoked.
-//
-// Methods available are:
-//
+//
+// Methods available are:
+//
// XSCRIPTCONTEXT.getDocument() returns XModel
// XSCRIPTCONTEXT.getInvocationContext() returns XScriptInvocationContext or
NULL
// XSCRIPTCONTEXT.getDesktop() returns XDesktop
@@ -44,7 +44,7 @@ importClass(Packages.com.sun.star.frame.XModel);
//
// For more information on using this class see the scripting
// developer guides at:
-//
+//
//
http://api.openoffice.org/docs/DevelopersGuide/ScriptingFramework/ScriptingFramework.xhtml
//