summaryrefslogtreecommitdiff
path: root/swext
diff options
context:
space:
mode:
Diffstat (limited to 'swext')
-rw-r--r--swext/makefile.pmk37
-rw-r--r--swext/mediawiki/build.xml227
-rw-r--r--swext/mediawiki/dialogs/EditSetting.xdl47
-rw-r--r--swext/mediawiki/dialogs/Module1.xba33
-rw-r--r--swext/mediawiki/dialogs/SendToMediaWiki.xdl54
-rw-r--r--swext/mediawiki/dialogs/Settings.xdl46
-rw-r--r--swext/mediawiki/dialogs/dialog.xlb33
-rw-r--r--swext/mediawiki/dialogs/script.xlb31
-rwxr-xr-xswext/mediawiki/help/component.txt1
-rw-r--r--swext/mediawiki/help/makefile.mk87
-rw-r--r--swext/mediawiki/help/wiki.xhp156
-rw-r--r--swext/mediawiki/help/wikiaccount.xhp56
-rw-r--r--swext/mediawiki/help/wikiformats.xhp72
-rw-r--r--swext/mediawiki/help/wikisend.xhp60
-rw-r--r--swext/mediawiki/help/wikisettings.xhp54
-rw-r--r--swext/mediawiki/makefile.mk69
-rw-r--r--swext/mediawiki/src/THIRDPARTYLICENSEREADME.html148
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java193
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/Helper.java1153
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java176
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/Settings.java347
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java295
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiCancelException.java33
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java325
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java429
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java476
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java303
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java388
-rw-r--r--swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java168
-rw-r--r--swext/mediawiki/src/description.xml14
-rw-r--r--swext/mediawiki/src/filter/mediawiki.ottbin0 -> 6304 bytes
-rwxr-xr-xswext/mediawiki/src/filter/odt2mediawiki.xsl1567
-rw-r--r--swext/mediawiki/src/makefile.mk54
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/Addons.xcu67
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/WikiExtension.xcu153
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/makefile.mk48
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/OptionsDialog.xcu50
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/Paths.xcu36
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/ProtocolHandler.xcu36
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/Office/makefile.mk46
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Filter.xcu56
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Types.xcu44
-rw-r--r--swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/makefile.mk46
-rw-r--r--swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/WikiExtension.xcs197
-rw-r--r--swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/makefile.mk46
-rw-r--r--swext/mediawiki/src/uno-extension-manifest.xml53
-rw-r--r--swext/prj/build.lst10
-rw-r--r--swext/prj/d.lst5
48 files changed, 8025 insertions, 0 deletions
diff --git a/swext/makefile.pmk b/swext/makefile.pmk
new file mode 100644
index 000000000000..8e43f2f723f0
--- /dev/null
+++ b/swext/makefile.pmk
@@ -0,0 +1,37 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+XSLDIR=$(SOLARXMLDIR)$/processing
+XCSROOT=$(SOLARXMLDIR)
+ABSXCSROOT=$(SOLARXMLDIR)
+DTDDIR=$(SOLARXMLDIR)
+PROCESSOUT=$(MISC)$/$(CUSTID)
+PROCESSORDIR=$(SOLARBINDIR)
+
+# no validation by inspector class
+NO_INSPECTION=TRUE
+
diff --git a/swext/mediawiki/build.xml b/swext/mediawiki/build.xml
new file mode 100644
index 000000000000..b121985711db
--- /dev/null
+++ b/swext/mediawiki/build.xml
@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<project default="all">
+ <target name="init">
+ <property environment="env"/>
+ <property name="ext" value="oxt"/>
+ <property name="officeroot" value="/export/home/mav/OFFICES/OOG680/m5_netbeans_pro"/>
+ <property name="office.home" value="${officeroot}"/>
+
+ <!-- fallbacks for locations, when solenv is not used -->
+ <condition property="target" value="wikiaddon">
+ <not><isset property="target"/></not>
+ </condition>
+ <condition property="out" value="./build">
+ <not><isset property="out"/></not>
+ </condition>
+ <condition property="solar.jar" value="${officeroot}/program/classes">
+ <not><isset property="solar.jar"/></not>
+ </condition>
+
+ <!-- locations used throughout the build -->
+ <property name="name" value="wiki-publisher"/>
+ <property name="dist" value="${out}/bin"/>
+ <property name="classes" value="${out}/class"/>
+ <property name="classes.test" value="${out}/class-test"/>
+ <property name="officeclasses" value="${solar.jar}"/>
+
+ <!-- build options -->
+ <property name="sourcelevel" value="1.4"/>
+ <property name="verbose" value="false"/>
+ <property name="debug" value="${antdebug}"/>
+
+ <!-- build classpath -->
+ <path id="classpath">
+ <pathelement location="${officeclasses}/juh.jar"/>
+ <pathelement location="${officeclasses}/jurt.jar"/>
+ <pathelement location="${officeclasses}/ridl.jar"/>
+ <pathelement location="${officeclasses}/unoil.jar"/>
+ <!-- 3rd party libs -->
+ <pathelement location="${commons-codec-jar}"/>
+ <pathelement location="${commons-httpclient-jar}"/>
+ <pathelement location="${commons-lang-jar}"/>
+ <pathelement location="${commons-logging-jar}"/>
+ </path>
+
+ <!-- create output directories -->
+ <mkdir dir="${classes}"/>
+ <mkdir dir="${classes.test}"/>
+ <mkdir dir="${dist}"/>
+ </target>
+
+ <target name="compile" depends="init">
+ <javac debug="${debug}" debuglevel="lines,vars,source" destdir="${classes}" classpathref="classpath"
+ source="${sourcelevel}" verbose="${verbose}">
+ <src path="src"/>
+ </javac>
+ </target>
+
+ <target name="xcucheck" depends="init">
+ <condition property="no.merge.present">
+ <not>
+ <available file="${out}/misc/${target}/merge/org/openoffice/Office/Custom/WikiExtension.xcu" type="file"/>
+ </not>
+ </condition>
+ </target>
+
+ <target name="xcumerge" depends="xcucheck, init" if="no.merge.present">
+ <copy todir="${out}/misc/${target}/merge">
+ <fileset dir="${out}/misc/${target}/registry/data" includes="**/*.xcu" casesensitive="yes"/>
+ </copy>
+ </target>
+
+ <target name="jar" depends="compile, init">
+ <jar basedir="${classes}" compress="true" jarfile="${dist}/${target}.jar">
+ <manifest>
+ <!-- FIXME: Set Class-Path correctly for the system case !-->
+ <attribute name="Class-Path" value="commons-codec-1.3.jar commons-lang-2.3.jar commons-httpclient-3.1.jar commons-logging-1.1.1.jar"/>
+ <attribute name="RegistrationClassName" value="com.sun.star.wiki.WikiEditorImpl"/>
+ </manifest>
+ </jar>
+ </target>
+
+ <target name="tmpdir" depends="xcumerge, jar, init">
+ <copy todir="${out}/misc/${target}/package_tmp" overwrite="true" encoding="UTF-8">
+ <fileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes"/>
+ <fileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes"/>
+ <fileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes"/>
+ <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes"/>
+ <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" casesensitive="yes"/>
+ <!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378
+ <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/>
+ -->
+ <fileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/>
+ <fileset dir="${out}/misc/${target}" includes="help/component.txt" casesensitive="yes"/>
+ <filterset>
+ <filter token="WIKIEXTENSIONPRODUCTNAME" value="Wiki Publisher"/>
+ <filter token="WIKIEXTENSIONID" value="com.sun.wiki-publisher"/>
+ <filter token="WIKIEXTENSIONFILENAME" value="${name}"/>
+ </filterset>
+ </copy>
+ </target>
+
+ <target name="uno-package" depends="tmpdir, xcumerge, jar, init">
+ <delete file="${dist}/${name}.${ext}"/>
+ <zip destfile="${dist}/${name}.${ext}">
+ <fileset dir="${out}/misc/${target}/package_tmp" casesensitive="yes"/>
+ <fileset dir="${dist}" includes="${target}.jar" casesensitive="yes"/>
+ <fileset file="${commons-codec-jar}" casesensitive="yes"/>
+ <fileset file="${commons-httpclient-jar}" casesensitive="yes"/>
+ <fileset file="${commons-lang-jar}" casesensitive="yes"/>
+ <fileset file="${commons-logging-jar}" casesensitive="yes"/>
+ <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl"/>
+ <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott"/>
+ <zipfileset dir="${solar.bin}/xslt/export/xsltml" casesensitive="yes" prefix="filter/math"/>
+ <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml"/>
+ <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor"/>
+ <zipfileset dir="${out}/misc/${target}/help" includes="**/*.idxl/*,**/*.*_,**/*.jar" casesensitive="yes" prefix="help"/>
+ <zipfileset dir="${out}/misc/${target}/help" includes="**/*.xhp" casesensitive="yes" prefix="help"/>
+ <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license"/>
+ </zip>
+ </target>
+
+ <target name="development-package" depends="jar, init">
+ <delete file="${dist}/${target}_develop.zip"/>
+ <zip destfile="${dist}/${target}_develop.zip">
+ <zipfileset dir="${dist}" includes="${target}.jar" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" excludes="**/ProtocolHandler.xcu,**/Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
+ <!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378
+ <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
+ -->
+ <zipfileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
+ <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl" filemode="664" dirmode="775"/>
+ <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}/help" includes="component.txt" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/>
+ <zipfileset dir="${out}/misc/${target}_merge/help" includes="**/*.xhp" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/>
+ <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor" filemode="664" dirmode="775"/>
+ <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml" filemode="664" dirmode="775"/>
+ <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license" filemode="664" dirmode="775"/>
+ </zip>
+ </target>
+
+ <target depends="init, jar, uno-package, development-package" description="Build everything." name="all">
+ <echo message="${name} built."/>
+ </target>
+
+ <target depends="init" description="Clean all build products." name="clean">
+ <delete dir="${classes}/com/sun/star/wiki"/>
+ <delete dir="${out}/misc/${target}"/>
+ <delete dir="${dist}/${target}.jar"/>
+ <delete dir="${dist}/${name}.${ext}"/>
+ <delete dir="${dist}/${target}_develop.zip"/>
+ </target>
+
+ <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+
+ <target name="uno-deploy" description="Deploys UNO extension package" depends="uno-package">
+ <echo message="deploying UNO extension package ..."/>
+ <echo message="${office.unopkg} add -f ${uno.package.name}"/>
+ <exec executable="${office.unopkg}" dir="${office.program.dir}" failonerror="true">
+ <arg value="add"/>
+ <arg value="-f"/>
+ <arg file="${uno.package.name}"/>
+ </exec>
+ </target>
+
+ <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
+
+ <target name="uno-debug" description="Debugss UNO extension package in Target Office" depends="uno-package">
+ <!-- security fail for executing this without netbeans -->
+ <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
+ <!-- start debugger and get connection address jpda.address -->
+ <nbjpdastart name="Debug Office" addressproperty="jpda.address" transport="dt_socket">
+ <classpath path="${build.classes.dir}"/>
+ <sourcepath path="${src.dir}"/>
+ </nbjpdastart>
+ <!-- register component in temporaary user installation -->
+ <echo message="debugging UNO extension package ..."/>
+ <echo message="wait until preparation is finished."/>
+ <echo message=" deploying UNO extension package for debugging ..."/>
+ <echo message=" ${office.unopkg} add -f ${uno.package.name}"/>
+ <exec executable="${office.unopkg}" dir="${office.program.dir}">
+ <arg value="add"/>
+ <arg value="-f"/>
+ <arg file="${uno.package.name}"/>
+ <env key="UserInstallation" value="${office.debug.user.directory}"/>
+ </exec>
+ <!-- start Office with debug Java and user installation -->
+ <echo message=" starting the Office with ..."/>
+ <echo message=" user installation: ${office.debug.user.directory}"/>
+ <echo message=" debug options: &quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
+ <echo message=" ${office.soffice}"/>
+ <echo message="preparation finished."/>
+ <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
+ <env key="UserInstallation" value="${office.debug.user.directory}"/>
+ <env key="JAVA_TOOL_OPTIONS" value="&quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
+ </exec>
+ </target>
+</project>
diff --git a/swext/mediawiki/dialogs/EditSetting.xdl b/swext/mediawiki/dialogs/EditSetting.xdl
new file mode 100644
index 000000000000..fb5a103f5b7b
--- /dev/null
+++ b/swext/mediawiki/dialogs/EditSetting.xdl
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="EditSetting" dlg:tab-index="1" dlg:left="180" dlg:top="89" dlg:width="198" dlg:height="125" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE" dlg:help-url="vnd.com.sun.star.wiki:account">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="UrlLabel" dlg:tab-index="3" dlg:left="6" dlg:top="22" dlg:width="50" dlg:height="8" dlg:value="URL" dlg:tabstop="false"/>
+ <dlg:textfield dlg:id="UrlField" dlg:tab-index="4" dlg:left="58" dlg:top="19" dlg:width="122" dlg:height="12" dlg:help-url="com.sun.star.wiki.MediaWiki.EditSetting.UrlField"/>
+ <dlg:textfield dlg:id="UsernameField" dlg:tab-index="6" dlg:left="58" dlg:top="52" dlg:width="122" dlg:height="12" dlg:help-url="com.sun.star.wiki.MediaWiki.EditSetting.UsernameField"/>
+ <dlg:textfield dlg:id="PasswordField" dlg:tab-index="8" dlg:left="58" dlg:top="68" dlg:width="122" dlg:height="12" dlg:help-url="com.sun.star.wiki.MediaWiki.EditSetting.PasswordField" dlg:echochar="*"/>
+ <dlg:button dlg:id="OkButton" dlg:tab-index="11" dlg:left="89" dlg:top="106" dlg:width="50" dlg:height="14" dlg:default="true" dlg:value="OK">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:OK" script:language="UNO"/>
+ </dlg:button>
+ <dlg:button dlg:id="CancelButton" dlg:tab-index="12" dlg:left="143" dlg:top="106" dlg:width="50" dlg:height="14" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="HelpButton" dlg:tab-index="10" dlg:left="5" dlg:top="106" dlg:width="50" dlg:height="14" dlg:button-type="help"/>
+ <dlg:text dlg:id="UsernameLabel" dlg:tab-index="5" dlg:left="6" dlg:top="53" dlg:width="46" dlg:height="8" dlg:value="User Name" dlg:tabstop="false"/>
+ <dlg:text dlg:id="PasswordLabel" dlg:tab-index="7" dlg:left="6" dlg:top="69" dlg:width="46" dlg:height="8" dlg:value="Password" dlg:tabstop="false"/>
+ <dlg:checkbox dlg:id="SaveBox" dlg:tab-index="9" dlg:left="58" dlg:top="84" dlg:width="116" dlg:height="8" dlg:help-url="com.sun.star.wiki.MediaWiki.EditSetting.SaveBox" dlg:value="Store password" dlg:checked="false"/>
+ <dlg:fixedline dlg:id="BottomLine" dlg:tab-index="0" dlg:left="-4" dlg:top="97" dlg:width="205" dlg:height="8"/>
+ <dlg:fixedline dlg:id="AccountLine" dlg:tab-index="1" dlg:left="3" dlg:top="38" dlg:width="193" dlg:height="8" dlg:value="Account"/>
+ <dlg:fixedline dlg:id="WikiLine" dlg:tab-index="2" dlg:left="3" dlg:top="5" dlg:width="193" dlg:height="8" dlg:value="Wiki"/>
+ </dlg:bulletinboard>
+</dlg:window>
diff --git a/swext/mediawiki/dialogs/Module1.xba b/swext/mediawiki/dialogs/Module1.xba
new file mode 100644
index 000000000000..c54705ca51cd
--- /dev/null
+++ b/swext/mediawiki/dialogs/Module1.xba
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+'
+' DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+'
+' Copyright 2000, 2010 Oracle and/or its affiliates.
+'
+' OpenOffice.org - a multi-platform office productivity suite
+'
+' This file is part of OpenOffice.org.
+'
+' OpenOffice.org is free software: you can redistribute it and/or modify
+' it under the terms of the GNU Lesser General Public License version 3
+' only, as published by the Free Software Foundation.
+'
+' OpenOffice.org is distributed in the hope that it will be useful,
+' but WITHOUT ANY WARRANTY; without even the implied warranty of
+' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+' GNU Lesser General Public License version 3 for more details
+' (a copy is included in the LICENSE file that accompanied this code).
+'
+' You should have received a copy of the GNU Lesser General Public License
+' version 3 along with OpenOffice.org. If not, see
+' <http://www.openoffice.org/license.html>
+' for a copy of the LGPLv3 License.
+'
+ ************************************************************************ -->
+<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
+<script:module xmlns:script="http://openoffice.org/2000/script" script:name="Module1" script:language="StarBasic">REM ***** BASIC *****
+
+Sub Main
+
+End Sub</script:module>
diff --git a/swext/mediawiki/dialogs/SendToMediaWiki.xdl b/swext/mediawiki/dialogs/SendToMediaWiki.xdl
new file mode 100644
index 000000000000..cd690c5f23ec
--- /dev/null
+++ b/swext/mediawiki/dialogs/SendToMediaWiki.xdl
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="SendToMediaWiki" dlg:left="62" dlg:top="57" dlg:width="242" dlg:height="164" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE" dlg:help-url="vnd.com.sun.star.wiki:sendDialog">
+ <dlg:bulletinboard>
+ <dlg:text dlg:id="Label1" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="65" dlg:height="10" dlg:value="MediaWiki Server"/>
+ <dlg:text dlg:id="Label2" dlg:tab-index="3" dlg:left="11" dlg:top="38" dlg:width="59" dlg:height="10" dlg:value="Title"/>
+ <dlg:text dlg:id="Label3" dlg:tab-index="5" dlg:left="11" dlg:top="57" dlg:width="59" dlg:height="10" dlg:value="Summary"/>
+ <dlg:menulist dlg:id="WikiList" dlg:tab-index="1" dlg:left="75" dlg:top="6" dlg:width="116" dlg:height="14" dlg:spin="true" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.WikiList">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:WikiListChange" script:language="UNO"/>
+ </dlg:menulist>
+ <dlg:combobox dlg:id="ArticleText" dlg:tab-index="4" dlg:left="75" dlg:top="36" dlg:width="160" dlg:height="14" dlg:spin="true" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.ArticleText">
+ <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.UNO:ArticleTextChange" script:language="UNO"/>
+ </dlg:combobox>
+ <dlg:textfield dlg:id="CommentText" dlg:tab-index="6" dlg:left="75" dlg:top="55" dlg:width="160" dlg:height="48" dlg:multiline="true" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.CommentText"/>
+ <dlg:button dlg:id="AddButton" dlg:tab-index="2" dlg:left="195" dlg:top="6" dlg:width="40" dlg:height="14" dlg:value="Add..." dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.AddButton">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:AddWiki" script:language="UNO"/>
+ </dlg:button>
+ <dlg:checkbox dlg:id="MinorCheck" dlg:tab-index="7" dlg:left="75" dlg:top="109" dlg:width="141" dlg:height="10" dlg:value="Minor edit" dlg:checked="false" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.MinorCheck"/>
+ <dlg:checkbox dlg:id="BrowserCheck" dlg:tab-index="8" dlg:left="75" dlg:top="122" dlg:width="141" dlg:height="10" dlg:value="Show in browser" dlg:checked="false" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.BrowserCheck"/>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="9" dlg:left="-2" dlg:top="138" dlg:width="246" dlg:height="4"/>
+ <dlg:button dlg:id="CancelButton" dlg:tab-index="10" dlg:left="187" dlg:top="145" dlg:width="50" dlg:height="14" dlg:button-type="cancel"/>
+ <dlg:button dlg:id="SendButton" dlg:tab-index="11" dlg:disabled="true" dlg:left="134" dlg:top="145" dlg:width="50" dlg:height="14" dlg:default="true" dlg:value="Send" dlg:help-url="com.sun.star.wiki.MediaWiki.SendToMediaWiki.SendButton">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Send" script:language="UNO"/>
+ </dlg:button>
+ <dlg:button dlg:id="HelpButton" dlg:tab-index="12" dlg:left="5" dlg:top="145" dlg:width="50" dlg:height="14" dlg:button-type="help"/>
+ <dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="13" dlg:left="5" dlg:top="25" dlg:width="234" dlg:height="6" dlg:value="MediaWiki"/>
+ </dlg:bulletinboard>
+</dlg:window>
diff --git a/swext/mediawiki/dialogs/Settings.xdl b/swext/mediawiki/dialogs/Settings.xdl
new file mode 100644
index 000000000000..adf818a95611
--- /dev/null
+++ b/swext/mediawiki/dialogs/Settings.xdl
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd">
+<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="Settings" dlg:left="142" dlg:top="89" dlg:width="260" dlg:height="185" dlg:closeable="true" dlg:withtitlebar="false" dlg:help-url="vnd.com.sun.star.wiki:settings">
+ <dlg:bulletinboard>
+ <dlg:button dlg:id="AddButton" dlg:tab-index="1" dlg:left="204" dlg:top="20" dlg:width="50" dlg:height="14" dlg:help-url="com.sun.star.wiki.MediaWiki.Settings.AddButton" dlg:value="Add...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Add" script:language="UNO"/>
+ </dlg:button>
+ <dlg:button dlg:id="EditButton" dlg:tab-index="2" dlg:left="204" dlg:top="36" dlg:width="50" dlg:height="14" dlg:help-url="com.sun.star.wiki.MediaWiki.Settings.EditButton" dlg:value="Edit...">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Edit" script:language="UNO"/>
+ </dlg:button>
+ <dlg:button dlg:id="RemoveButton" dlg:tab-index="3" dlg:left="204" dlg:top="52" dlg:width="50" dlg:height="14" dlg:help-url="com.sun.star.wiki.MediaWiki.Settings.RemoveButton" dlg:value="Remove">
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Remove" script:language="UNO"/>
+ </dlg:button>
+ <dlg:menulist dlg:id="WikiList" dlg:tab-index="0" dlg:left="9" dlg:top="20" dlg:width="189" dlg:height="120" dlg:help-url="com.sun.star.wiki.MediaWiki.Settings.WikiList" dlg:multiselection="true">
+ <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ListStatus" script:language="UNO"/>
+ <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:ListEdit" script:language="UNO"/>
+ </dlg:menulist>
+ <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="1" dlg:left="6" dlg:top="6" dlg:width="248" dlg:height="8" dlg:help-text="" dlg:value="Wiki Publisher"/>
+ </dlg:bulletinboard>
+</dlg:window>
diff --git a/swext/mediawiki/dialogs/dialog.xlb b/swext/mediawiki/dialogs/dialog.xlb
new file mode 100644
index 000000000000..3dade31769d5
--- /dev/null
+++ b/swext/mediawiki/dialogs/dialog.xlb
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="WikiEditor" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="SendToMediaWiki"/>
+ <library:element library:name="Settings"/>
+ <library:element library:name="EditSetting"/>
+</library:library>
diff --git a/swext/mediawiki/dialogs/script.xlb b/swext/mediawiki/dialogs/script.xlb
new file mode 100644
index 000000000000..5ca371402a91
--- /dev/null
+++ b/swext/mediawiki/dialogs/script.xlb
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
+<library:library xmlns:library="http://openoffice.org/2000/library" library:name="WikiEditor" library:readonly="false" library:passwordprotected="false">
+ <library:element library:name="Module1"/>
+</library:library>
diff --git a/swext/mediawiki/help/component.txt b/swext/mediawiki/help/component.txt
new file mode 100755
index 000000000000..c5ac1de36066
--- /dev/null
+++ b/swext/mediawiki/help/component.txt
@@ -0,0 +1 @@
+The @WIKIEXTENSIONPRODUCTNAME@ enables you to create Wiki articles on MediaWiki servers without having to know the syntax of the MediaWiki markup language. Publish your new and existing documents transparently with the Writer to a wiki page.
diff --git a/swext/mediawiki/help/makefile.mk b/swext/mediawiki/help/makefile.mk
new file mode 100644
index 000000000000..1804ec2b668a
--- /dev/null
+++ b/swext/mediawiki/help/makefile.mk
@@ -0,0 +1,87 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=swext
+TARGET=$(PRJNAME)_help
+
+.INCLUDE : settings.mk
+
+.IF "$(WITH_LANG)"!=""
+# workaround for the problem in help, the help uses en instead of en-US
+MEDIAWIKI_LANG=$(uniq en $(alllangiso))
+aux_alllangiso:=$(MEDIAWIKI_LANG)
+.ELSE # "$(WITH_LANG)"!=""
+aux_alllangiso:=$(defaultlangiso)
+MEDIAWIKI_LANG=$(uniq en $(alllangiso))
+.ENDIF # "$(WITH_LANG)"!=""
+
+.IF "$(ENABLE_MEDIAWIKI)" != "YES"
+all:
+ @echo Building mediawiki disabled...
+.ELSE # "$(ENABLE_MEDIAWIKI)" != "YES"
+
+PACKAGE=com.sun.wiki-publisher
+
+OUT_MEDIAWIKI:=$(MISC)$/mediawiki
+
+LINKNAME:=help
+XHPLINKSRC:=$(OUT_MEDIAWIKI)/help
+
+XHPDEST=$(OUT_MEDIAWIKI)_merge/help
+
+XHPFILES= \
+ wiki.xhp\
+ wikiaccount.xhp\
+ wikiformats.xhp\
+ wikisend.xhp\
+ wikisettings.xhp
+
+LINKLINKFILES= \
+ $(PACKAGE)/{$(XHPFILES)}
+
+# define with own language set
+HLANGXHPFILES=$(foreach,i,$(XHPFILES) $(foreach,j,$(MEDIAWIKI_LANG) $(XHPDEST)$/$j$/$(PACKAGE)$/$(i:f)))
+
+.INCLUDE : target.mk
+.INCLUDE : tg_help.mk
+.INCLUDE : extension_helplink.mk
+
+ALLTAR : $(OUT_MEDIAWIKI)/help/component.txt
+
+$(OUT_MEDIAWIKI)/help/component.txt : component.txt
+ @-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)$(COPY) component.txt $@
+
+$(OUT_MEDIAWIKI)/help/%.xhp : $(OUT_MEDIAWIKI)_merge/help/%.xhp
+ @-$(MKDIRHIER) $(@:d)
+ $(COMMAND_ECHO)cat $< | sed -e 's/@WIKIEXTENSIONPRODUCTNAME@/Wiki Publisher/g' | \
+ sed 's/@WIKIEXTENSIONID@/com.sun.wiki-publisher/g' | \
+ sed 's/@WIKIEXTENSIONFILENAME@/wiki-publisher/g' > $@
+
+.ENDIF # "$(ENABLE_MEDIAWIKI)" != "YES"
+
diff --git a/swext/mediawiki/help/wiki.xhp b/swext/mediawiki/help/wiki.xhp
new file mode 100644
index 000000000000..22f97274814d
--- /dev/null
+++ b/swext/mediawiki/help/wiki.xhp
@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="comsunstarwikiMediaWikiwikixml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">@WIKIEXTENSIONPRODUCTNAME@</title>
+<filename>/@WIKIEXTENSIONID@/wiki.xhp</filename>
+</topic>
+<history>
+<created date="2008-02-08T12:13:25"/>
+<lastedited date="2008-02-08T14:28:08"/>
+</history>
+</meta>
+<body>
+<bookmark xml-lang="en-US" branch="hid/vnd.com.sun.star.wiki:aboutbox" id="bm_id3159252" localize="false"/>
+<bookmark xml-lang="en-US" branch="index" id="bm_id3154408"><bookmark_value>Wiki;@WIKIEXTENSIONPRODUCTNAME@</bookmark_value>
+<bookmark_value>@WIKIEXTENSIONPRODUCTNAME@</bookmark_value>
+<bookmark_value>extensions;MediaWiki</bookmark_value>
+</bookmark>
+<paragraph role="heading" id="hd_id5993530" xml-lang="en-US" level="1" l10n="NEW">@WIKIEXTENSIONPRODUCTNAME@</paragraph>
+<paragraph role="paragraph" id="par_id9647511" xml-lang="en-US" l10n="NEW"><ahelp hid=".">By using the @WIKIEXTENSIONPRODUCTNAME@ you can upload your current Writer text document to a MediaWiki server. After uploading, all Wiki users can read your document on the Wiki.</ahelp></paragraph>
+<bookmark xml-lang="en-US" branch="hid/vnd.com.sun.star.wiki:send" id="bm_id3159253" localize="false"/>
+<paragraph role="paragraph" id="par_id6468703" xml-lang="en-US" l10n="NEW"><ahelp hid=".">Choose <item type="menuitem">File - Send - To MediaWiki</item> to upload the current Writer document to a MediaWiki server.</ahelp></paragraph>
+<paragraph role="heading" id="hd_id4554582" xml-lang="en-US" level="2" l10n="NEW">System Requirements</paragraph>
+<list type="unordered">
+<listitem>
+<paragraph role="paragraph" id="par_id2597430" xml-lang="en-US" l10n="NEW">StarOffice/StarSuite 9</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id8430738" xml-lang="en-US" l10n="NEW">OpenOffice.org 3.0</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id9340495" xml-lang="en-US" l10n="NEW">Java Runtime Environment 1.4</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id7387615" xml-lang="en-US" l10n="NEW">A Wiki account on a supported <link href="http://www.mediawiki.org/wiki/MediaWiki">MediaWiki</link> server</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id8047120" xml-lang="en-US" level="2" l10n="NEW">Installing @WIKIEXTENSIONPRODUCTNAME@</paragraph>
+<paragraph role="paragraph" id="par_id4277169" xml-lang="en-US" l10n="NEW">Before you install the @WIKIEXTENSIONPRODUCTNAME@, ensure that %PRODUCTNAME uses a Java Runtime Environment (JRE). To check the status of the JRE, choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Java</item>. Ensure that "Use a Java runtime environment" is marked and that a Java runtime folder is selected in the big listbox. If no JRE was activated, then activate a JRE 1.4 or later and restart %PRODUCTNAME.</paragraph>
+<paragraph role="heading" id="hd_id567339" xml-lang="en-US" level="3" l10n="NEW">To Install the @WIKIEXTENSIONPRODUCTNAME@</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="paragraph" id="par_id1732230" xml-lang="en-US" l10n="NEW">In a Writer window, choose <item type="menuitem">Tools - Extension Manager</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id4338511" xml-lang="en-US" l10n="NEW">In the Extension Manager dialog, click Add.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id5882442" xml-lang="en-US" l10n="NEW">Locate the @WIKIEXTENSIONFILENAME@.oxt file, click Open, and then click Close. </paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id4008911" xml-lang="en-US" l10n="NEW">Close %PRODUCTNAME, and close also the Quickstarter if enabled.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id265511" xml-lang="en-US" l10n="NEW">Restart the software, open a text document, then choose <item type="menuitem">Tools - Options - Internet - MediaWiki</item> to enter your Wiki settings. See "To Connect To a Wiki" below.</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id3569444" xml-lang="en-US" level="3" l10n="NEW">To Remove the @WIKIEXTENSIONPRODUCTNAME@</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="paragraph" id="par_id2655110" xml-lang="en-US" l10n="NEW">In a Writer window, choose <item type="menuitem">Tools - Extension Manager</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id9504379" xml-lang="en-US" l10n="NEW">Click the plus sign (+) in front of My Extensions.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id8431348" xml-lang="en-US" l10n="NEW">Select the extension, click Remove, and then click Close.</paragraph>
+</listitem>
+</list>
+<paragraph role="heading" id="hd_id5316019" xml-lang="en-US" level="2" l10n="NEW">To Connect to a Wiki</paragraph>
+<paragraph role="paragraph" id="par_id2381969" xml-lang="en-US" l10n="NEW">Note: You can store your user name and password for all respective dialogs inside %PRODUCTNAME. The password will be stored in a secure way, where access is maintained by a master password. To enable the master password, choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item>.</paragraph>
+<paragraph role="paragraph" id="par_id3751640" xml-lang="en-US" l10n="NEW">Note: If you connect to the web using a proxy server, enter the proxy information to <item type="menuitem">Tools - Options - Internet - Proxy</item>, and restart the software.</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="paragraph" id="par_id9533677" xml-lang="en-US" l10n="NEW">Open a Writer document, and choose <item type="menuitem">Tools - Options - Internet - MediaWiki</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id368968" xml-lang="en-US" l10n="NEW">In the <link href="@WIKIEXTENSIONID@/wikisettings.xhp">Options</link> dialog, click Add.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id6962187" xml-lang="en-US" l10n="NEW">In the <link href="@WIKIEXTENSIONID@/wikiaccount.xhp">MediaWiki</link> dialog, enter the account information for the Wiki.</paragraph>
+</listitem>
+</list>
+<list type="ordered">
+<listitem>
+<paragraph role="paragraph" id="par_id5328836" xml-lang="en-US" l10n="NEW">In the URL textbox, enter the address of a Wiki that you want to connect to.</paragraph>
+<paragraph role="paragraph" id="par_id389416" xml-lang="en-US" l10n="NEW">You can copy the URL from a web browser and paste it into the textbox.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id5906552" xml-lang="en-US" l10n="NEW">In the Username box, enter your user ID for your Wiki account.</paragraph>
+<paragraph role="paragraph" id="par_id9297158" xml-lang="en-US" l10n="NEW">If the Wiki allows anonymous write access, you can leave the Username and Password boxes empty.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id8869594" xml-lang="en-US" l10n="NEW">In the Password box, enter the password for your Wiki account, then click OK.</paragraph>
+</listitem>
+</list>
+<paragraph role="paragraph" id="par_id292062" xml-lang="en-US" l10n="NEW">Optionally enable "Save password" to save the password between sessions. A master password is used to maintain access to all saved passwords. Choose <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item> to enable the master password. "Save password" is unavailable when the master password is not enabled.</paragraph>
+<paragraph role="heading" id="hd_id7044892" xml-lang="en-US" level="2" l10n="NEW">To Create a New Wiki Page</paragraph>
+<list type="ordered">
+<listitem>
+<paragraph role="paragraph" id="par_id3514206" xml-lang="en-US" l10n="NEW">Open a Writer document.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id944853" xml-lang="en-US" l10n="NEW">Write the content of the Wiki page. You can use formatting like text formats, headings, footnotes, and more. See the <link href="@WIKIEXTENSIONID@/wikiformats.xhp">list of supported formats</link>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id4566484" xml-lang="en-US" l10n="NEW">Choose <item type="menuitem">File - Send - To MediaWiki</item>.</paragraph>
+</listitem>
+<listitem>
+<paragraph role="paragraph" id="par_id228278" xml-lang="en-US" l10n="NEW">In the <link href="@WIKIEXTENSIONID@/wikisend.xhp">Send to MediaWiki</link> dialog, specify the settings for your entry.</paragraph>
+</listitem>
+</list>
+<paragraph role="paragraph" id="par_id2564165" xml-lang="en-US" l10n="NEW">
+<emph>MediaWiki server</emph>: Select the Wiki.</paragraph>
+<paragraph role="paragraph" id="par_id5566576" xml-lang="en-US" l10n="NEW">
+<emph>Title</emph>: Type the title of your page. Type the title of an existing page to overwrite the page with your current text document. Type a new title to create a new page on the Wiki.</paragraph>
+<paragraph role="paragraph" id="par_id9688711" xml-lang="en-US" l10n="NEW">
+<emph>Summary</emph>: Enter an optional short summary of your page.</paragraph>
+<paragraph role="paragraph" id="par_id4123661" xml-lang="en-US" l10n="NEW">
+<emph>This is a minor edit</emph>: Check this box to mark the uploaded page as a minor edit of the already existing page with the same title.</paragraph>
+<paragraph role="paragraph" id="par_id452284" xml-lang="en-US" l10n="NEW">
+<emph>Show in web browser</emph>: Check this box to open your system web browser and show the uploaded Wiki page.</paragraph>
+<list type="ordered" startwith="5">
+<listitem>
+<paragraph role="paragraph" id="par_id8346812" xml-lang="en-US" l10n="NEW">Click Send.</paragraph>
+</listitem>
+</list>
+</body>
+</helpdocument>
diff --git a/swext/mediawiki/help/wikiaccount.xhp b/swext/mediawiki/help/wikiaccount.xhp
new file mode 100644
index 000000000000..8d1d57ba1d25
--- /dev/null
+++ b/swext/mediawiki/help/wikiaccount.xhp
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="comsunstarwikiMediaWikiwikiaccountxml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">MediaWiki</title>
+<filename>/@WIKIEXTENSIONID@/wikiaccount.xhp</filename>
+</topic>
+<history>
+<created date="2008-02-08T12:13:25"/>
+<lastedited date="2008-02-08T13:15:05"/>
+</history>
+</meta>
+<body>
+<bookmark branch="hid/vnd.com.sun.star.wiki:account" id="bm_id7021088" localize="false"/>
+<paragraph role="heading" id="hd_id960722" xml-lang="en-US" level="1" l10n="NEW">MediaWiki</paragraph>
+<paragraph role="paragraph" id="par_id4571672" xml-lang="en-US" l10n="NEW">Use the MediaWiki dialog to add or edit your MediaWiki account settings.</paragraph><comment>URL</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.UrlField" id="bm_id4558244" localize="false"/>
+<paragraph role="paragraph" id="par_id7631458" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enter the URL of a MediaWiki server, starting with http://</ahelp></paragraph><comment>Username</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.UsernameField" id="bm_id4558245" localize="false"/>
+<paragraph role="paragraph" id="par_id7862483" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enter your user name on the MediaWiki server. Leave empty for anonymous access.</ahelp></paragraph><comment>Password</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.PasswordField" id="bm_id4558246" localize="false"/>
+<paragraph role="paragraph" id="par_id1113010" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enter your password on the MediaWiki server. Leave empty for anonymous access.</ahelp></paragraph><comment>Save password</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.EditSetting.SaveBox" id="bm_id4558247" localize="false"/>
+<paragraph role="paragraph" id="par_id656758" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Enable to store your password between sessions. The master password must be enabled, see <item type="menuitem">Tools - Options - %PRODUCTNAME - Security</item>.</ahelp></paragraph>
+<paragraph role="paragraph" id="par_id3112582" xml-lang="en-US" l10n="NEW">Enter the Internet address of a Wiki server in a format like http://wiki.services.openoffice.org/wiki or copy the URL from a web browser.</paragraph>
+<paragraph role="paragraph" id="par_id628070" xml-lang="en-US" l10n="NEW">If the Wiki allows anonymous access, you can leave the account text boxes empty. Else enter your user name and password.</paragraph>
+<paragraph role="paragraph" id="par_id9046601" xml-lang="en-US" l10n="NEW">If you have enabled the master password feature on the Security tab page of the Tools - Options - %PRODUCTNAME dialog, then the software can store your password and automatically insert the data where necessary. Enable the "Save password" checkbox to store your password.</paragraph>
+</body>
+</helpdocument>
diff --git a/swext/mediawiki/help/wikiformats.xhp b/swext/mediawiki/help/wikiformats.xhp
new file mode 100644
index 000000000000..fd9c98e19fae
--- /dev/null
+++ b/swext/mediawiki/help/wikiformats.xhp
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="comsunstarwikiMediaWikiwikiformatsxml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">MediaWiki Formats</title>
+<filename>/@WIKIEXTENSIONID@/wikiformats.xhp</filename>
+</topic>
+<history>
+<created date="2008-02-08T12:13:25"/>
+<lastedited date="2008-02-08T14:16:47"/>
+</history>
+</meta>
+<body>
+<bookmark branch="hid/vnd.com.sun.star.wiki:formats" id="bm_id7021088" localize="false"/>
+<paragraph role="heading" id="hd_id3743095" xml-lang="en-US" level="1" l10n="NEW">MediaWiki Formats</paragraph>
+<paragraph role="paragraph" id="par_id8654133" xml-lang="en-US" l10n="NEW">The following list gives an overview of the text formats that the @WIKIEXTENSIONPRODUCTNAME@ can upload to the Wiki server.</paragraph>
+<paragraph role="paragraph" id="par_id5630664" xml-lang="en-US" l10n="NEW">The OpenDocument format used by Writer and the WikiMedia format are quite different. Only a subset of all features can be transformed from one format to the other.</paragraph>
+<paragraph role="heading" id="hd_id7178868" xml-lang="en-US" level="2" l10n="NEW">Headings</paragraph>
+<paragraph role="paragraph" id="par_id508133" xml-lang="en-US" l10n="NEW">Apply a heading paragraph style to the headings in your Writer document. The Wiki will show the heading styles of the same outline level, formatted as defined by the Wiki engine.</paragraph>
+<paragraph role="heading" id="hd_id7217627" xml-lang="en-US" level="2" l10n="NEW">Hyperlinks</paragraph>
+<paragraph role="paragraph" id="par_id3735465" xml-lang="en-US" l10n="NEW">Native OpenDocument hyperlinks are transformed into "external" Wiki links. Therefore, the built-in linking facility of OpenDocument should only be used to create links that point to other sites outside the Wiki web. For creating Wiki links that point to other subjects of the same Wiki domain, use Wiki links.</paragraph>
+<paragraph role="heading" id="hd_id941190" xml-lang="en-US" level="2" l10n="NEW">Lists</paragraph>
+<paragraph role="paragraph" id="par_id8942838" xml-lang="en-US" l10n="NEW">Lists can reliably be exported when the whole list uses a consistent list style. Use the Numbering or Bullets icon to generate a list in Writer. If you need a list without numbering or bullets, use Format - Bullets and Numbering to define and apply the respective list style.</paragraph>
+<paragraph role="heading" id="hd_id7026886" xml-lang="en-US" level="2" l10n="NEW">Paragraphs</paragraph>
+<paragraph role="heading" id="hd_id4436475" xml-lang="en-US" level="3" l10n="NEW">Alignment</paragraph>
+<paragraph role="paragraph" id="par_id376598" xml-lang="en-US" l10n="NEW">Explicit text alignment should not be used in Wiki articles. Nevertheless, text alignment is supported for left, centered, and right alignment of text.</paragraph>
+<paragraph role="heading" id="hd_id7486190" xml-lang="en-US" level="3" l10n="NEW">Pre-formatted text</paragraph>
+<paragraph role="paragraph" id="par_id1459395" xml-lang="en-US" l10n="NEW">A paragraph style with a fixed-width font is transformed as pre-formatted text. Pre-formatted text is shown on the Wiki with a border around the text.</paragraph>
+<paragraph role="heading" id="hd_id4834131" xml-lang="en-US" level="2" l10n="NEW">Character styles</paragraph>
+<paragraph role="paragraph" id="par_id6397595" xml-lang="en-US" l10n="NEW">Character styles modify the appearance of parts of a paragraph. The transformation supports bold, italics, bold/italics, subscript and superscript. All fixed width fonts are transformed into the Wiki typewriter style.</paragraph>
+<paragraph role="heading" id="hd_id5152745" xml-lang="en-US" level="2" l10n="NEW">Footnotes</paragraph>
+<paragraph role="paragraph" id="par_id5238196" xml-lang="en-US" l10n="NEW">Note: The transformation uses the new style of footnotes with &lt;ref&gt; and &lt;references&gt; tags that requires the Cite.php extension to be installed into MediaWiki. If those tags occur as plain text in the transformation result, ask the Wiki administrator to install this extension.</paragraph>
+<paragraph role="heading" id="hd_id9405499" xml-lang="en-US" level="2" l10n="NEW">Images</paragraph>
+<paragraph role="paragraph" id="par_id3541673" xml-lang="en-US" l10n="NEW">Images cannot be exported by a transformation producing a single file of Wiki text. However, if the image is already uploaded to the target Wiki domain (e. g. WikiMedia Commons), then the transformation produces a valid image tag that includes the image. Image captions are also supported.</paragraph>
+<paragraph role="heading" id="hd_id2162236" xml-lang="en-US" level="2" l10n="NEW">Tables</paragraph>
+<paragraph role="paragraph" id="par_id3037202" xml-lang="en-US" l10n="NEW">Simple tables are supported well. Table headers are translated into corresponding Wiki style table headers. However, custom formatting of table borders, column sizes and background colors is ignored.</paragraph>
+<paragraph role="heading" id="hd_id2954496" xml-lang="en-US" level="3" l10n="NEW">Joined Cells</paragraph>
+<paragraph role="paragraph" id="par_id8253730" xml-lang="en-US" l10n="NEW">OpenDocument and especially OpenOffice.org represent tables that have joined cells that span rows as tables with nested tables. In contrast, the wiki model of table is to declare column and row spans for such joined cells. </paragraph>
+<paragraph role="paragraph" id="par_id8163090" xml-lang="en-US" l10n="NEW">If only columns of the same row are joined, the result of the transformation resembles the source document very well.</paragraph>
+<paragraph role="heading" id="hd_id425122" xml-lang="en-US" level="3" l10n="NEW">Borders</paragraph>
+<paragraph role="paragraph" id="par_id1831110" xml-lang="en-US" l10n="NEW">Irrespective of custom table styles for border and background, a table is always exported as "<emph>prettytable"</emph>, which renders in the Wiki engine with simple borders and bold header.</paragraph>
+<paragraph role="heading" id="hd_id6255073" xml-lang="en-US" level="2" l10n="NEW">Charset and special characters</paragraph>
+<paragraph role="paragraph" id="par_id8216193" xml-lang="en-US" l10n="NEW">The charset of the transformation result is fixed to UTF-8. Depending on your system, this might not be the default charset. This might cause "special characters" to look broken when viewed with default settings. However, you can switch your editor to UTF-8 encoding to fix this. If your editor does not support switching the encoding, you can display the result of the transformation in the Firefox browser and switch the encoding to UTF-8 there. Now, you can cut and paste the transformation result to your program of choice.</paragraph>
+</body>
+</helpdocument>
diff --git a/swext/mediawiki/help/wikisend.xhp b/swext/mediawiki/help/wikisend.xhp
new file mode 100644
index 000000000000..f9a5613b5184
--- /dev/null
+++ b/swext/mediawiki/help/wikisend.xhp
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="comsunstarwikiMediaWikiwikisendxml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">Send to MediaWiki</title>
+<filename>/@WIKIEXTENSIONID@/wikisend.xhp</filename>
+</topic>
+<history>
+<created date="2008-02-08T12:13:25"/>
+<lastedited date="2008-02-08T13:36:25"/>
+</history>
+</meta>
+<body>
+<bookmark branch="hid/vnd.com.sun.star.wiki:sendDialog" id="bm_id7021088" localize="false"/>
+<paragraph role="heading" id="hd_id108340" xml-lang="en-US" level="1" l10n="NEW">Send to MediaWiki</paragraph>
+<paragraph role="paragraph" id="par_id1743827" xml-lang="en-US" l10n="NEW">In the Send to MediaWiki dialog, specify the settings for your current Wiki upload.</paragraph><comment>MediaWiki server</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.WikiList" id="bm_id735801" localize="false"/>
+<paragraph role="paragraph" id="par_id664082" xml-lang="en-US" l10n="NEW"><ahelp hid=".">Select the MediaWiki server where you want to publish your document. Click Add to add a new server to the list.</ahelp></paragraph><comment>title</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.ArticleText" id="bm_id735802" localize="false"/>
+<paragraph role="paragraph" id="par_id2794885" xml-lang="en-US" l10n="NEW"><ahelp hid=".">Enter the title of your Wiki entry. This is the top heading of your Wiki entry. For a new entry, the title must be unique on this Wiki. If you enter an existing title, your upload will overwrite the existing Wiki entry.</ahelp></paragraph><comment>summary</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.CommentText" id="bm_id735803" localize="false"/>
+<paragraph role="paragraph" id="par_id2486342" xml-lang="en-US" l10n="NEW"><ahelp hid=".">Enter an optional short summary or comment.</ahelp> See <link href="http://meta.wikimedia.org/wiki/Help:Edit_summary">http://meta.wikimedia.org/wiki/Help:Edit_summary</link>.</paragraph>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.MinorCheck" id="bm_id2619708" localize="false"/>
+<paragraph role="paragraph" id="par_id823999" xml-lang="en-US" l10n="NEW">
+<emph>This is a minor edit</emph>: <ahelp hid=".">Check this box to mark the uploaded page as a minor edit of the already existing page with the same title.</ahelp></paragraph>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.BrowserCheck" id="bm_id1293679" localize="false"/>
+<paragraph role="paragraph" id="par_id6592913" xml-lang="en-US" l10n="NEW">
+<emph>Show in web browser</emph>: <ahelp hid=".">Check this box to open your system web browser and show the uploaded Wiki page.</ahelp></paragraph>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.SendToMediaWiki.SendButton" id="bm_id290536" localize="false"/>
+<list type="ordered" startwith="5">
+</list>
+</body>
+</helpdocument>
diff --git a/swext/mediawiki/help/wikisettings.xhp b/swext/mediawiki/help/wikisettings.xhp
new file mode 100644
index 000000000000..22611a29027a
--- /dev/null
+++ b/swext/mediawiki/help/wikisettings.xhp
@@ -0,0 +1,54 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+
+<helpdocument version="1.0">
+<meta>
+<topic id="comsunstarwikiMediaWikiwikisettingsxml" indexer="include" status="PUBLISH">
+<title id="tit" xml-lang="en-US">MediaWiki Options</title>
+<filename>/@WIKIEXTENSIONID@/wikisettings.xhp</filename>
+</topic>
+<history>
+<created date="2008-02-08T12:13:25"/>
+<lastedited date="2008-02-08T12:53:38"/>
+</history>
+</meta>
+<body>
+<bookmark branch="hid/vnd.com.sun.star.wiki:settings" id="bm_id7021088" localize="false"/>
+<paragraph role="heading" id="hd_id6425672" xml-lang="en-US" level="1" l10n="NEW">MediaWiki Options</paragraph>
+<paragraph role="paragraph" id="par_id1188390" xml-lang="en-US" l10n="NEW">You can add, edit and remove MediaWiki servers. Open the dialog by <item type="menuitem">Tools - Options - Internet - MediaWiki</item>. Alternatively, choose <item type="menuitem">Tools - Extension Manager</item>, select the @WIKIEXTENSIONPRODUCTNAME@, and click the Options button.</paragraph><comment>Listbox</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.Settings.WikiList" id="bm_id6402783" localize="false"/>
+<paragraph role="paragraph" id="par_id300607" xml-lang="en-US" l10n="NEW"><ahelp hid=".">Click Add to add a new Wiki server.<br/>Select an entry and click Edit to edit the account settings.<br/>Select an entry and click Remove to remove the entry from the list.</ahelp></paragraph><comment>Add button</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.Settings.AddButton" id="bm_id6067384" localize="false"/>
+<paragraph role="paragraph" id="par_id9786065" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Opens the MediaWiki dialog to add a new entry to the list.</ahelp></paragraph><comment>Edit button</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.Settings.EditButton" id="bm_id6067385" localize="false"/>
+<paragraph role="paragraph" id="par_id3386333" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Opens the MediaWiki dialog to edit the selected entry.</ahelp></paragraph><comment>Remove button</comment>
+<bookmark xml-lang="en-US" branch="hid/com.sun.star.wiki.MediaWiki.Settings.RemoveButton" id="bm_id6067386" localize="false"/>
+<paragraph role="paragraph" id="par_id7285073" xml-lang="en-US" l10n="NEW"><ahelp hid="." visibility="hidden">Removes the selected entry from the list.</ahelp></paragraph>
+<paragraph role="paragraph" id="par_id1029084" xml-lang="en-US" l10n="NEW">When you click Add or Edit, the <link href="@WIKIEXTENSIONID@/wikiaccount.xhp">MediaWiki</link> dialog opens.</paragraph>
+</body>
+</helpdocument>
diff --git a/swext/mediawiki/makefile.mk b/swext/mediawiki/makefile.mk
new file mode 100644
index 000000000000..52d9900ab1e6
--- /dev/null
+++ b/swext/mediawiki/makefile.mk
@@ -0,0 +1,69 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..
+PRJNAME=swext
+TARGET=mediawiki
+.IF "$(L10N_framework)"==""
+.IF "$(ENABLE_MEDIAWIKI)" == "YES"
+.INCLUDE : ant.mk
+
+.IF "$(SYSTEM_APACHE_COMMONS)" != "YES"
+COMMONS_CODEC_JAR=$(SOLARVER)$/$(INPATH)$/bin$(UPDMINOREXT)$/commons-codec-1.3.jar
+COMMONS_LANG_JAR=$(SOLARVER)$/$(INPATH)$/bin$(UPDMINOREXT)$/commons-lang-2.3.jar
+COMMONS_HTTPCLIENT_JAR=$(SOLARVER)$/$(INPATH)$/bin$(UPDMINOREXT)$/commons-httpclient-3.1.jar
+COMMONS_LOGGING_JAR=$(SOLARVER)$/$(INPATH)$/bin$(UPDMINOREXT)$/commons-logging-1.1.1.jar
+.ELSE
+COMP=fix_system_commons
+.ENDIF
+
+.IF defined(debug) || defined(DEBUG)
+ANTDEBUG=true
+.ELSE
+ANTDEBUG=off
+.ENDIF
+
+ANT_FLAGS+=-Dcommons-codec-jar=$(COMMONS_CODEC_JAR) -Dcommons-lang-jar=$(COMMONS_LANG_JAR) -Dcommons-httpclient-jar=$(COMMONS_HTTPCLIENT_JAR) -Dcommons-logging-jar=$(COMMONS_LOGGING_JAR) -Dantdebug=$(ANTDEBUG)
+
+# creates two files wiki-publisher.oxt and mediawiki_develop.zip, the second one might be used in further build process
+ALLTAR: $(COMP) ANTBUILD
+
+fix_system_commons:
+ @echo "Fix Java Class-Path entry for Apache Commons libraries from system."
+ @$(SED) -r -e "s#(name=\"Class-Path\" value=\").*\"#\1file://$(COMMONS_CODEC_JAR) file://$(COMMONS_LANG_JAR) \
+file://$(COMMONS_HTTPCLIENT_JAR) file://$(COMMONS_LOGGING_JAR)\"#" -i build.xml
+ @echo "Unbundle Apache Commons libraries from Mediawiki Presentation extension."
+ @$(SED) '/file="..commons/d' -i build.xml
+
+.ELSE
+@all:
+ @echo "MediaWiki Publisher extension disabled."
+.ENDIF
+
+.ELSE
+pesudo:
+.ENDIF
diff --git a/swext/mediawiki/src/THIRDPARTYLICENSEREADME.html b/swext/mediawiki/src/THIRDPARTYLICENSEREADME.html
new file mode 100644
index 000000000000..fbd8b0bfdca0
--- /dev/null
+++ b/swext/mediawiki/src/THIRDPARTYLICENSEREADME.html
@@ -0,0 +1,148 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+ <meta content="text/html; charset=iso-8859-1"
+ http-equiv="Content-Type">
+ <title>THIRDPARTYLICENSEREADME</title>
+</head>
+<body>
+DO NOT TRANSLATE OR LOCALIZE THIS DOCUMENT<br>
+<br>
+<ul id="mozToc">
+<!--mozToc h2 1 h3 2-->
+ <li><a href="#mozTocId445655">The Apache Software Foundation
+ </a>
+ <ul>
+ <li><a href="#mozTocId662146">Commons Codec
+ </a></li>
+ </ul>
+ </li>
+ <li><a href="#mozTocId954021">The Apache Software Foundation
+ </a>
+ <ul>
+ <li><a href="#mozTocId934893">Commons HTTP Client
+ </a></li>
+ </ul>
+ </li>
+ <li><a href="#mozTocId478594">The Apache Software Foundation
+ </a>
+ <ul>
+ <li><a href="#mozTocId789223">Commons Lang
+ </a></li>
+ </ul>
+ </li>
+ <li><a href="#mozTocId877758">The Apache Software Foundation
+ </a>
+ <ul>
+ <li><a href="#mozTocId959568">Commons Logging
+ </a></li>
+ </ul>
+ </li>
+ <li><a href="#mozTocId3503">The Apache Software
+Foundation
+ </a>
+ <ul>
+ <li><a href="#mozTocId520856">Tomcat
+ </a></li>
+ </ul>
+ </li>
+</ul>
+<br>
+<hr style="width: 100%; height: 2px;">The following software may be
+included in this product: Jakarta Commons Codec; Use of any of this
+software is governed by the terms of the license below:<br>
+<h2><a class="mozTocH2" name="mozTocId445655"></a>The Apache Software
+Foundation<br>
+</h2>
+<h3><a class="mozTocH3" name="mozTocId662146"></a>Commons Codec<br>
+</h3>
+<pre> Apache License<br> Version 2.0, January 2004<br> http://www.apache.org/licenses/<br><br> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<br><br> 1. Definitions.<br><br> "License" shall mean the terms and conditions for use, reproduction,<br> and distribution as defined by Sections 1 through 9 of this document.<br><br> "Licensor" shall mean the copyright owner or entity authorized by<br> the copyright owner that is granting the License.<br><br> "Legal Entity" shall mean the union of the acting entity and all<br> other entities that control, are controlled by, or are under common<br> control with that entity. For the purposes of this definition,<br> "control" means (i) the power, direct or indirect, to cause the<br> direction or management of such entity, whether by contract or<br> otherwise, or (ii) ownership of fifty percent (50%) or more of the<br> outstanding shares, or (iii) beneficial ownership of such entity.<br><br> "You" (or "Your") shall mean an individual or Legal Entity<br> exercising permissions granted by this License.<br><br> "Source" form shall mean the preferred form for making modifications,<br> including but not limited to software source code, documentation<br> source, and configuration files.<br><br> "Object" form shall mean any form resulting from mechanical<br> transformation or translation of a Source form, including but<br> not limited to compiled object code, generated documentation,<br> and conversions to other media types.<br><br> "Work" shall mean the work of authorship, whether in Source or<br> Object form, made available under the License, as indicated by a<br> copyright notice that is included in or attached to the work<br> (an example is provided in the Appendix below).<br><br> "Derivative Works" shall mean any work, whether in Source or Object<br> form, that is based on (or derived from) the Work and for which the<br> editorial revisions, annotations, elaborations, or other modifications<br> represent, as a whole, an original work of authorship. For the purposes<br> of this License, Derivative Works shall not include works that remain<br> separable from, or merely link (or bind by name) to the interfaces of,<br> the Work and Derivative Works thereof.<br><br> "Contribution" shall mean any work of authorship, including<br> the original version of the Work and any modifications or additions<br> to that Work or Derivative Works thereof, that is intentionally<br> submitted to Licensor for inclusion in the Work by the copyright owner<br> or by an individual or Legal Entity authorized to submit on behalf of<br> the copyright owner. For the purposes of this definition, "submitted"<br> means any form of electronic, verbal, or written communication sent<br> to the Licensor or its representatives, including but not limited to<br> communication on electronic mailing lists, source code control systems,<br> and issue tracking systems that are managed by, or on behalf of, the<br> Licensor for the purpose of discussing and improving the Work, but<br> excluding communication that is conspicuously marked or otherwise<br> designated in writing by the copyright owner as "Not a Contribution."<br><br> "Contributor" shall mean Licensor and any individual or Legal Entity<br> on behalf of whom a Contribution has been received by Licensor and<br> subsequently incorporated within the Work.<br><br> 2. Grant of Copyright License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> copyright license to reproduce, prepare Derivative Works of,<br> publicly display, publicly perform, sublicense, and distribute the<br> Work and such Derivative Works in Source or Object form.<br><br> 3. Grant of Patent License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> (except as stated in this section) patent license to make, have made,<br> use, offer to sell, sell, import, and otherwise transfer the Work,<br> where such license applies only to those patent claims licensable<br> by such Contributor that are necessarily infringed by their<br> Contribution(s) alone or by combination of their Contribution(s)<br> with the Work to which such Contribution(s) was submitted. If You<br> institute patent litigation against any entity (including a<br> cross-claim or counterclaim in a lawsuit) alleging that the Work<br> or a Contribution incorporated within the Work constitutes direct<br> or contributory patent infringement, then any patent licenses<br> granted to You under this License for that Work shall terminate<br> as of the date such litigation is filed.<br><br> 4. Redistribution. You may reproduce and distribute copies of the<br> Work or Derivative Works thereof in any medium, with or without<br> modifications, and in Source or Object form, provided that You<br> meet the following conditions:<br><br> (a) You must give any other recipients of the Work or<br> Derivative Works a copy of this License; and<br><br> (b) You must cause any modified files to carry prominent notices<br> stating that You changed the files; and<br><br> (c) You must retain, in the Source form of any Derivative Works<br> that You distribute, all copyright, patent, trademark, and<br> attribution notices from the Source form of the Work,<br> excluding those notices that do not pertain to any part of<br> the Derivative Works; and<br><br> (d) If the Work includes a "NOTICE" text file as part of its<br> distribution, then any Derivative Works that You distribute must<br> include a readable copy of the attribution notices contained<br> within such NOTICE file, excluding those notices that do not<br> pertain to any part of the Derivative Works, in at least one<br> of the following places: within a NOTICE text file distributed<br> as part of the Derivative Works; within the Source form or<br> documentation, if provided along with the Derivative Works; or,<br> within a display generated by the Derivative Works, if and<br> wherever such third-party notices normally appear. The contents<br> of the NOTICE file are for informational purposes only and<br> do not modify the License. You may add Your own attribution<br> notices within Derivative Works that You distribute, alongside<br> or as an addendum to the NOTICE text from the Work, provided<br> that such additional attribution notices cannot be construed<br> as modifying the License.<br><br> You may add Your own copyright statement to Your modifications and<br> may provide additional or different license terms and conditions<br> for use, reproduction, or distribution of Your modifications, or<br> for any such Derivative Works as a whole, provided Your use,<br> reproduction, and distribution of the Work otherwise complies with<br> the conditions stated in this License.<br><br> 5. Submission of Contributions. Unless You explicitly state otherwise,<br> any Contribution intentionally submitted for inclusion in the Work<br> by You to the Licensor shall be under the terms and conditions of<br> this License, without any additional terms or conditions.<br> Notwithstanding the above, nothing herein shall supersede or modify<br> the terms of any separate license agreement you may have executed<br> with Licensor regarding such Contributions.<br><br> 6. Trademarks. This License does not grant permission to use the trade<br> names, trademarks, service marks, or product names of the Licensor,<br> except as required for reasonable and customary use in describing the<br> origin of the Work and reproducing the content of the NOTICE file.<br><br> 7. Disclaimer of Warranty. Unless required by applicable law or<br> agreed to in writing, Licensor provides the Work (and each<br> Contributor provides its Contributions) on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or<br> implied, including, without limitation, any warranties or conditions<br> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A<br> PARTICULAR PURPOSE. You are solely responsible for determining the<br> appropriateness of using or redistributing the Work and assume any<br> risks associated with Your exercise of permissions under this License.<br><br> 8. Limitation of Liability. In no event and under no legal theory,<br> whether in tort (including negligence), contract, or otherwise,<br> unless required by applicable law (such as deliberate and grossly<br> negligent acts) or agreed to in writing, shall any Contributor be<br> liable to You for damages, including any direct, indirect, special,<br> incidental, or consequential damages of any character arising as a<br> result of this License or out of the use or inability to use the<br> Work (including but not limited to damages for loss of goodwill,<br> work stoppage, computer failure or malfunction, or any and all<br> other commercial damages or losses), even if such Contributor<br> has been advised of the possibility of such damages.<br><br> 9. Accepting Warranty or Additional Liability. While redistributing<br> the Work or Derivative Works thereof, You may choose to offer,<br> and charge a fee for, acceptance of support, warranty, indemnity,<br> or other liability obligations and/or rights consistent with this<br> License. However, in accepting such obligations, You may act only<br> on Your own behalf and on Your sole responsibility, not on behalf<br> of any other Contributor, and only if You agree to indemnify,<br> defend, and hold each Contributor harmless for any liability<br> incurred by, or claims asserted against, such Contributor by reason<br> of your accepting any such warranty or additional liability.<br><br> END OF TERMS AND CONDITIONS<br><br> APPENDIX: How to apply the Apache License to your work.<br><br> To apply the Apache License to your work, attach the following<br> boilerplate notice, with the fields enclosed by brackets "[]"<br> replaced with your own identifying information. (Don't include<br> the brackets!) The text should be enclosed in the appropriate<br> comment syntax for the file format. We also recommend that a<br> file or class name and description of purpose be included on the<br> same "printed page" as the copyright notice for easier<br> identification within third-party archives.<br><br> Copyright [yyyy] [name of copyright owner]<br><br> Licensed under the Apache License, Version 2.0 (the "License");<br> you may not use this file except in compliance with the License.<br> You may obtain a copy of the License at<br><br> http://www.apache.org/licenses/LICENSE-2.0<br><br> Unless required by applicable law or agreed to in writing, software<br> distributed under the License is distributed on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> See the License for the specific language governing permissions and<br> limitations under the License.<br><br></pre>
+<hr style="width: 100%; height: 2px;">The following software may be
+included in this product: Jakarta Commons HTTP Client 2; Use of any of
+this
+software is governed by the terms of the license below:<br>
+<h2><a class="mozTocH2" name="mozTocId954021"></a>The Apache Software
+Foundation<br>
+</h2>
+<h3><a class="mozTocH3" name="mozTocId934893"></a>Commons HTTP Client<br>
+</h3>
+<pre> Apache License<br> Version 2.0, January 2004<br> http://www.apache.org/licenses/<br><br> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<br><br> 1. Definitions.<br><br> "License" shall mean the terms and conditions for use, reproduction,<br> and distribution as defined by Sections 1 through 9 of this document.<br><br> "Licensor" shall mean the copyright owner or entity authorized by<br> the copyright owner that is granting the License.<br><br> "Legal Entity" shall mean the union of the acting entity and all<br> other entities that control, are controlled by, or are under common<br> control with that entity. For the purposes of this definition,<br> "control" means (i) the power, direct or indirect, to cause the<br> direction or management of such entity, whether by contract or<br> otherwise, or (ii) ownership of fifty percent (50%) or more of the<br> outstanding shares, or (iii) beneficial ownership of such entity.<br><br> "You" (or "Your") shall mean an individual or Legal Entity<br> exercising permissions granted by this License.<br><br> "Source" form shall mean the preferred form for making modifications,<br> including but not limited to software source code, documentation<br> source, and configuration files.<br><br> "Object" form shall mean any form resulting from mechanical<br> transformation or translation of a Source form, including but<br> not limited to compiled object code, generated documentation,<br> and conversions to other media types.<br><br> "Work" shall mean the work of authorship, whether in Source or<br> Object form, made available under the License, as indicated by a<br> copyright notice that is included in or attached to the work<br> (an example is provided in the Appendix below).<br><br> "Derivative Works" shall mean any work, whether in Source or Object<br> form, that is based on (or derived from) the Work and for which the<br> editorial revisions, annotations, elaborations, or other modifications<br> represent, as a whole, an original work of authorship. For the purposes<br> of this License, Derivative Works shall not include works that remain<br> separable from, or merely link (or bind by name) to the interfaces of,<br> the Work and Derivative Works thereof.<br><br> "Contribution" shall mean any work of authorship, including<br> the original version of the Work and any modifications or additions<br> to that Work or Derivative Works thereof, that is intentionally<br> submitted to Licensor for inclusion in the Work by the copyright owner<br> or by an individual or Legal Entity authorized to submit on behalf of<br> the copyright owner. For the purposes of this definition, "submitted"<br> means any form of electronic, verbal, or written communication sent<br> to the Licensor or its representatives, including but not limited to<br> communication on electronic mailing lists, source code control systems,<br> and issue tracking systems that are managed by, or on behalf of, the<br> Licensor for the purpose of discussing and improving the Work, but<br> excluding communication that is conspicuously marked or otherwise<br> designated in writing by the copyright owner as "Not a Contribution."<br><br> "Contributor" shall mean Licensor and any individual or Legal Entity<br> on behalf of whom a Contribution has been received by Licensor and<br> subsequently incorporated within the Work.<br><br> 2. Grant of Copyright License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> copyright license to reproduce, prepare Derivative Works of,<br> publicly display, publicly perform, sublicense, and distribute the<br> Work and such Derivative Works in Source or Object form.<br><br> 3. Grant of Patent License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> (except as stated in this section) patent license to make, have made,<br> use, offer to sell, sell, import, and otherwise transfer the Work,<br> where such license applies only to those patent claims licensable<br> by such Contributor that are necessarily infringed by their<br> Contribution(s) alone or by combination of their Contribution(s)<br> with the Work to which such Contribution(s) was submitted. If You<br> institute patent litigation against any entity (including a<br> cross-claim or counterclaim in a lawsuit) alleging that the Work<br> or a Contribution incorporated within the Work constitutes direct<br> or contributory patent infringement, then any patent licenses<br> granted to You under this License for that Work shall terminate<br> as of the date such litigation is filed.<br><br> 4. Redistribution. You may reproduce and distribute copies of the<br> Work or Derivative Works thereof in any medium, with or without<br> modifications, and in Source or Object form, provided that You<br> meet the following conditions:<br><br> (a) You must give any other recipients of the Work or<br> Derivative Works a copy of this License; and<br><br> (b) You must cause any modified files to carry prominent notices<br> stating that You changed the files; and<br><br> (c) You must retain, in the Source form of any Derivative Works<br> that You distribute, all copyright, patent, trademark, and<br> attribution notices from the Source form of the Work,<br> excluding those notices that do not pertain to any part of<br> the Derivative Works; and<br><br> (d) If the Work includes a "NOTICE" text file as part of its<br> distribution, then any Derivative Works that You distribute must<br> include a readable copy of the attribution notices contained<br> within such NOTICE file, excluding those notices that do not<br> pertain to any part of the Derivative Works, in at least one<br> of the following places: within a NOTICE text file distributed<br> as part of the Derivative Works; within the Source form or<br> documentation, if provided along with the Derivative Works; or,<br> within a display generated by the Derivative Works, if and<br> wherever such third-party notices normally appear. The contents<br> of the NOTICE file are for informational purposes only and<br> do not modify the License. You may add Your own attribution<br> notices within Derivative Works that You distribute, alongside<br> or as an addendum to the NOTICE text from the Work, provided<br> that such additional attribution notices cannot be construed<br> as modifying the License.<br><br> You may add Your own copyright statement to Your modifications and<br> may provide additional or different license terms and conditions<br> for use, reproduction, or distribution of Your modifications, or<br> for any such Derivative Works as a whole, provided Your use,<br> reproduction, and distribution of the Work otherwise complies with<br> the conditions stated in this License.<br><br> 5. Submission of Contributions. Unless You explicitly state otherwise,<br> any Contribution intentionally submitted for inclusion in the Work<br> by You to the Licensor shall be under the terms and conditions of<br> this License, without any additional terms or conditions.<br> Notwithstanding the above, nothing herein shall supersede or modify<br> the terms of any separate license agreement you may have executed<br> with Licensor regarding such Contributions.<br><br> 6. Trademarks. This License does not grant permission to use the trade<br> names, trademarks, service marks, or product names of the Licensor,<br> except as required for reasonable and customary use in describing the<br> origin of the Work and reproducing the content of the NOTICE file.<br><br> 7. Disclaimer of Warranty. Unless required by applicable law or<br> agreed to in writing, Licensor provides the Work (and each<br> Contributor provides its Contributions) on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or<br> implied, including, without limitation, any warranties or conditions<br> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A<br> PARTICULAR PURPOSE. You are solely responsible for determining the<br> appropriateness of using or redistributing the Work and assume any<br> risks associated with Your exercise of permissions under this License.<br><br> 8. Limitation of Liability. In no event and under no legal theory,<br> whether in tort (including negligence), contract, or otherwise,<br> unless required by applicable law (such as deliberate and grossly<br> negligent acts) or agreed to in writing, shall any Contributor be<br> liable to You for damages, including any direct, indirect, special,<br> incidental, or consequential damages of any character arising as a<br> result of this License or out of the use or inability to use the<br> Work (including but not limited to damages for loss of goodwill,<br> work stoppage, computer failure or malfunction, or any and all<br> other commercial damages or losses), even if such Contributor<br> has been advised of the possibility of such damages.<br><br> 9. Accepting Warranty or Additional Liability. While redistributing<br> the Work or Derivative Works thereof, You may choose to offer,<br> and charge a fee for, acceptance of support, warranty, indemnity,<br> or other liability obligations and/or rights consistent with this<br> License. However, in accepting such obligations, You may act only<br> on Your own behalf and on Your sole responsibility, not on behalf<br> of any other Contributor, and only if You agree to indemnify,<br> defend, and hold each Contributor harmless for any liability<br> incurred by, or claims asserted against, such Contributor by reason<br> of your accepting any such warranty or additional liability.<br><br> END OF TERMS AND CONDITIONS<br><br> APPENDIX: How to apply the Apache License to your work.<br><br> To apply the Apache License to your work, attach the following<br> boilerplate notice, with the fields enclosed by brackets "[]"<br> replaced with your own identifying information. (Don't include<br> the brackets!) The text should be enclosed in the appropriate<br> comment syntax for the file format. We also recommend that a<br> file or class name and description of purpose be included on the<br> same "printed page" as the copyright notice for easier<br> identification within third-party archives.<br><br> Copyright [yyyy] [name of copyright owner]<br><br> Licensed under the Apache License, Version 2.0 (the "License");<br> you may not use this file except in compliance with the License.<br> You may obtain a copy of the License at<br><br> http://www.apache.org/licenses/LICENSE-2.0<br><br> Unless required by applicable law or agreed to in writing, software<br> distributed under the License is distributed on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> See the License for the specific language governing permissions and<br> limitations under the License.<br><br></pre>
+<hr style="width: 100%; height: 2px;">The following software may be
+included in this product: Jakarta Commons Lang 2.1; Use of any of this
+software is governed by the terms of the license below:<br>
+<h2><a class="mozTocH2" name="mozTocId478594"></a>The Apache Software
+Foundation<br>
+</h2>
+<h3><a class="mozTocH3" name="mozTocId789223"></a>Commons Lang<br>
+</h3>
+<pre> Apache License<br> Version 2.0, January 2004<br> http://www.apache.org/licenses/<br><br> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<br><br> 1. Definitions.<br><br> "License" shall mean the terms and conditions for use, reproduction,<br> and distribution as defined by Sections 1 through 9 of this document.<br><br> "Licensor" shall mean the copyright owner or entity authorized by<br> the copyright owner that is granting the License.<br><br> "Legal Entity" shall mean the union of the acting entity and all<br> other entities that control, are controlled by, or are under common<br> control with that entity. For the purposes of this definition,<br> "control" means (i) the power, direct or indirect, to cause the<br> direction or management of such entity, whether by contract or<br> otherwise, or (ii) ownership of fifty percent (50%) or more of the<br> outstanding shares, or (iii) beneficial ownership of such entity.<br><br> "You" (or "Your") shall mean an individual or Legal Entity<br> exercising permissions granted by this License.<br><br> "Source" form shall mean the preferred form for making modifications,<br> including but not limited to software source code, documentation<br> source, and configuration files.<br><br> "Object" form shall mean any form resulting from mechanical<br> transformation or translation of a Source form, including but<br> not limited to compiled object code, generated documentation,<br> and conversions to other media types.<br><br> "Work" shall mean the work of authorship, whether in Source or<br> Object form, made available under the License, as indicated by a<br> copyright notice that is included in or attached to the work<br> (an example is provided in the Appendix below).<br><br> "Derivative Works" shall mean any work, whether in Source or Object<br> form, that is based on (or derived from) the Work and for which the<br> editorial revisions, annotations, elaborations, or other modifications<br> represent, as a whole, an original work of authorship. For the purposes<br> of this License, Derivative Works shall not include works that remain<br> separable from, or merely link (or bind by name) to the interfaces of,<br> the Work and Derivative Works thereof.<br><br> "Contribution" shall mean any work of authorship, including<br> the original version of the Work and any modifications or additions<br> to that Work or Derivative Works thereof, that is intentionally<br> submitted to Licensor for inclusion in the Work by the copyright owner<br> or by an individual or Legal Entity authorized to submit on behalf of<br> the copyright owner. For the purposes of this definition, "submitted"<br> means any form of electronic, verbal, or written communication sent<br> to the Licensor or its representatives, including but not limited to<br> communication on electronic mailing lists, source code control systems,<br> and issue tracking systems that are managed by, or on behalf of, the<br> Licensor for the purpose of discussing and improving the Work, but<br> excluding communication that is conspicuously marked or otherwise<br> designated in writing by the copyright owner as "Not a Contribution."<br><br> "Contributor" shall mean Licensor and any individual or Legal Entity<br> on behalf of whom a Contribution has been received by Licensor and<br> subsequently incorporated within the Work.<br><br> 2. Grant of Copyright License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> copyright license to reproduce, prepare Derivative Works of,<br> publicly display, publicly perform, sublicense, and distribute the<br> Work and such Derivative Works in Source or Object form.<br><br> 3. Grant of Patent License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> (except as stated in this section) patent license to make, have made,<br> use, offer to sell, sell, import, and otherwise transfer the Work,<br> where such license applies only to those patent claims licensable<br> by such Contributor that are necessarily infringed by their<br> Contribution(s) alone or by combination of their Contribution(s)<br> with the Work to which such Contribution(s) was submitted. If You<br> institute patent litigation against any entity (including a<br> cross-claim or counterclaim in a lawsuit) alleging that the Work<br> or a Contribution incorporated within the Work constitutes direct<br> or contributory patent infringement, then any patent licenses<br> granted to You under this License for that Work shall terminate<br> as of the date such litigation is filed.<br><br> 4. Redistribution. You may reproduce and distribute copies of the<br> Work or Derivative Works thereof in any medium, with or without<br> modifications, and in Source or Object form, provided that You<br> meet the following conditions:<br><br> (a) You must give any other recipients of the Work or<br> Derivative Works a copy of this License; and<br><br> (b) You must cause any modified files to carry prominent notices<br> stating that You changed the files; and<br><br> (c) You must retain, in the Source form of any Derivative Works<br> that You distribute, all copyright, patent, trademark, and<br> attribution notices from the Source form of the Work,<br> excluding those notices that do not pertain to any part of<br> the Derivative Works; and<br><br> (d) If the Work includes a "NOTICE" text file as part of its<br> distribution, then any Derivative Works that You distribute must<br> include a readable copy of the attribution notices contained<br> within such NOTICE file, excluding those notices that do not<br> pertain to any part of the Derivative Works, in at least one<br> of the following places: within a NOTICE text file distributed<br> as part of the Derivative Works; within the Source form or<br> documentation, if provided along with the Derivative Works; or,<br> within a display generated by the Derivative Works, if and<br> wherever such third-party notices normally appear. The contents<br> of the NOTICE file are for informational purposes only and<br> do not modify the License. You may add Your own attribution<br> notices within Derivative Works that You distribute, alongside<br> or as an addendum to the NOTICE text from the Work, provided<br> that such additional attribution notices cannot be construed<br> as modifying the License.<br><br> You may add Your own copyright statement to Your modifications and<br> may provide additional or different license terms and conditions<br> for use, reproduction, or distribution of Your modifications, or<br> for any such Derivative Works as a whole, provided Your use,<br> reproduction, and distribution of the Work otherwise complies with<br> the conditions stated in this License.<br><br> 5. Submission of Contributions. Unless You explicitly state otherwise,<br> any Contribution intentionally submitted for inclusion in the Work<br> by You to the Licensor shall be under the terms and conditions of<br> this License, without any additional terms or conditions.<br> Notwithstanding the above, nothing herein shall supersede or modify<br> the terms of any separate license agreement you may have executed<br> with Licensor regarding such Contributions.<br><br> 6. Trademarks. This License does not grant permission to use the trade<br> names, trademarks, service marks, or product names of the Licensor,<br> except as required for reasonable and customary use in describing the<br> origin of the Work and reproducing the content of the NOTICE file.<br><br> 7. Disclaimer of Warranty. Unless required by applicable law or<br> agreed to in writing, Licensor provides the Work (and each<br> Contributor provides its Contributions) on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or<br> implied, including, without limitation, any warranties or conditions<br> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A<br> PARTICULAR PURPOSE. You are solely responsible for determining the<br> appropriateness of using or redistributing the Work and assume any<br> risks associated with Your exercise of permissions under this License.<br><br> 8. Limitation of Liability. In no event and under no legal theory,<br> whether in tort (including negligence), contract, or otherwise,<br> unless required by applicable law (such as deliberate and grossly<br> negligent acts) or agreed to in writing, shall any Contributor be<br> liable to You for damages, including any direct, indirect, special,<br> incidental, or consequential damages of any character arising as a<br> result of this License or out of the use or inability to use the<br> Work (including but not limited to damages for loss of goodwill,<br> work stoppage, computer failure or malfunction, or any and all<br> other commercial damages or losses), even if such Contributor<br> has been advised of the possibility of such damages.<br><br> 9. Accepting Warranty or Additional Liability. While redistributing<br> the Work or Derivative Works thereof, You may choose to offer,<br> and charge a fee for, acceptance of support, warranty, indemnity,<br> or other liability obligations and/or rights consistent with this<br> License. However, in accepting such obligations, You may act only<br> on Your own behalf and on Your sole responsibility, not on behalf<br> of any other Contributor, and only if You agree to indemnify,<br> defend, and hold each Contributor harmless for any liability<br> incurred by, or claims asserted against, such Contributor by reason<br> of your accepting any such warranty or additional liability.<br><br> END OF TERMS AND CONDITIONS<br><br> APPENDIX: How to apply the Apache License to your work.<br><br> To apply the Apache License to your work, attach the following<br> boilerplate notice, with the fields enclosed by brackets "[]"<br> replaced with your own identifying information. (Don't include<br> the brackets!) The text should be enclosed in the appropriate<br> comment syntax for the file format. We also recommend that a<br> file or class name and description of purpose be included on the<br> same "printed page" as the copyright notice for easier<br> identification within third-party archives.<br><br> Copyright [yyyy] [name of copyright owner]<br><br> Licensed under the Apache License, Version 2.0 (the "License");<br> you may not use this file except in compliance with the License.<br> You may obtain a copy of the License at<br><br> http://www.apache.org/licenses/LICENSE-2.0<br><br> Unless required by applicable law or agreed to in writing, software<br> distributed under the License is distributed on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> See the License for the specific language governing permissions and<br> limitations under the License.<br><br></pre>
+<hr style="width: 100%; height: 2px;">The following software may be
+included in this product: Jakarta Commons Codec; Use of any of this
+software is governed by the terms of the license below:<br>
+<h2><a class="mozTocH2" name="mozTocId877758"></a>The Apache Software
+Foundation<br>
+</h2>
+<h3><a class="mozTocH3" name="mozTocId959568"></a>Commons Logging<br>
+</h3>
+<pre> Apache License<br> Version 2.0, January 2004<br> http://www.apache.org/licenses/<br><br> TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION<br><br> 1. Definitions.<br><br> "License" shall mean the terms and conditions for use, reproduction,<br> and distribution as defined by Sections 1 through 9 of this document.<br><br> "Licensor" shall mean the copyright owner or entity authorized by<br> the copyright owner that is granting the License.<br><br> "Legal Entity" shall mean the union of the acting entity and all<br> other entities that control, are controlled by, or are under common<br> control with that entity. For the purposes of this definition,<br> "control" means (i) the power, direct or indirect, to cause the<br> direction or management of such entity, whether by contract or<br> otherwise, or (ii) ownership of fifty percent (50%) or more of the<br> outstanding shares, or (iii) beneficial ownership of such entity.<br><br> "You" (or "Your") shall mean an individual or Legal Entity<br> exercising permissions granted by this License.<br><br> "Source" form shall mean the preferred form for making modifications,<br> including but not limited to software source code, documentation<br> source, and configuration files.<br><br> "Object" form shall mean any form resulting from mechanical<br> transformation or translation of a Source form, including but<br> not limited to compiled object code, generated documentation,<br> and conversions to other media types.<br><br> "Work" shall mean the work of authorship, whether in Source or<br> Object form, made available under the License, as indicated by a<br> copyright notice that is included in or attached to the work<br> (an example is provided in the Appendix below).<br><br> "Derivative Works" shall mean any work, whether in Source or Object<br> form, that is based on (or derived from) the Work and for which the<br> editorial revisions, annotations, elaborations, or other modifications<br> represent, as a whole, an original work of authorship. For the purposes<br> of this License, Derivative Works shall not include works that remain<br> separable from, or merely link (or bind by name) to the interfaces of,<br> the Work and Derivative Works thereof.<br><br> "Contribution" shall mean any work of authorship, including<br> the original version of the Work and any modifications or additions<br> to that Work or Derivative Works thereof, that is intentionally<br> submitted to Licensor for inclusion in the Work by the copyright owner<br> or by an individual or Legal Entity authorized to submit on behalf of<br> the copyright owner. For the purposes of this definition, "submitted"<br> means any form of electronic, verbal, or written communication sent<br> to the Licensor or its representatives, including but not limited to<br> communication on electronic mailing lists, source code control systems,<br> and issue tracking systems that are managed by, or on behalf of, the<br> Licensor for the purpose of discussing and improving the Work, but<br> excluding communication that is conspicuously marked or otherwise<br> designated in writing by the copyright owner as "Not a Contribution."<br><br> "Contributor" shall mean Licensor and any individual or Legal Entity<br> on behalf of whom a Contribution has been received by Licensor and<br> subsequently incorporated within the Work.<br><br> 2. Grant of Copyright License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> copyright license to reproduce, prepare Derivative Works of,<br> publicly display, publicly perform, sublicense, and distribute the<br> Work and such Derivative Works in Source or Object form.<br><br> 3. Grant of Patent License. Subject to the terms and conditions of<br> this License, each Contributor hereby grants to You a perpetual,<br> worldwide, non-exclusive, no-charge, royalty-free, irrevocable<br> (except as stated in this section) patent license to make, have made,<br> use, offer to sell, sell, import, and otherwise transfer the Work,<br> where such license applies only to those patent claims licensable<br> by such Contributor that are necessarily infringed by their<br> Contribution(s) alone or by combination of their Contribution(s)<br> with the Work to which such Contribution(s) was submitted. If You<br> institute patent litigation against any entity (including a<br> cross-claim or counterclaim in a lawsuit) alleging that the Work<br> or a Contribution incorporated within the Work constitutes direct<br> or contributory patent infringement, then any patent licenses<br> granted to You under this License for that Work shall terminate<br> as of the date such litigation is filed.<br><br> 4. Redistribution. You may reproduce and distribute copies of the<br> Work or Derivative Works thereof in any medium, with or without<br> modifications, and in Source or Object form, provided that You<br> meet the following conditions:<br><br> (a) You must give any other recipients of the Work or<br> Derivative Works a copy of this License; and<br><br> (b) You must cause any modified files to carry prominent notices<br> stating that You changed the files; and<br><br> (c) You must retain, in the Source form of any Derivative Works<br> that You distribute, all copyright, patent, trademark, and<br> attribution notices from the Source form of the Work,<br> excluding those notices that do not pertain to any part of<br> the Derivative Works; and<br><br> (d) If the Work includes a "NOTICE" text file as part of its<br> distribution, then any Derivative Works that You distribute must<br> include a readable copy of the attribution notices contained<br> within such NOTICE file, excluding those notices that do not<br> pertain to any part of the Derivative Works, in at least one<br> of the following places: within a NOTICE text file distributed<br> as part of the Derivative Works; within the Source form or<br> documentation, if provided along with the Derivative Works; or,<br> within a display generated by the Derivative Works, if and<br> wherever such third-party notices normally appear. The contents<br> of the NOTICE file are for informational purposes only and<br> do not modify the License. You may add Your own attribution<br> notices within Derivative Works that You distribute, alongside<br> or as an addendum to the NOTICE text from the Work, provided<br> that such additional attribution notices cannot be construed<br> as modifying the License.<br><br> You may add Your own copyright statement to Your modifications and<br> may provide additional or different license terms and conditions<br> for use, reproduction, or distribution of Your modifications, or<br> for any such Derivative Works as a whole, provided Your use,<br> reproduction, and distribution of the Work otherwise complies with<br> the conditions stated in this License.<br><br> 5. Submission of Contributions. Unless You explicitly state otherwise,<br> any Contribution intentionally submitted for inclusion in the Work<br> by You to the Licensor shall be under the terms and conditions of<br> this License, without any additional terms or conditions.<br> Notwithstanding the above, nothing herein shall supersede or modify<br> the terms of any separate license agreement you may have executed<br> with Licensor regarding such Contributions.<br><br> 6. Trademarks. This License does not grant permission to use the trade<br> names, trademarks, service marks, or product names of the Licensor,<br> except as required for reasonable and customary use in describing the<br> origin of the Work and reproducing the content of the NOTICE file.<br><br> 7. Disclaimer of Warranty. Unless required by applicable law or<br> agreed to in writing, Licensor provides the Work (and each<br> Contributor provides its Contributions) on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or<br> implied, including, without limitation, any warranties or conditions<br> of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A<br> PARTICULAR PURPOSE. You are solely responsible for determining the<br> appropriateness of using or redistributing the Work and assume any<br> risks associated with Your exercise of permissions under this License.<br><br> 8. Limitation of Liability. In no event and under no legal theory,<br> whether in tort (including negligence), contract, or otherwise,<br> unless required by applicable law (such as deliberate and grossly<br> negligent acts) or agreed to in writing, shall any Contributor be<br> liable to You for damages, including any direct, indirect, special,<br> incidental, or consequential damages of any character arising as a<br> result of this License or out of the use or inability to use the<br> Work (including but not limited to damages for loss of goodwill,<br> work stoppage, computer failure or malfunction, or any and all<br> other commercial damages or losses), even if such Contributor<br> has been advised of the possibility of such damages.<br><br> 9. Accepting Warranty or Additional Liability. While redistributing<br> the Work or Derivative Works thereof, You may choose to offer,<br> and charge a fee for, acceptance of support, warranty, indemnity,<br> or other liability obligations and/or rights consistent with this<br> License. However, in accepting such obligations, You may act only<br> on Your own behalf and on Your sole responsibility, not on behalf<br> of any other Contributor, and only if You agree to indemnify,<br> defend, and hold each Contributor harmless for any liability<br> incurred by, or claims asserted against, such Contributor by reason<br> of your accepting any such warranty or additional liability.<br><br> END OF TERMS AND CONDITIONS<br><br> APPENDIX: How to apply the Apache License to your work.<br><br> To apply the Apache License to your work, attach the following<br> boilerplate notice, with the fields enclosed by brackets "[]"<br> replaced with your own identifying information. (Don't include<br> the brackets!) The text should be enclosed in the appropriate<br> comment syntax for the file format. We also recommend that a<br> file or class name and description of purpose be included on the<br> same "printed page" as the copyright notice for easier<br> identification within third-party archives.<br><br> Copyright [yyyy] [name of copyright owner]<br><br> Licensed under the Apache License, Version 2.0 (the "License");<br> you may not use this file except in compliance with the License.<br> You may obtain a copy of the License at<br><br> http://www.apache.org/licenses/LICENSE-2.0<br><br> Unless required by applicable law or agreed to in writing, software<br> distributed under the License is distributed on an "AS IS" BASIS,<br> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br> See the License for the specific language governing permissions and<br> limitations under the License.<br><br></pre>
+<hr style="width: 100%; height: 2px;">The following software may be
+included in this product: Tomcat 4.0 or higher; Use of any of this
+software is governed by the terms of the license below:<br>
+<h2><a class="mozTocH2" name="mozTocId3503"></a>The Apache Software
+Foundation<br>
+</h2>
+<h3><a class="mozTocH3" name="mozTocId520856"></a>Tomcat<br>
+</h3>
+<br>
+The Apache Software License, Version 1.1
+<br>
+<br>
+Copyright (c) 2001 The Apache Software Foundation. All rights
+reserved.
+<br>
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+<br>
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer. <br>
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution. <br>
+3. The end-user documentation included with the redistribution, if any,
+must include the following acknowledgment: "This product includes
+software developed by the Apache Software Foundation
+(http://www.apache.org/)." Alternately, this acknowledgment may appear
+in the software itself, if and wherever such third-party
+acknowledgments normally appear. <br>
+4. The names "XML-RPC" and "Apache Software Foundation" must not be
+used to endorse or promote products derived from this software without
+prior written permission. For written permission, please contact
+apache@apache.org. <br>
+5. Products derived from this software may not be called "Apache", nor
+may "Apache" appear in their name, without prior written permission of
+the Apache Software Foundation. <br>
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+<br>
+====================================================================
+<br>
+This software consists of voluntary contributions made by many
+individuals on behalf of the Apache Software Foundation. For more
+information on the Apache Software Foundation, please see
+<http:>.
+<br>
+</http:>
+<br>
+</body>
+</html>
diff --git a/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
new file mode 100644
index 000000000000..f91819c6bc2a
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/EditPageParser.java
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import javax.swing.text.html.*;
+import javax.swing.text.MutableAttributeSet;
+
+public class EditPageParser extends HTMLEditorKit.ParserCallback
+{
+
+ protected String m_sEditTime = "";
+ protected String m_sEditToken = "";
+ protected String m_sLoginToken = "";
+ protected String m_sMainURL = "";
+
+ private int m_nWikiArticleHash = 0;
+ private boolean m_bHTMLStartFound = false;
+ private boolean m_bInHead = false;
+
+ protected int m_nWikiArticleStart = -1;
+ protected int m_nWikiArticleEnd = -1;
+ protected int m_nHTMLArticleStart = -1;
+ protected int m_nHTMLArticleEnd = -1;
+ protected int m_nNoArticleInd = -1;
+ protected int m_nErrorInd = -1;
+
+ /** Creates a new instance of WikiHTMLParser */
+ public EditPageParser()
+ {
+ }
+
+ public void handleComment( char[] data,int pos )
+ {
+ // insert code to handle comments
+ }
+
+ public void handleEndTag( HTML.Tag t,int pos )
+ {
+ if ( t == HTML.Tag.TEXTAREA )
+ {
+ m_nWikiArticleEnd = pos;
+ }
+ else if ( t == HTML.Tag.DIV )
+ {
+ if ( m_bHTMLStartFound )
+ {
+ m_nHTMLArticleStart = pos+6;
+ m_bHTMLStartFound = false;
+ }
+ }
+ else if ( t == HTML.Tag.HEAD )
+ {
+ m_bInHead = false;
+ }
+ }
+
+ public void handleError( String errorMsg,int pos )
+ {
+ //System.out.println( errorMsg );
+ }
+
+ public void handleSimpleTag( HTML.Tag t, MutableAttributeSet a,int pos )
+ {
+ // insert code to handle simple tags
+
+ if ( t == HTML.Tag.INPUT )
+ {
+ String sName = ( String ) a.getAttribute( HTML.Attribute.NAME );
+ if ( sName != null )
+ {
+ if ( sName.equalsIgnoreCase( "wpEdittime" ) )
+ {
+ this.m_sEditTime = ( String ) a.getAttribute( HTML.Attribute.VALUE );
+ }
+ else if ( sName.equalsIgnoreCase( "wpEditToken" ) )
+ {
+ this.m_sEditToken = ( String ) a.getAttribute( HTML.Attribute.VALUE );
+ }
+ else if ( sName.equalsIgnoreCase( "wpLoginToken" ) )
+ {
+ this.m_sLoginToken = ( String ) a.getAttribute( HTML.Attribute.VALUE );
+ }
+ }
+
+ }
+ else if ( t == HTML.Tag.LINK )
+ {
+ if ( m_bInHead )
+ {
+ String sName = ( String ) a.getAttribute( HTML.Attribute.HREF );
+ if ( sName != null )
+ {
+ int nIndexStart = sName.indexOf( "index.php" );
+ // get the main URL from the first header-link with index.php
+ // the link with "action=edit" inside is preferable
+ if ( nIndexStart>= 0
+ && ( m_sMainURL.length() == 0 || sName.indexOf( "action=edit" ) >= 0 ) )
+ {
+ m_sMainURL = sName.substring( 0, nIndexStart );
+ }
+ }
+ }
+ }
+
+ }
+
+ public void handleStartTag( HTML.Tag t, MutableAttributeSet a,int pos )
+ {
+ // insert code to handle starting tags
+ String sName = "";
+ String sId = "";
+ String sClass = "";
+
+ if ( t == HTML.Tag.HEAD )
+ {
+ m_bInHead = true;
+ }
+ if ( t == HTML.Tag.TEXTAREA )
+ {
+ sName = ( String ) a.getAttribute( HTML.Attribute.NAME );
+ if ( sName != null )
+ {
+ if ( sName.equalsIgnoreCase( "wpTextbox1" ) )
+ {
+ m_nWikiArticleHash = t.hashCode();
+ m_nWikiArticleStart = pos;
+ }
+ }
+ }
+ else if ( t == HTML.Tag.DIV )
+ {
+ sId = ( String ) a.getAttribute( HTML.Attribute.ID );
+ sClass = ( String ) a.getAttribute( HTML.Attribute.CLASS );
+ if ( sId != null )
+ {
+ if ( sId.equalsIgnoreCase( "contentSub" ) )
+ {
+ m_bHTMLStartFound = true;
+ }
+ }
+ if ( sClass != null )
+ {
+ if ( sClass.equalsIgnoreCase( "printfooter" ) )
+ {
+ m_nHTMLArticleEnd = pos;
+ }
+ else if ( sClass.equalsIgnoreCase( "noarticletext" ) )
+ {
+ m_nNoArticleInd = pos;
+ }
+ else if ( sClass.equalsIgnoreCase( "errorbox" ) )
+ {
+ m_nErrorInd = pos;
+ }
+ }
+ }
+ else if ( t == HTML.Tag.P )
+ {
+ sClass = ( String ) a.getAttribute( HTML.Attribute.CLASS );
+ if ( sClass != null && sClass.equalsIgnoreCase( "error" ) )
+ {
+ m_nErrorInd = pos;
+ }
+ }
+ }
+
+
+}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
new file mode 100644
index 000000000000..7ecd9ecb0e7c
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java
@@ -0,0 +1,1153 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.MessageBoxButtons;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XMessageBox;
+import com.sun.star.awt.XMessageBoxFactory;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.NamedValue;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XContainerQuery;
+import com.sun.star.container.XEnumeration;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.document.XDocumentInfoSupplier;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XModuleManager;
+import com.sun.star.io.XInputStream;
+import com.sun.star.io.XOutputStream;
+import com.sun.star.io.XSeekable;
+import com.sun.star.io.XStream;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+import com.sun.star.system.SystemShellExecuteFlags;
+import com.sun.star.system.XSystemShellExecute;
+import com.sun.star.task.UrlRecord;
+import com.sun.star.task.XInteractionHandler;
+import com.sun.star.task.XMasterPasswordHandling;
+import com.sun.star.task.XPasswordContainer;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.XChangesBatch;
+import java.net.*;
+import java.io.*;
+import java.util.Hashtable;
+import java.util.Random;
+import javax.net.ssl.SSLException;
+import javax.swing.text.html.HTMLEditorKit;
+
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HostConfiguration;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.cookie.CookiePolicy;
+import org.apache.commons.httpclient.MultiThreadedHttpConnectionManager;
+import org.apache.commons.httpclient.protocol.Protocol;
+import org.apache.commons.httpclient.URI;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.PostMethod;
+
+public class Helper
+{
+ public final static int GENERALSEND_ERROR = 0;
+ public final static int NOWIKIFILTER_ERROR = 1;
+ public final static int NOURLCONNECTION_ERROR = 2;
+ public final static int WRONGLOGIN_ERROR = 3;
+ public final static int INVALIDURL_ERROR = 4;
+ public final static int NOURL_ERROR = 5;
+
+ public final static int DLG_SENDTITLE = 6;
+ public final static int DLG_WIKIARTICLE = 7;
+ public final static int DLG_NO = 8;
+ public final static int DLG_OK = 9;
+ public final static int DLG_YES = 10;
+ // 11 is reserved
+ public final static int DLG_ADDBUTTON = 12;
+ public final static int DLG_EDITBUTTON = 13;
+ public final static int DLG_SENDBUTTON = 14;
+ public final static int DLG_REMOVEBUTTON = 15;
+
+ public final static int DLG_EDITSETTING_URLLABEL = 16;
+ public final static int DLG_EDITSETTING_USERNAMELABEL = 17;
+ public final static int DLG_EDITSETTING_PASSWORDLABEL = 18;
+ public final static int DLG_NEWWIKIPAGE_LABEL1 = 19;
+ public final static int DLG_SENDTOMEDIAWIKI_LABEL1 = 20;
+ public final static int DLG_SENDTOMEDIAWIKI_LABEL2 = 21;
+ public final static int DLG_SENDTOMEDIAWIKI_LABEL3 = 22;
+ public final static int DLG_SENDTOMEDIAWIKI_MINORCHECK = 23;
+ public final static int DLG_SENDTOMEDIAWIKI_BROWSERCHECK = 24;
+ public final static int UNKNOWNCERT_ERROR = 25;
+ public final static int DLG_MEDIAWIKI_TITLE = 26;
+ public final static int DLG_EDITSETTING_ACCOUNTLINE = 27;
+ public final static int DLG_EDITSETTING_WIKILINE = 28;
+ public final static int DLG_EDITSETTING_SAVEBOX = 29;
+ public final static int CANCELSENDING_ERROR = 30;
+ public final static int DLG_MEDIAWIKIEXTENSION_STRING = 31;
+ public final static int DLG_WIKIPAGEEXISTS_LABEL1 = 32;
+
+ public final static int STRINGS_NUM = 33;
+
+ private final static String[] m_pEntryNames = { "GeneralSendError",
+ "NoWikiFilter",
+ "NoConnectionToURL",
+ "WrongLogin",
+ "InvalidURL",
+ "NoURL",
+ "Dlg_SendTitle",
+ "Dlg_WikiArticle",
+ "Dlg_No",
+ "Dlg_OK",
+ "Dlg_Yes",
+ null, // reserved
+ "Dlg_AddButton",
+ "Dlg_EditButton",
+ "Dlg_SendButton",
+ "Dlg_RemoveButton",
+ "Dlg_EditSetting_UrlLabel",
+ "Dlg_EditSetting_UsernameLabel",
+ "Dlg_EditSetting_PasswordLabel",
+ "Dlg_NewWikiPage_Label1",
+ "Dlg_SendToMediaWiki_Label1",
+ "Dlg_SendToMediaWiki_Label2",
+ "Dlg_SendToMediaWiki_Label3",
+ "Dlg_SendToMediaWiki_MinorCheck",
+ "Dlg_SendToMediaWiki_BrowserCheck",
+ "UnknownCert",
+ "Dlg_MediaWiki_Title",
+ "Dlg_EditSetting_AccountLine",
+ "Dlg_EditSetting_WikiLine",
+ "Dlg_EditSetting_SaveBox",
+ "CancelSending",
+ "Dlg_MediaWiki_Extension_String",
+ "Dlg_WikiPageExists_Label1" };
+
+ private static String[] m_pConfigStrings;
+
+ private static final String sHTMLHeader = "<HTML><HEAD><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><TITLE></TITLE></HEAD><BODY>";
+ private static final String sHTMLFooter = "</BODY></HTML>";
+
+ private static Random m_aRandom;
+ private static MultiThreadedHttpConnectionManager m_aConnectionManager;
+ private static HttpClient m_aClient;
+ private static boolean m_bAllowConnection = true;
+ private static Hashtable m_aAcceptedUnknownCerts;
+
+ private static Boolean m_bShowInBrowser = null;
+
+ private static XPasswordContainer m_xPasswordContainer;
+ private static XInteractionHandler m_xInteractionHandler;
+
+ synchronized protected static String GetLocalizedString( XComponentContext xContext, int nID )
+ throws com.sun.star.uno.Exception
+ {
+ if ( nID >= STRINGS_NUM )
+ throw new com.sun.star.uno.RuntimeException();
+
+ if ( m_pConfigStrings == null )
+ {
+ XNameAccess xNameAccess = GetConfigNameAccess( xContext, "org.openoffice.Office.Custom.WikiExtension/Strings" );
+
+ String[] pStrings = new String[STRINGS_NUM];
+ for ( int nInd = 0; nInd < STRINGS_NUM; nInd++ )
+ if ( m_pEntryNames[nInd] != null )
+ pStrings[nInd] = AnyConverter.toString( xNameAccess.getByName( m_pEntryNames[nInd] ) );
+ else
+ pStrings[nInd] = "";
+
+ m_pConfigStrings = pStrings;
+ }
+
+ return m_pConfigStrings[nID];
+ }
+
+ synchronized protected static HttpClient GetHttpClient()
+ throws WikiCancelException
+ {
+ if ( !m_bAllowConnection )
+ throw new WikiCancelException();
+
+ if ( m_aConnectionManager == null )
+ m_aConnectionManager = new MultiThreadedHttpConnectionManager();
+
+ if ( m_aClient == null )
+ {
+ m_aClient = new HttpClient( m_aConnectionManager );
+ m_aClient.getParams().setParameter( "http.protocol.cookie-policy", CookiePolicy.BROWSER_COMPATIBILITY );
+ m_aClient.getParams().setParameter( "http.protocol.single-cookie-header", Boolean.TRUE );
+ m_aClient.getParams().setParameter( "http.protocol.content-charset", "UTF-8" );
+ }
+
+ return m_aClient;
+ }
+
+ synchronized protected static void AllowConnection( boolean bAllow )
+ {
+ m_bAllowConnection = bAllow;
+ if ( !bAllow && m_aConnectionManager != null )
+ {
+ m_aClient = null;
+ m_aConnectionManager.shutdown();
+ m_aConnectionManager = null;
+ }
+ }
+
+ synchronized protected static boolean IsConnectionAllowed()
+ {
+ return m_bAllowConnection;
+ }
+
+ synchronized protected static boolean GetShowInBrowserByDefault( XComponentContext xContext )
+ {
+ if ( m_bShowInBrowser == null )
+ {
+ try
+ {
+ XNameAccess xAccess = Helper.GetConfigNameAccess( xContext, "org.openoffice.Office.Custom.WikiExtension/Settings" );
+ m_bShowInBrowser = new Boolean( AnyConverter.toBoolean( xAccess.getByName( "PreselectShowBrowser" ) ) );
+ }
+ catch( com.sun.star.uno.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return m_bShowInBrowser.booleanValue();
+ }
+
+ synchronized protected static void SetShowInBrowserByDefault( XComponentContext xContext, boolean bValue )
+ {
+ try
+ {
+ m_bShowInBrowser = new Boolean( bValue );
+
+ XPropertySet xProps = Helper.GetConfigProps( xContext, "org.openoffice.Office.Custom.WikiExtension/Settings" );
+ xProps.setPropertyValue( "PreselectShowBrowser", new Boolean( bValue ) );
+ XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xProps );
+ if ( xBatch != null )
+ xBatch.commitChanges();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ synchronized protected static XPasswordContainer GetPasswordContainer( XComponentContext xContext )
+ throws com.sun.star.uno.Exception
+ {
+ if ( m_xPasswordContainer == null && xContext != null )
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory != null )
+ m_xPasswordContainer = (XPasswordContainer)UnoRuntime.queryInterface(
+ XPasswordContainer.class,
+ xFactory.createInstanceWithContext( "com.sun.star.task.PasswordContainer", xContext ) );
+ }
+
+ if ( m_xPasswordContainer == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return m_xPasswordContainer;
+ }
+
+ synchronized protected static XInteractionHandler GetInteractionHandler( XComponentContext xContext )
+ throws com.sun.star.uno.Exception
+ {
+ if ( m_xInteractionHandler == null && xContext != null )
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory != null )
+ m_xInteractionHandler = ( XInteractionHandler )UnoRuntime.queryInterface(
+ XInteractionHandler.class,
+ xFactory.createInstanceWithContext( "com.sun.star.task.InteractionHandler", xContext ) );
+ }
+
+ if ( m_xInteractionHandler == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return m_xInteractionHandler;
+ }
+
+ protected static Protocol GetOwnHttps( int nPort )
+ {
+ return new Protocol( "https", new WikiProtocolSocketFactory(), ( ( nPort < 0 ) ? 443 : nPort ) );
+ }
+
+ protected static String GetMainURL( String sWebPage, String sVURL )
+ {
+ String sResultURL = "";
+ try
+ {
+ StringReader aReader = new StringReader( sWebPage );
+ HTMLEditorKit.Parser aParser = GetHTMLParser();
+ EditPageParser aCallback = new EditPageParser();
+
+ aParser.parse( aReader, aCallback, true );
+ sResultURL = aCallback.m_sMainURL;
+
+ if ( !sResultURL.startsWith( "http" ) )
+ {
+ //if the url is only relative then complete it
+ URL aURL = new URL( sVURL );
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ if ( sResultURL.length() == 0 )
+ {
+ // usually that should not happen
+ // workaround: try to get index.php from the provided URL
+ int nIndex = sVURL.indexOf( "index.php" );
+ if ( nIndex >= 0 )
+ sResultURL = sVURL.substring( 0, nIndex );
+ }
+
+ return sResultURL;
+ }
+
+ protected static String GetRedirectURL( String sWebPage, String sURL )
+ {
+ //scrape the HTML source and find the EditURL
+ // TODO/LATER: Use parser in future
+
+ String sResultURL = "";
+ int nInd = sWebPage.indexOf( "http-equiv=\"refresh\"" );
+ if ( nInd != -1 )
+ {
+ int nContent = sWebPage.indexOf( "content=", nInd );
+ if ( nContent > 0 )
+ {
+ int nURL = sWebPage.indexOf( "URL=", nContent );
+ if ( nURL > 0 )
+ {
+ int nEndURL = sWebPage.indexOf( "\"", nURL );
+ if ( nEndURL > 0 )
+ sResultURL = sWebPage.substring( nURL + 4, nEndURL );
+ }
+ }
+
+ try
+ {
+ URL aURL = new URL( sURL );
+ if ( !sResultURL.startsWith( aURL.getProtocol() ))
+ {
+ //if the url is only relative then complete it
+ if ( sResultURL.startsWith( "/" ) )
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + sResultURL;
+ else
+ sResultURL = aURL.getProtocol() + "://" + aURL.getHost() + aURL.getPath() + sResultURL;
+ }
+ }
+ catch ( MalformedURLException ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ return sResultURL;
+
+ }
+
+ protected static XInputStream SaveHTMLTemp( XComponentContext xContext, String sArticle )
+ {
+ XInputStream xResult = null;
+
+ if ( xContext != null )
+ {
+ try
+ {
+ Object oTempFile = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.io.TempFile", xContext );
+ XStream xStream = ( XStream ) UnoRuntime.queryInterface( XStream.class, oTempFile );
+ XSeekable xSeekable = ( XSeekable ) UnoRuntime.queryInterface( XSeekable.class, oTempFile );
+ if ( xStream != null && xSeekable != null )
+ {
+ XOutputStream xOutputStream = xStream.getOutputStream();
+ XInputStream xInputStream = xStream.getInputStream();
+ if ( xOutputStream != null && xInputStream != null )
+ {
+ String sHTML = sHTMLHeader.concat( sArticle );
+ sHTML = sHTML.concat( sHTMLFooter );
+ xOutputStream.writeBytes( sHTML.getBytes( "UTF-8" ) );
+ // xOutputStream.closeOutput();
+ xSeekable.seek( 0 );
+
+ xResult = xInputStream;
+ }
+ }
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ return xResult;
+ }
+
+
+ protected static String CreateTempFile( XComponentContext xContext )
+ {
+ String sURL = "";
+ try
+ {
+ Object oTempFile = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.io.TempFile", xContext );
+ XPropertySet xPropertySet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, oTempFile );
+ xPropertySet.setPropertyValue( "RemoveFile", Boolean.FALSE );
+ sURL = ( String ) xPropertySet.getPropertyValue( "Uri" );
+
+ XInputStream xInputStream = ( XInputStream ) UnoRuntime.queryInterface( XInputStream.class, oTempFile );
+ xInputStream.closeInput();
+ XOutputStream xOutputStream = ( XOutputStream ) UnoRuntime.queryInterface( XOutputStream.class, oTempFile );
+ xOutputStream.closeOutput();
+ } catch ( com.sun.star.uno.Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ return sURL;
+ }
+
+ protected static String EachLine( String sURL )
+ {
+ String sText = "";
+ try
+ {
+ URL aURL = new URL( sURL );
+ File aFile = new File( aURL.getFile() );
+ InputStreamReader aInputReader = new InputStreamReader( new FileInputStream( aFile ), "UTF-8" );
+ BufferedReader aBufReader = new BufferedReader( aInputReader );
+
+ StringBuffer aBuf = new StringBuffer();
+ String sEachLine = aBufReader.readLine();
+
+ while( sEachLine != null )
+ {
+ aBuf.append( sEachLine );
+ aBuf.append( "\n" );
+
+ sEachLine = aBufReader.readLine();
+ }
+ sText = aBuf.toString();
+ } catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ return sText;
+ }
+
+ protected static String GetDocTitle( XModel xDoc )
+ {
+ String sTitle = "";
+ XDocumentInfoSupplier xDocInfoSup = ( XDocumentInfoSupplier ) UnoRuntime.queryInterface( XDocumentInfoSupplier.class, xDoc );
+ XPropertySet xPropSet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xDocInfoSup.getDocumentInfo() );
+ try
+ {
+ sTitle = ( String ) xPropSet.getPropertyValue( "Title" );
+ } catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ return sTitle;
+ }
+
+ protected static void SetDocTitle( XModel xDoc, String sTitle )
+ {
+ XDocumentInfoSupplier xDocInfoSup = ( XDocumentInfoSupplier ) UnoRuntime.queryInterface( XDocumentInfoSupplier.class, xDoc );
+ if ( xDocInfoSup != null )
+ {
+ XPropertySet xPropSet = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xDocInfoSup.getDocumentInfo() );
+ if ( xPropSet != null )
+ {
+ try
+ {
+ xPropSet.setPropertyValue( "Title", sTitle );
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ protected static String GetDocServiceName( XComponentContext xContext, XModel xModel )
+ {
+ String aDocServiceName = "";
+ if ( xModel != null && xContext != null )
+ {
+ try
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ Object oModuleManager = xFactory.createInstanceWithContext( "com.sun.star.frame.ModuleManager", xContext );
+ XModuleManager xModuleManager = ( XModuleManager ) UnoRuntime.queryInterface( XModuleManager.class, oModuleManager );
+ if ( xModuleManager != null )
+ aDocServiceName = xModuleManager.identify( xModel );
+ }
+ catch( java.lang.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return aDocServiceName;
+ }
+
+ protected static String GetFilterName( XComponentContext xContext, String aTypeName, String aDocServiceName )
+ {
+ String aFilterName = "";
+ if ( xContext != null && aTypeName != null && aTypeName.length() != 0
+ && aDocServiceName != null && aDocServiceName.length() != 0 )
+ {
+ try
+ {
+ Object oFilterFactory = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.document.FilterFactory", xContext );
+ XContainerQuery xQuery = ( XContainerQuery )UnoRuntime.queryInterface( XContainerQuery.class, oFilterFactory );
+ if ( xQuery != null )
+ {
+ NamedValue[] aRequest = new NamedValue[2];
+ aRequest[0] = new NamedValue( "Type", aTypeName );
+ aRequest[1] = new NamedValue( "DocumentService", aDocServiceName );
+
+ XEnumeration xSet = xQuery.createSubSetEnumerationByProperties( aRequest );
+ if ( xSet != null )
+ {
+ boolean bAcceptable = false;
+ while ( xSet.hasMoreElements() && !bAcceptable )
+ {
+ PropertyValue[] pFilterProps = ( PropertyValue[] )AnyConverter.toArray( xSet.nextElement() );
+ if ( pFilterProps != null )
+ {
+ int nLen = pFilterProps.length;
+ String aTmpFilter = null;
+
+ for ( int nInd = 0; nInd < nLen; nInd++ )
+ {
+ if ( pFilterProps[nInd].Name.equals( "Name" ) )
+ aTmpFilter = AnyConverter.toString( pFilterProps[nInd].Value );
+ else if ( pFilterProps[nInd].Name.equals( "Flags" ) )
+ bAcceptable = ( ( AnyConverter.toInt( pFilterProps[nInd].Value ) & 2 ) == 2 ); // must allow export
+ }
+
+ if ( bAcceptable )
+ aFilterName = aTmpFilter;
+ }
+ }
+ }
+ }
+ }
+ catch( java.lang.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return aFilterName;
+ }
+
+ protected static XMultiServiceFactory GetConfigurationProvider( XComponentContext xContext )
+ throws com.sun.star.uno.Exception
+ {
+ XMultiServiceFactory xConfigurationProvider = null;
+ if ( xContext != null )
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ Object oConfigProvider = xFactory.createInstanceWithContext( "com.sun.star.configuration.ConfigurationProvider", xContext );
+ xConfigurationProvider = ( XMultiServiceFactory ) UnoRuntime.queryInterface( XMultiServiceFactory.class, oConfigProvider );
+ }
+
+ if ( xConfigurationProvider == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return xConfigurationProvider;
+ }
+
+ protected static Object GetConfig( XComponentContext xContext, String sNodepath, boolean bWriteAccess )
+ throws com.sun.star.uno.Exception
+ {
+ if ( xContext == null || sNodepath == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ PropertyValue aVal = new PropertyValue();
+ aVal.Name = "nodepath";
+ aVal.Value = sNodepath;
+ Object[] aArgs = new Object[1];
+ aArgs[0] = aVal;
+
+ return GetConfigurationProvider( xContext ).createInstanceWithArguments(
+ ( bWriteAccess ? "com.sun.star.configuration.ConfigurationUpdateAccess"
+ : "com.sun.star.configuration.ConfigurationAccess" ),
+ aArgs );
+ }
+
+ protected static XPropertySet GetConfigProps( XComponentContext xContext, String sNodepath )
+ throws com.sun.star.uno.Exception
+ {
+ XPropertySet xProps = ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, GetConfig( xContext, sNodepath, true ) );
+ if ( xProps == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return xProps;
+ }
+
+
+ protected static XNameContainer GetConfigNameContainer( XComponentContext xContext, String sNodepath )
+ throws com.sun.star.uno.Exception
+ {
+ XNameContainer xContainer = ( XNameContainer ) UnoRuntime.queryInterface( XNameContainer.class, GetConfig( xContext, sNodepath, true ) );
+ if ( xContainer == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return xContainer;
+ }
+
+ protected static XNameAccess GetConfigNameAccess( XComponentContext xContext, String sNodepath )
+ throws com.sun.star.uno.Exception
+ {
+ XNameAccess xNameAccess = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, GetConfig( xContext, sNodepath, false ) );
+ if ( xNameAccess == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return xNameAccess;
+ }
+
+ protected static void SetConfigurationProxy( HostConfiguration aHostConfig, XComponentContext xContext )
+ {
+ if ( aHostConfig == null || xContext == null )
+ return;
+
+ try
+ {
+ XNameAccess xNameAccess = GetConfigNameAccess( xContext, "org.openoffice.Inet/Settings" );
+
+ int nProxyType = AnyConverter.toInt( xNameAccess.getByName( "ooInetProxyType" ) );
+ if ( nProxyType == 0 )
+ aHostConfig.setProxyHost( null );
+ else
+ {
+ if ( nProxyType == 1 )
+ {
+ // system proxy
+ }
+ else if ( nProxyType == 2 )
+ {
+ String aProxyNameProp = "ooInetHTTPProxyName";
+ String aProxyPortProp = "ooInetHTTPProxyPort";
+
+ if ( aHostConfig.getProtocol().getScheme().equals( "https" ) )
+ {
+ aProxyNameProp = "ooInetHTTPSProxyName";
+ aProxyPortProp = "ooInetHTTPSProxyPort";
+ }
+
+ String aNoProxyList = AnyConverter.toString( xNameAccess.getByName( "ooInetNoProxy" ) );
+ String aProxyName = AnyConverter.toString( xNameAccess.getByName( aProxyNameProp ) );
+
+ int nProxyPort = 80;
+
+ Object aPortNo = xNameAccess.getByName( aProxyPortProp );
+ if ( !AnyConverter.isVoid( aPortNo ) )
+ nProxyPort = AnyConverter.toInt( aPortNo );
+
+ if ( nProxyPort == -1 )
+ nProxyPort = 80;
+
+ // TODO: check whether the URL is in the NoProxy list
+ aHostConfig.setProxy( aProxyName, nProxyPort );
+ }
+ }
+ }
+ catch( java.lang.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ protected static void ShowURLInBrowser( XComponentContext xContext, String sURL )
+ {
+ if ( xContext != null && sURL != null && sURL.length() > 0 )
+ {
+ try
+ {
+ Object oSystemShell = xContext.getServiceManager().createInstanceWithContext( "com.sun.star.system.SystemShellExecute", xContext );
+ XSystemShellExecute xSystemShell = (XSystemShellExecute)UnoRuntime.queryInterface( XSystemShellExecute.class, oSystemShell );
+ if ( xSystemShell != null )
+ xSystemShell.execute( sURL, "", SystemShellExecuteFlags.DEFAULTS );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected static void ExecuteMethod( HttpMethodBase aMethod, HostConfiguration aHostConfig, URI aURI, XComponentContext xContext, boolean bSetHost )
+ throws WikiCancelException, IOException, SSLException
+ {
+ if ( aMethod != null && aHostConfig != null && aURI != null && xContext != null )
+ {
+ if ( bSetHost )
+ {
+ aHostConfig.setHost( aURI );
+ SetConfigurationProxy( aHostConfig, xContext );
+ }
+
+ boolean bNoUnknownCertNotification = false;
+ if ( aHostConfig.getProtocol().getScheme().equals( "https" )
+ && AllowUnknownCert( xContext, aURI.getHost() ) )
+ {
+ // let unknown certificates be accepted
+ {
+ {
+ aHostConfig.setHost( aHostConfig.getHost(), ( aURI.getPort() < 0 ? 443 : aURI.getPort() ), Helper.GetOwnHttps( aURI.getPort() ) );
+ Helper.GetHttpClient().executeMethod( aHostConfig, aMethod );
+ }
+ }
+ }
+ else
+ {
+ Helper.GetHttpClient().executeMethod( aHostConfig, aMethod );
+ }
+ }
+ }
+
+ static private class HTMLParse extends HTMLEditorKit
+ {
+
+ public HTMLEditorKit.Parser getParser()
+ {
+ return super.getParser();
+ }
+ }
+
+ static protected HTMLEditorKit.Parser GetHTMLParser()
+ {
+ return new HTMLParse().getParser();
+ }
+
+ static protected boolean LoginReportsError( String sRespond )
+ {
+ boolean bResult = true;
+ if ( sRespond != null )
+ {
+ try
+ {
+ StringReader aReader = new StringReader( sRespond );
+ HTMLEditorKit.Parser aParser = GetHTMLParser();
+ EditPageParser aCallback = new EditPageParser();
+
+ aParser.parse( aReader, aCallback, true );
+ bResult = ( aCallback.m_nErrorInd >= 0 );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return bResult;
+ }
+
+ static protected String GetLoginToken( String sLoginPage )
+ {
+ String sResult = "";
+ if ( sLoginPage != null && sLoginPage.length() > 0 )
+ {
+ try
+ {
+ StringReader aReader = new StringReader( sLoginPage );
+ HTMLEditorKit.Parser aParser = Helper.GetHTMLParser();
+ EditPageParser aCallbacks = new EditPageParser();
+
+ aParser.parse( aReader, aCallbacks, true );
+ sResult = aCallbacks.m_sLoginToken;
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return sResult;
+ }
+
+ static protected HostConfiguration Login( URI aMainURL, String sWikiUser, String sWikiPass, XComponentContext xContext )
+ throws com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ HostConfiguration aHostConfig = null;
+
+ if ( sWikiUser != null && sWikiPass != null && xContext != null )
+ {
+ HostConfiguration aNewHostConfig = new HostConfiguration();
+
+ URI aURI = new URI( aMainURL.toString() + "index.php?title=Special:Userlogin" );
+ GetMethod aGetCookie = new GetMethod( aURI.getEscapedPathQuery() );
+
+ ExecuteMethod( aGetCookie, aNewHostConfig, aURI, xContext, true );
+
+ int nResultCode = aGetCookie.getStatusCode();
+ String sLoginPage = null;
+ if ( nResultCode == 200 )
+ sLoginPage = aGetCookie.getResponseBodyAsString();
+
+ aGetCookie.releaseConnection();
+
+ if ( sLoginPage != null )
+ {
+ String sLoginToken = GetLoginToken( sLoginPage );
+
+ PostMethod aPost = new PostMethod();
+ URI aPostURI = new URI( aMainURL.getPath() + "index.php?title=Special:Userlogin&action=submitlogin" );
+ aPost.setPath( aPostURI.getEscapedPathQuery() );
+
+ aPost.addParameter( "wpName", sWikiUser );
+ aPost.addParameter( "wpRemember", "1" );
+ aPost.addParameter( "wpPassword", sWikiPass );
+ if ( sLoginToken.length() > 0 )
+ aPost.addParameter( "wpLoginToken", sLoginToken );
+
+ String[][] pArgs = GetSpecialArgs( xContext, aMainURL.getHost() );
+ if ( pArgs != null )
+ for ( int nArgInd = 0; nArgInd < pArgs.length; nArgInd++ )
+ if ( pArgs[nArgInd].length == 2 && pArgs[nArgInd][0] != null && pArgs[nArgInd][1] != null )
+ aPost.addParameter( pArgs[nArgInd][0], pArgs[nArgInd][1] );
+
+ ExecuteMethod( aPost, aNewHostConfig, aPostURI, xContext, false );
+
+ nResultCode = aPost.getStatusCode();
+
+ while( nResultCode >= 301 && nResultCode <= 303 || nResultCode == 307 )
+ {
+ String sRedirectURL = aPost.getResponseHeader( "Location" ).getValue();
+ aPost.releaseConnection();
+
+ aURI = new URI( sRedirectURL );
+ aPost = new PostMethod();
+ aPost.setPath( aURI.getEscapedPathQuery() );
+ ExecuteMethod( aPost, aNewHostConfig, aURI, xContext, false );
+
+ nResultCode = aPost.getStatusCode();
+ }
+
+ if ( nResultCode == 200 )
+ {
+ String sResult = aPost.getResponseBodyAsString();
+ if ( !LoginReportsError( sResult ) )
+ aHostConfig = aNewHostConfig;
+ }
+
+ aPost.releaseConnection();
+ }
+ }
+
+ return aHostConfig;
+ }
+
+ private static XControl GetControlFromDialog( XDialog xDialog, String aControlName )
+ {
+ XControl xResult = null;
+ XControlContainer xControlCont = (XControlContainer) UnoRuntime.queryInterface( XControlContainer.class, xDialog );
+
+ if ( xControlCont != null )
+ {
+ Object oControl = xControlCont.getControl( aControlName );
+ xResult = ( XControl ) UnoRuntime.queryInterface( XControl.class, oControl );
+ }
+
+ return xResult;
+ }
+
+ private static XPropertySet GetSubControlPropSet( XDialog xDialog, String aControlName )
+ {
+ XControl xControl = GetControlFromDialog( xDialog, aControlName );
+ if ( xControl != null )
+ return ( XPropertySet ) UnoRuntime.queryInterface( XPropertySet.class, xControl.getModel() );
+
+ return null;
+ }
+
+ protected static void SetControlPropInDialog( XDialog xDialog, String aControlName, String aPropName, Object aPropValue )
+ {
+ if ( xDialog != null && aControlName != null && aPropName != null && aPropValue != null )
+ {
+ try
+ {
+ XPropertySet xPropSet = GetSubControlPropSet( xDialog, aControlName );
+ if ( xPropSet != null )
+ xPropSet.setPropertyValue( aPropName, aPropValue );
+ }
+ catch ( com.sun.star.uno.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ protected static String[] GetPasswordsForURLAndUser( XComponentContext xContext, String sURL, String sUserName )
+ {
+ String[] aResult = null;
+
+ try
+ {
+ if ( xContext != null && sURL != null && sURL.length() > 0 && sUserName != null && sUserName.length() > 0 )
+ {
+ UrlRecord aRec = GetPasswordContainer( xContext ).findForName( sURL, sUserName, GetInteractionHandler( xContext ) );
+ if ( aRec != null && aRec.UserList != null && aRec.UserList.length > 0
+ && aRec.UserList[0].UserName.equals( sUserName ) )
+ aResult = aRec.UserList[0].Passwords;
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return aResult;
+ }
+
+ protected static boolean PasswordStoringIsAllowed( XComponentContext xContext )
+ {
+ boolean bResult = false;
+ try
+ {
+ XMasterPasswordHandling xMasterHdl = (XMasterPasswordHandling)UnoRuntime.queryInterface( XMasterPasswordHandling.class, GetPasswordContainer( xContext ) );
+ if ( xMasterHdl != null )
+ bResult = xMasterHdl.isPersistentStoringAllowed();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return bResult;
+ }
+
+ protected static void ShowError( XComponentContext xContext, XDialog xDialog, int nTitleID, int nErrorID, String sArg, boolean bQuery )
+ {
+ XWindowPeer xPeer = null;
+ XControl xControl = (XControl)UnoRuntime.queryInterface( XControl.class, xDialog );
+ if ( xControl != null )
+ xPeer = xControl.getPeer();
+ ShowError( xContext, xPeer, nTitleID, nErrorID, sArg, bQuery );
+ }
+
+ protected static boolean ShowError( XComponentContext xContext, XWindowPeer xParentPeer, int nTitleID, int nErrorID, String sArg, boolean bQuery )
+ {
+ boolean bResult = false;
+
+ if ( xContext != null && nErrorID >= 0 && nErrorID < STRINGS_NUM )
+ {
+ boolean bShown = false;
+
+ String sError = null;
+ String sTitle = "";
+
+ try
+ {
+ sError = GetLocalizedString( xContext, nErrorID );
+ if ( sError != null && sArg != null )
+ sError = sError.replaceAll( "\\$ARG1", sArg );
+
+ sTitle = GetLocalizedString( xContext, nTitleID );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ if ( sError == null )
+ sError = "Error: " + nErrorID;
+
+ if ( xParentPeer != null )
+ {
+ XMessageBoxFactory xMBFactory = null;
+ XMessageBox xMB = null;
+ try
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory != null )
+ xMBFactory = (XMessageBoxFactory)UnoRuntime.queryInterface(
+ XMessageBoxFactory.class,
+ xFactory.createInstanceWithContext( "com.sun.star.awt.Toolkit", xContext ) );
+
+ if ( xMBFactory != null )
+ {
+ if ( bQuery )
+ {
+ xMB = xMBFactory.createMessageBox(
+ xParentPeer,
+ new com.sun.star.awt.Rectangle(),
+ "querybox",
+ MessageBoxButtons.BUTTONS_YES_NO | MessageBoxButtons.DEFAULT_BUTTON_NO,
+ sTitle,
+ sError );
+ }
+ else
+ {
+ xMB = xMBFactory.createMessageBox(
+ xParentPeer,
+ new com.sun.star.awt.Rectangle(),
+ "errorbox",
+ MessageBoxButtons.BUTTONS_OK,
+ sTitle,
+ sError );
+ }
+ if ( xMB != null )
+ {
+ bResult = MainThreadDialogExecutor.Execute( xContext, xMB );
+ bShown = true;
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( xMB != null )
+ Dispose( xMB );
+ }
+ }
+ }
+
+ return bResult;
+ }
+
+ private static boolean AllowUnknownCert( XComponentContext xContext, String aURL )
+ {
+ try
+ {
+ XNameAccess xNameAccess = GetConfigNameAccess( xContext, "org.openoffice.Office.Custom.WikiExtension/SpecialData" );
+ if ( xNameAccess.hasByName( aURL ) )
+ {
+ XNameAccess xEntry = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, xNameAccess.getByName( aURL ) );
+ if ( xEntry != null && xEntry.hasByName( "AllowUnknownCertificate" ) )
+ return AnyConverter.toBoolean( xEntry.getByName( "AllowUnknownCertificate" ) );
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return false;
+ }
+
+ private static String[][] GetSpecialArgs( XComponentContext xContext, String aURL )
+ {
+ try
+ {
+ XNameAccess xNameAccess = GetConfigNameAccess( xContext, "org.openoffice.Office.Custom.WikiExtension/SpecialData" );
+ if ( xNameAccess.hasByName( aURL ) )
+ {
+ XNameAccess xEntry = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, xNameAccess.getByName( aURL ) );
+ if ( xEntry != null )
+ {
+ XNameAccess xArgs = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, xEntry.getByName( "AdditionalLoginArguments" ) );
+ if ( xArgs != null )
+ {
+ String[] pNames = xArgs.getElementNames();
+ if ( pNames != null && pNames.length > 0 )
+ {
+ String[][] pResult = new String[pNames.length][2];
+ for ( int nInd = 0; nInd < pNames.length; nInd++ )
+ {
+ XNameAccess xArgument = (XNameAccess)UnoRuntime.queryInterface( XNameAccess.class, xArgs.getByName( pNames[nInd] ) );
+ if ( xArgument == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ pResult[nInd][0] = pNames[nInd];
+ pResult[nInd][1] = AnyConverter.toString( xArgument.getByName( "Value" ) );
+ }
+
+ return pResult;
+ }
+ }
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+
+ protected static boolean AllowThreadUsage( XComponentContext xContext )
+ {
+ if ( xContext != null )
+ {
+ try
+ {
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ Object oCheckCallback = xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext );
+ return ( oCheckCallback != null );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ return false;
+ }
+
+ public static void Dispose( Object oObject )
+ {
+ if ( oObject != null )
+ {
+ try
+ {
+ XComponent xComp = (XComponent)UnoRuntime.queryInterface( XComponent.class, oObject );
+ if ( xComp != null )
+ xComp.dispose();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+}
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
new file mode 100644
index 000000000000..dbf849fa4ef0
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java
@@ -0,0 +1,176 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.uno.Any;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XCallback;
+import com.sun.star.awt.XMessageBox;
+import com.sun.star.awt.XRequestCallback;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+
+public class MainThreadDialogExecutor implements XCallback
+{
+ private WikiDialog m_aWikiDialog;
+ private XDialog m_xDialog;
+ private XMessageBox m_xMessageBox;
+ private boolean m_bResult = false;
+ private boolean m_bCalled = false;
+ private boolean m_bClose = false;
+
+ static public boolean Show( XComponentContext xContext, WikiDialog aWikiDialog )
+ {
+ MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( aWikiDialog );
+ return GetCallback( xContext, aExecutor );
+ }
+
+ static public boolean Execute( XComponentContext xContext, XDialog xDialog )
+ {
+ MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( xDialog );
+ return GetCallback( xContext, aExecutor );
+ }
+
+ static public boolean Execute( XComponentContext xContext, XMessageBox xMessageBox )
+ {
+ MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( xMessageBox );
+ return GetCallback( xContext, aExecutor );
+ }
+
+ static public boolean Close( XComponentContext xContext, XDialog xDialog )
+ {
+ MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( xDialog, true );
+ return GetCallback( xContext, aExecutor );
+ }
+
+ static private boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor )
+ {
+ try
+ {
+ if ( aExecutor != null )
+ {
+ String aThreadName = null;
+ Thread aCurThread = Thread.currentThread();
+ if ( aCurThread != null )
+ aThreadName = aCurThread.getName();
+
+ if ( aThreadName != null && aThreadName.equals( "com.sun.star.thread.WikiEditorSendingThread" ) )
+ {
+ // the main thread should be accessed asynchronously
+ XMultiComponentFactory xFactory = xContext.getServiceManager();
+ if ( xFactory == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ XRequestCallback xRequest = (XRequestCallback)UnoRuntime.queryInterface(
+ XRequestCallback.class,
+ xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext ) );
+ if ( xRequest != null )
+ {
+ xRequest.addCallback( aExecutor, Any.VOID );
+ do
+ {
+ Thread.yield();
+ }
+ while( !aExecutor.m_bCalled );
+ }
+ }
+ else
+ {
+ // handle it as a main thread
+ aExecutor.notify( Any.VOID );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return aExecutor.GetResult();
+ }
+
+ private MainThreadDialogExecutor( WikiDialog aWikiDialog )
+ {
+ m_aWikiDialog = aWikiDialog;
+ }
+
+ private MainThreadDialogExecutor( XDialog xDialog )
+ {
+ m_xDialog = xDialog;
+ }
+
+ private MainThreadDialogExecutor( XDialog xDialog, boolean bClose )
+ {
+ m_xDialog = xDialog;
+ m_bClose = true;
+ m_bCalled = true; // no yielding, asynchronous closing
+ }
+
+ private MainThreadDialogExecutor( XMessageBox xMessageBox )
+ {
+ m_xMessageBox = xMessageBox;
+ }
+
+ private boolean GetResult()
+ {
+ return m_bResult;
+ }
+
+ public void notify( Object aData )
+ {
+ if ( m_aWikiDialog != null )
+ m_bResult = m_aWikiDialog.show();
+ else if ( m_xDialog != null )
+ {
+ if ( !m_bClose )
+ m_bResult = ( m_xDialog.execute() == 1 );
+ else
+ {
+ try
+ {
+ m_xDialog.endExecute();
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ m_bResult = true;
+ }
+ }
+ else if ( m_xMessageBox != null )
+ {
+ int nRes = m_xMessageBox.execute();
+ m_bResult = ( nRes == com.sun.star.awt.MessageBoxCommand.OK
+ || nRes == com.sun.star.awt.MessageBoxCommand.YES );
+ }
+
+ m_bCalled = true;
+ }
+};
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/Settings.java b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
new file mode 100644
index 000000000000..d14c4eae4b52
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/Settings.java
@@ -0,0 +1,347 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameAccess;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.container.XNameReplace;
+import com.sun.star.lang.XSingleServiceFactory;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.XChangesBatch;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+public class Settings
+{
+
+ private XComponentContext m_xContext;
+ private int lastUsedWikiServer = 0;
+
+
+ /* Singelton */
+ private static Settings m_instance;
+
+
+ private Vector m_WikiConnections = new Vector();
+ private Vector m_aWikiDocs = new Vector();
+
+ private Settings( XComponentContext ctx )
+ {
+ m_xContext=ctx;
+ loadConfiguration();
+ }
+
+
+ public static synchronized Settings getSettings( XComponentContext ctx )
+ {
+ if ( m_instance == null )
+ m_instance = new Settings( ctx );
+ // m_instance.loadSettings();
+ return m_instance;
+ }
+
+
+ public void addWikiCon ( Hashtable wikiCon )
+ {
+ m_WikiConnections.add( wikiCon );
+ }
+
+
+ public Vector getWikiCons()
+ {
+ return m_WikiConnections;
+ }
+
+ public String getWikiConUrlByNumber( int num )
+ {
+ String url = "";
+ if ( num >=0 && num < m_WikiConnections.size() )
+ {
+ Hashtable ht = ( Hashtable ) m_WikiConnections.get( num );
+ url = ( String ) ht.get( "Url" );
+ }
+ return url;
+ }
+
+
+ public void addWikiDoc ( Hashtable aWikiDoc )
+ {
+ String sURL = ( String ) aWikiDoc.get( "CompleteUrl" );
+ Hashtable aEntry = getDocByCompleteUrl( sURL );
+
+ if ( aEntry != null )
+ {
+ // add doc to the end, even if it has been added before
+ m_aWikiDocs.remove( aEntry );
+ }
+ else if ( m_aWikiDocs.size() > 10 )
+ {
+ // if the number of elements has reached maximum the oldest element should be removed
+ m_aWikiDocs.remove( 0 );
+ }
+
+ m_aWikiDocs.add( aWikiDoc );
+ }
+
+
+ public Vector getWikiDocs()
+ {
+ return m_aWikiDocs;
+ }
+
+ public Object[] getWikiDocList( int serverid, int num )
+ {
+ String wikiserverurl = getWikiConUrlByNumber( serverid );
+ Vector theDocs = new Vector();
+ String [] docs = new String[0];
+ for ( int i=0; i<m_aWikiDocs.size(); i++ )
+ {
+ Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i );
+ String docurl = ( String ) ht.get( "Url" );
+ if ( docurl.equals( wikiserverurl ) )
+ {
+ theDocs.add( (String ) ht.get( "Doc" ) );
+ }
+ }
+ return theDocs.toArray( docs );
+ }
+
+ public int getLastUsedWikiServer()
+ {
+ return lastUsedWikiServer;
+ }
+
+ public void setLastUsedWikiServer( int l )
+ {
+ lastUsedWikiServer = l;
+ }
+
+ public String[] getWikiURLs()
+ {
+ String [] WikiList = new String [m_WikiConnections.size()];
+ for ( int i=0; i<m_WikiConnections.size(); i++ )
+ {
+ Hashtable ht = ( Hashtable ) m_WikiConnections.get( i );
+ WikiList[i] = ( String ) ht.get( "Url" );
+ }
+ return WikiList;
+ }
+
+
+ public Hashtable getSettingByUrl( String sUrl )
+ {
+ Hashtable ht = null;
+ for( int i=0;i<m_WikiConnections.size();i++ )
+ {
+ Hashtable h1 = ( Hashtable ) m_WikiConnections.get( i );
+ String u1 = ( String ) h1.get( "Url" );
+ if ( u1.equals( sUrl ) )
+ {
+ ht = h1;
+ try
+ {
+ String sUserName = (String)ht.get( "Username" );
+ String aPassword = (String)ht.get( "Password" );
+ if ( sUserName != null && sUserName.length() > 0 && ( aPassword == null || aPassword.length() == 0 ) )
+ {
+ String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, sUrl, sUserName );
+ if ( pPasswords != null && pPasswords.length > 0 )
+ ht.put( "Password", pPasswords[0] );
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ break;
+ }
+ }
+ return ht;
+ }
+
+ public Hashtable getDocByCompleteUrl( String curl )
+ {
+ Hashtable ht = null;
+ for( int i=0;i<m_aWikiDocs.size();i++ )
+ {
+ Hashtable h1 = ( Hashtable ) m_aWikiDocs.get( i );
+ String u1 = ( String ) h1.get( "CompleteUrl" );
+ if ( u1.equals( curl ) )
+ {
+ ht = h1;
+ }
+ }
+ return ht;
+ }
+
+
+ public void removeSettingByUrl( String sUrl )
+ {
+ Hashtable ht = null;
+ for( int i=0;i<m_WikiConnections.size();i++ )
+ {
+ Hashtable h1 = ( Hashtable ) m_WikiConnections.get( i );
+ String u1 = ( String ) h1.get( "Url" );
+ if ( u1.equals( sUrl ) )
+ {
+ m_WikiConnections.remove( i );
+ }
+ }
+ }
+
+
+ public void storeConfiguration()
+ {
+ try
+ {
+ // remove stored connection information
+ XNameContainer xContainer = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/ConnectionList" );
+ String[] pNames = xContainer.getElementNames();
+ for( int i=0; i<pNames.length; i++ )
+ {
+ xContainer.removeByName( pNames[i] );
+ }
+
+ // store all connections
+ XSingleServiceFactory xConnectionFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer );
+ for ( int i=0; i< m_WikiConnections.size(); i++ )
+ {
+ Object oNewConnection = xConnectionFactory.createInstance();
+ Hashtable ht = ( Hashtable ) m_WikiConnections.get( i );
+ XNameReplace xNewConn = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewConnection );
+
+ if ( xNewConn != null )
+ xNewConn.replaceByName( "UserName", ht.get( "Username" ) );
+
+ xContainer.insertByName( (String)ht.get( "Url" ), xNewConn );
+ }
+ // commit changes
+ XChangesBatch xBatch = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer );
+ xBatch.commitChanges();
+
+ // remove stored connection information
+ XNameContainer xContainer2 = Helper.GetConfigNameContainer( m_xContext, "org.openoffice.Office.Custom.WikiExtension/RecentDocs" );
+ String[] pNames2 = xContainer2.getElementNames();
+ for( int i=0; i<pNames2.length; i++ )
+ {
+ xContainer2.removeByName( pNames2[i] );
+ }
+ // store all Docs
+ XSingleServiceFactory xDocListFactory = ( XSingleServiceFactory ) UnoRuntime.queryInterface( XSingleServiceFactory.class, xContainer2 );
+ for ( int i=0; i< m_aWikiDocs.size(); i++ )
+ {
+ Hashtable ht = ( Hashtable ) m_aWikiDocs.get( i );
+
+ Object oNewDoc = xDocListFactory.createInstance();
+ XNameReplace xNewDoc = ( XNameReplace ) UnoRuntime.queryInterface( XNameReplace.class, oNewDoc );
+
+ Enumeration e = ht.keys();
+ while ( e.hasMoreElements() )
+ {
+ String key = ( String ) e.nextElement();
+ xNewDoc.replaceByName( key, ht.get( key ) );
+ }
+
+ xContainer2.insertByName( "d" + i, xNewDoc );
+ }
+ // commit changes
+ XChangesBatch xBatch2 = ( XChangesBatch ) UnoRuntime.queryInterface( XChangesBatch.class, xContainer2 );
+ xBatch2.commitChanges();
+
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void loadConfiguration()
+ {
+ m_WikiConnections.clear();
+ try
+ {
+ // get configuration service
+ // connect to configmanager
+ XNameAccess xAccess = Helper.GetConfigNameAccess( m_xContext, "org.openoffice.Office.Custom.WikiExtension" );
+
+ if ( xAccess != null )
+ {
+ Object oList = xAccess.getByName( "ConnectionList" );
+ XNameAccess xConnectionList = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oList );
+ String [] allCons = xConnectionList.getElementNames();
+ for ( int i=0; i<allCons.length; i++ )
+ {
+ Hashtable ht = new Hashtable();
+ ht.put( "Url", allCons[i] );
+ ht.put( "Username", "" );
+ ht.put( "Password", "" );
+
+ try
+ {
+ XPropertySet xProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xConnectionList.getByName( allCons[i] ) );
+ if ( xProps != null )
+ {
+ String aUsername = AnyConverter.toString( xProps.getPropertyValue( "UserName" ) );
+ if ( aUsername != null && aUsername.length() > 0 )
+ ht.put( "Username", aUsername );
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ addWikiCon( ht );
+ }
+
+ Object oDocs = xAccess.getByName( "RecentDocs" );
+ XNameAccess xRecentDocs = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oDocs );
+ String [] allDocs = xRecentDocs.getElementNames();
+ for ( int i=0; i<allDocs.length; i++ )
+ {
+ Object oDoc = xRecentDocs.getByName( allDocs[i] );
+ XNameAccess xDoc = ( XNameAccess ) UnoRuntime.queryInterface( XNameAccess.class, oDoc );
+ Hashtable ht = new Hashtable();
+ ht.put( "Url", xDoc.getByName( "Url" ) );
+ ht.put( "CompleteUrl", xDoc.getByName( "CompleteUrl" ) );
+ ht.put( "Doc", xDoc.getByName( "Doc" ) );
+ addWikiDoc( ht );
+ }
+ }
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
new file mode 100644
index 000000000000..89025ed84513
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiArticle.java
@@ -0,0 +1,295 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.task.UrlRecord;
+import java.io.*;
+import java.util.Hashtable;
+import javax.swing.text.html.*;
+import com.sun.star.uno.XComponentContext;
+
+import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.methods.*;
+
+
+public class WikiArticle
+{
+ private XComponentContext m_xContext;
+
+ private String m_sEditTime = "";
+ private String m_sEditToken = "";
+
+ protected String m_sHTMLCode;
+ private boolean m_bNoArticle = true;
+
+ protected String m_sWikiUser;
+ protected String m_sWikiPass;
+
+ protected String m_sTitle = "";
+
+ private URI m_aMainURI;
+ private HostConfiguration m_aHostConfig;
+
+
+ /** Creates a new instance of WikiArticle */
+ public WikiArticle( XComponentContext xContext, String sTitle, Hashtable wikiSettings, boolean bLogin, WikiPropDialog aPropDialog )
+ throws java.net.MalformedURLException, com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ m_xContext = xContext;
+
+ String sMainUrl = (String) wikiSettings.get("Url");
+ m_sWikiUser = (String) wikiSettings.get("Username");
+ m_sWikiPass = (String) wikiSettings.get("Password");
+ m_sTitle = sTitle;
+
+ m_aMainURI = new URI( sMainUrl );
+
+// viewURL = sMainUrl + "index.php?title=" + m_sTitle;
+// editURL = sMainUrl + "index.php?title=" + m_sTitle + "&action=edit";
+// submitURL = sMainUrl + "index.php?title=" + m_sTitle + "&action=submit";
+// loginURL = sMainUrl + "index.php?title=Special:Userlogin";
+// loginSubmitURL = sMainUrl + "index.php?title=Special:Userlogin&action=submitlogin";
+
+ if ( bLogin )
+ {
+ WikiEditSettingDialog aDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", wikiSettings, false );
+ try
+ {
+ while( !Login() )
+ {
+ if ( aPropDialog != null )
+ aPropDialog.SetThrobberActive( false );
+
+ if ( MainThreadDialogExecutor.Show( xContext, aDialog ) )
+ {
+ m_sWikiUser = (String) wikiSettings.get("Username");
+ m_sWikiPass = (String) wikiSettings.get("Password");
+ }
+ else
+ throw new WikiCancelException();
+
+ if ( aPropDialog != null )
+ {
+ aPropDialog.SetThrobberActive( true );
+ Thread.yield();
+ }
+ }
+ }
+ finally
+ {
+ aDialog.DisposeDialog();
+ }
+ }
+
+ // in case of loading the html contents are used
+ // in case of saving the contents should be checked whether they are empty
+ InitArticleHTML();
+
+ // getArticleWiki();
+ }
+
+ public String GetMainURL()
+ {
+ return m_aMainURI.toString();
+ }
+
+ public String GetTitle()
+ {
+ return m_sTitle;
+ }
+
+ public String GetViewURL()
+ {
+ return m_aMainURI.toString() + "index.php?title=" + m_sTitle;
+ }
+
+ private String getArticleWiki()
+ throws com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ String sWikiCode = null;
+
+ if ( m_aHostConfig != null )
+ {
+ URI aURI = new URI( m_aMainURI.toString() + "index.php?title=" + m_sTitle + "&action=edit" );
+ GetMethod aRequest = new GetMethod( aURI.getEscapedPathQuery() );
+
+ Helper.ExecuteMethod( aRequest, m_aHostConfig, aURI, m_xContext, false );
+
+ int nResultCode = aRequest.getStatusCode();
+ String sWebPage = null;
+ if ( nResultCode == 200 )
+ sWebPage = aRequest.getResponseBodyAsString();
+
+ aRequest.releaseConnection();
+
+ if ( sWebPage != null )
+ {
+ StringReader r = new StringReader(sWebPage);
+ HTMLEditorKit.Parser parse = Helper.GetHTMLParser();
+ EditPageParser callback = new EditPageParser();
+
+ parse.parse(r,callback,true);
+ m_sEditTime = callback.m_sEditTime;
+ m_sEditToken = callback.m_sEditToken;
+
+ int iPosStart = callback.m_nWikiArticleStart;
+ int iPosEnd = callback.m_nWikiArticleEnd;
+
+ if ( iPosStart >= 0 && iPosEnd > 0 )
+ {
+ String sArticle = sWebPage.substring(iPosStart, iPosEnd);
+ iPosStart = sArticle.indexOf(">") + 1;
+ sWikiCode = sArticle.substring( iPosStart, sArticle.length() );
+ }
+ }
+ }
+
+ return sWikiCode;
+ }
+
+ private void InitArticleHTML()
+ throws com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ if ( m_aHostConfig != null )
+ {
+ URI aURI = new URI( m_aMainURI.toString() + "index.php?title=" + m_sTitle );
+ GetMethod aRequest = new GetMethod( aURI.getEscapedPathQuery() );
+
+ Helper.ExecuteMethod( aRequest, m_aHostConfig, aURI, m_xContext, false );
+
+ int nResultCode = aRequest.getStatusCode();
+ String sWebPage = null;
+ if ( nResultCode == 200 )
+ sWebPage = aRequest.getResponseBodyAsString();
+
+ if ( sWebPage != null )
+ {
+ StringReader r = new StringReader(sWebPage);
+ HTMLEditorKit.Parser parse = Helper.GetHTMLParser();
+ EditPageParser callback = new EditPageParser();
+
+ parse.parse(r,callback,true);
+
+ int iPosStart = callback.m_nHTMLArticleStart;
+ int iPosEnd = callback.m_nHTMLArticleEnd;
+ int nPosNoArt = callback.m_nNoArticleInd;
+
+ if ( iPosStart >= 0 && iPosEnd > 0 )
+ {
+ m_sHTMLCode = sWebPage.substring(iPosStart, iPosEnd);
+ m_bNoArticle = ( nPosNoArt >= 0 && nPosNoArt >= iPosStart && nPosNoArt <= iPosEnd );
+ }
+ }
+ }
+ }
+
+ protected boolean setArticle( String sWikiCode, String sWikiComment, boolean bMinorEdit )
+ throws com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ boolean bResult = false;
+
+ if ( m_aHostConfig != null && sWikiCode != null && sWikiComment != null )
+ {
+ // get the edit time and token
+ getArticleWiki();
+
+ URI aURI = new URI( m_aMainURI.getPath() + "index.php?title=" + m_sTitle + "&action=submit" );
+ PostMethod aPost = new PostMethod();
+ aPost.setPath( aURI.getEscapedPathQuery() );
+
+ // aPost.addParameter( "title", m_sTitle );
+ // aPost.addParameter( "action", "submit" );
+ aPost.addParameter( "wpTextbox1", sWikiCode );
+ aPost.addParameter( "wpSummary", sWikiComment );
+ aPost.addParameter( "wpSection", "" );
+ aPost.addParameter( "wpEdittime", m_sEditTime );
+ aPost.addParameter( "wpSave", "Save page" );
+ aPost.addParameter( "wpEditToken", m_sEditToken );
+
+ if ( bMinorEdit )
+ aPost.addParameter( "wpMinoredit", "1" );
+
+ Helper.ExecuteMethod( aPost, m_aHostConfig, aURI, m_xContext, false );
+
+ int nResultCode = aPost.getStatusCode();
+ if ( nResultCode < 400 )
+ bResult = true;
+
+ String aResult = aPost.getResponseBodyAsString();
+
+ // TODO: remove the debug printing, try to detect the error
+ System.out.print( "nSubmitCode = " + nResultCode + "\n===\n" + aResult );
+ }
+
+ return bResult;
+ }
+
+ protected boolean Login()
+ throws com.sun.star.uno.Exception, java.io.IOException, WikiCancelException
+ {
+ m_aHostConfig = Helper.Login( m_aMainURI, m_sWikiUser, m_sWikiPass, m_xContext );
+ return ( m_aHostConfig != null );
+ }
+
+ protected void cleanHTML()
+ {
+ if ( m_sHTMLCode != null )
+ {
+ //Welcome to regex hell ;)
+
+ //strip comments
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<![ \\r\\n\\t]*(--([^\\-]|[\\r\\n]|-[^\\-])*--[ \\r\\n\\t]*)\\>","");
+
+ //strip edit section links
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<div class=\"editsection\".*?\\</div\\>","");
+
+ //strip huge spaces
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<p\\>\\<br /\\>[ \r\n\t]*?\\</p\\>","");
+
+ //strip toc
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<table.*id=\"toc\"(.|[\r\n])*?\\</table\\>","");
+
+ //strip jump-to-nav
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<div id=\"jump-to-nav\".*?\\</div\\>","");
+
+ //strip Javascript
+ m_sHTMLCode = m_sHTMLCode.replaceAll("\\<script(.|[\r\n])*?\\</script\\>","");
+ }
+ }
+
+
+ protected boolean NotExist()
+ {
+ boolean bResult = true;
+ if ( m_sHTMLCode != null )
+ bResult = m_bNoArticle;
+
+ return bResult;
+ }
+
+}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiCancelException.java b/swext/mediawiki/src/com/sun/star/wiki/WikiCancelException.java
new file mode 100644
index 000000000000..73369c997727
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiCancelException.java
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+class WikiCancelException extends java.lang.Exception
+{
+};
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
new file mode 100644
index 000000000000..e91f053169e7
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java
@@ -0,0 +1,325 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XDialogEventHandler;
+import com.sun.star.awt.XDialogProvider2;
+import com.sun.star.awt.XThrobber;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.awt.XTopWindow;
+import com.sun.star.awt.XTopWindowListener;
+import com.sun.star.awt.XWindow;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.EventObject;
+import com.sun.star.lang.XMultiServiceFactory;
+
+public class WikiDialog implements XDialogEventHandler, XTopWindowListener
+{
+ XComponentContext m_xContext;
+ XControlContainer m_xControlContainer;
+ XDialog m_xDialog;
+ String[] m_aMethods;
+ boolean m_bAction = false;
+ Settings m_aSettings;
+
+ protected Thread m_aThread;
+ protected boolean m_bThreadFinished = false;
+
+
+ /** Creates a new instance of WikiDialog */
+ public WikiDialog(XComponentContext c, String DialogURL)
+ {
+ this.m_xContext = c;
+ XMultiComponentFactory xMCF = m_xContext.getServiceManager();
+ m_aSettings = Settings.getSettings(m_xContext);
+ try
+ {
+ Object obj;
+ obj = xMCF.createInstanceWithContext("com.sun.star.awt.DialogProvider2", m_xContext );
+ XDialogProvider2 xDialogProvider = (XDialogProvider2) UnoRuntime.queryInterface( XDialogProvider2.class, obj );
+
+ m_xDialog = xDialogProvider.createDialogWithHandler( DialogURL, this );
+ m_xControlContainer = (XControlContainer)UnoRuntime.queryInterface( XControlContainer.class, m_xDialog );
+ XTopWindow xTopWindow = (XTopWindow)UnoRuntime.queryInterface( XTopWindow.class, m_xDialog );
+ if ( xTopWindow != null )
+ xTopWindow.addTopWindowListener( this );
+ }
+ catch (com.sun.star.uno.Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public synchronized void ThreadStop( boolean bSelf )
+ {
+ if ( bSelf || m_aThread != null && !m_bThreadFinished )
+ {
+ try
+ {
+ Helper.AllowConnection( bSelf );
+ }
+ catch( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ m_aThread = null;
+ m_bThreadFinished = true;
+ }
+
+ protected void setMethods (String [] Methods)
+ {
+ this.m_aMethods = Methods;
+ }
+
+
+ public boolean show( )
+ {
+ m_bThreadFinished = false;
+
+ if( m_xDialog != null ) m_xDialog.execute();
+ return m_bAction;
+ }
+
+
+ public String[] getSupportedMethodNames()
+ {
+ return m_aMethods;
+ }
+
+
+ public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
+ {
+ return true;
+ }
+
+ public void SetTitle( String sTitle )
+ throws Exception
+ {
+ SetTitle( m_xDialog, sTitle );
+ }
+
+ public static void SetTitle( XDialog xDialog, String sTitle )
+ throws Exception
+ {
+ if ( xDialog != null && sTitle != null )
+ {
+ XControl xDialogControl = (XControl)UnoRuntime.queryInterface( XControl.class, xDialog );
+ if ( xDialogControl != null )
+ {
+ XPropertySet xPropSet = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xDialogControl.getModel() );
+ if ( xPropSet != null )
+ xPropSet.setPropertyValue( "Title", sTitle );
+ }
+ }
+ }
+
+ protected XPropertySet GetPropSet(String sControl)
+ {
+ return GetPropSet( m_xControlContainer, sControl );
+ }
+
+ protected static XPropertySet GetPropSet( XControlContainer xControlContainer, String sControl )
+ {
+ XPropertySet xPS = null;
+
+ if ( xControlContainer != null && sControl != null )
+ {
+ XControl xControl = xControlContainer.getControl(sControl);
+ xPS = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel() );
+ }
+
+ if ( xPS == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ return xPS;
+ }
+
+ public static XDialog CreateSimpleDialog( XComponentContext xContext, String sURL, int nTitleID, String[] pControls, int[] pStringIDs )
+ {
+ XDialog xResult = null;
+
+ if ( xContext != null && sURL != null && sURL.length() > 0 )
+ {
+ try
+ {
+ Object oDialogProvider = xContext.getServiceManager().createInstanceWithContext("com.sun.star.awt.DialogProvider2", xContext );
+ XDialogProvider2 xDialogProvider = (XDialogProvider2) UnoRuntime.queryInterface( XDialogProvider2.class, oDialogProvider );
+
+ if ( xDialogProvider != null )
+ xResult = xDialogProvider.createDialog( sURL );
+
+ if ( xResult != null )
+ {
+ SetTitle( xResult, Helper.GetLocalizedString( xContext, nTitleID ) );
+ if ( pControls != null && pStringIDs != null && pControls.length == pStringIDs.length )
+ {
+ XControlContainer xControlContainer = (XControlContainer)UnoRuntime.queryInterface( XControlContainer.class, xResult );
+ for ( int nInd = 0; nInd < pControls.length; nInd++ )
+ GetPropSet( xControlContainer, pControls[nInd] ).setPropertyValue( "Label", new Integer( pStringIDs[nInd] ) );
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ return xResult;
+ }
+
+ protected void InsertThrobber( int X, int Y, int Width, int Height )
+ {
+ try
+ {
+ XControl xDialogControl = ( XControl ) UnoRuntime.queryInterface( XControl.class, m_xDialog );
+ XControlModel xDialogModel = null;
+ if ( xDialogControl != null )
+ xDialogModel = xDialogControl.getModel();
+
+ XMultiServiceFactory xDialogFactory = ( XMultiServiceFactory ) UnoRuntime.queryInterface( XMultiServiceFactory.class, xDialogModel );
+ if ( xDialogFactory != null )
+ {
+ XControlModel xThrobberModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, xDialogFactory.createInstance( "com.sun.star.awt.UnoThrobberControlModel" ) );
+ XPropertySet xThrobberProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xThrobberModel );
+ if ( xThrobberProps != null )
+ {
+ xThrobberProps.setPropertyValue( "Name", "WikiThrobber" );
+ xThrobberProps.setPropertyValue( "PositionX", new Integer( X ) );
+ xThrobberProps.setPropertyValue( "PositionY", new Integer( Y ) );
+ xThrobberProps.setPropertyValue( "Height", new Integer( Width ) );
+ xThrobberProps.setPropertyValue( "Width", new Integer( Height ) );
+
+ XNameContainer xDialogContainer = (XNameContainer)UnoRuntime.queryInterface( XNameContainer.class, xDialogModel );
+ xDialogContainer.insertByName( "WikiThrobber", xThrobberModel );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ SetThrobberVisible( false );
+ }
+
+ public void SetThrobberActive( boolean bActive )
+ {
+ if ( m_xControlContainer != null )
+ {
+ try
+ {
+ XThrobber xThrobber = (XThrobber)UnoRuntime.queryInterface( XThrobber.class, m_xControlContainer.getControl( "WikiThrobber" ) );
+ if ( xThrobber != null )
+ {
+ if ( bActive )
+ xThrobber.start();
+ else
+ xThrobber.stop();
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void SetThrobberVisible( boolean bVisible )
+ {
+ if ( m_xControlContainer != null )
+ {
+ try
+ {
+ XWindow xWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class, m_xControlContainer.getControl( "WikiThrobber" ) );
+ if ( xWindow != null )
+ xWindow.setVisible( bVisible );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void SetFocusTo( String aControl )
+ {
+ if ( m_xControlContainer != null )
+ {
+ try
+ {
+ XWindow xWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class, m_xControlContainer.getControl( aControl ) );
+ if ( xWindow != null )
+ xWindow.setFocus();
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void DisposeDialog()
+ {
+ Helper.Dispose( m_xDialog );
+ }
+
+ public void windowOpened( EventObject e )
+ {}
+
+ public void windowClosing( EventObject e )
+ {}
+
+ public void windowClosed( EventObject e )
+ {}
+
+ public void windowMinimized( EventObject e )
+ {}
+
+ public void windowNormalized( EventObject e )
+ {}
+
+ public void windowActivated( EventObject e )
+ {}
+
+ public void windowDeactivated( EventObject e )
+ {}
+
+ public void disposing( EventObject e )
+ {}
+}
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
new file mode 100644
index 000000000000..721b432779a1
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java
@@ -0,0 +1,429 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.awt.XThrobber;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lang.EventObject;
+import java.util.Hashtable;
+import javax.net.ssl.SSLException;
+
+import org.apache.commons.httpclient.*;
+import org.apache.commons.httpclient.methods.*;
+
+public class WikiEditSettingDialog extends WikiDialog
+{
+
+ private final String sOKMethod = "OK";
+
+ String[] Methods =
+ {sOKMethod };
+ private Hashtable setting;
+ private boolean addMode;
+ private boolean m_bAllowURLChange = true;
+
+ public WikiEditSettingDialog( XComponentContext xContext, String DialogURL )
+ {
+ super( xContext, DialogURL );
+ super.setMethods( Methods );
+ setting = new Hashtable();
+ addMode = true;
+
+ InsertThrobber( 184, 20, 10, 10 );
+ InitStrings( xContext );
+ InitSaveCheckbox( xContext, false );
+ }
+
+ public WikiEditSettingDialog( XComponentContext xContext, String DialogURL, Hashtable ht, boolean bAllowURLChange )
+ {
+ super( xContext, DialogURL );
+ super.setMethods( Methods );
+ setting = ht;
+
+ boolean bInitSaveCheckBox = false;
+
+ try
+ {
+ XPropertySet xUrlField = GetPropSet( "UrlField" );
+
+ xUrlField.setPropertyValue( "Text", ht.get( "Url" ) );
+
+ GetPropSet( "UsernameField" ).setPropertyValue( "Text", ht.get( "Username" ) );
+
+ if ( Helper.PasswordStoringIsAllowed( m_xContext ) )
+ {
+ String[] pPasswords = Helper.GetPasswordsForURLAndUser( m_xContext, (String)ht.get( "Url" ), (String)ht.get( "Username" ) );
+ bInitSaveCheckBox = ( pPasswords != null && pPasswords.length > 0 && pPasswords[0].equals( (String)ht.get( "Password" ) ) );
+ }
+
+ // the password should be entered by the user or the Cancel should be pressed
+ // GetPropSet( "PasswordField" ).setPropertyValue( "Text", ht.get( "Password" ));
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+
+ addMode = false;
+ m_bAllowURLChange = bAllowURLChange;
+
+ InsertThrobber( 184, 20, 10, 10 );
+ InitStrings( xContext );
+ InitSaveCheckbox( xContext, bInitSaveCheckBox );
+ }
+
+ public boolean show( )
+ {
+ SetThrobberVisible( false );
+ EnableControls( true );
+ boolean bResult = super.show();
+
+ try
+ {
+ if ( bResult && Helper.PasswordStoringIsAllowed( m_xContext )
+ && ( (Short)( GetPropSet( "SaveBox" ).getPropertyValue("State") ) ).shortValue() != (short)0 )
+ {
+ String sURL = (String)setting.get( "Url" );
+ String sUserName = (String)setting.get( "Username" );
+ String sPassword = (String)setting.get( "Password" );
+
+ if ( sURL != null && sURL.length() > 0 && sUserName != null && sUserName.length() > 0 && sPassword != null && sPassword.length() > 0 )
+ {
+ String[] pPasswords = { sPassword };
+ Helper.GetPasswordContainer( m_xContext ).addPersistent( sURL, sUserName, pPasswords, Helper.GetInteractionHandler( m_xContext ) );
+ }
+ }
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+
+ return bResult;
+ }
+
+ public void EnableControls( boolean bEnable )
+ {
+ if ( !bEnable )
+ SetFocusTo( "CancelButton" );
+
+ try
+ {
+ GetPropSet( "UsernameField" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+ GetPropSet( "PasswordField" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+ GetPropSet( "OkButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+ GetPropSet( "HelpButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+
+ if ( bEnable )
+ {
+ GetPropSet( "UrlField" ).setPropertyValue( "Enabled", new Boolean( m_bAllowURLChange ) );
+ GetPropSet( "SaveBox" ).setPropertyValue( "Enabled", new Boolean( Helper.PasswordStoringIsAllowed( m_xContext ) ) );
+ if ( m_bAllowURLChange )
+ SetFocusTo( "UrlField" );
+ else
+ SetFocusTo( "UsernameField" );
+ }
+ else
+ {
+ GetPropSet( "UrlField" ).setPropertyValue( "Enabled", Boolean.FALSE );
+ GetPropSet( "SaveBox" ).setPropertyValue( "Enabled", Boolean.FALSE );
+ }
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ private void InitStrings( XComponentContext xContext )
+ {
+ try
+ {
+ SetTitle( Helper.GetLocalizedString( xContext, Helper.DLG_MEDIAWIKI_TITLE ) );
+ GetPropSet( "UrlLabel" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_URLLABEL ) );
+ GetPropSet( "UsernameLabel" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_USERNAMELABEL ) );
+ GetPropSet( "PasswordLabel" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_PASSWORDLABEL ) );
+ GetPropSet( "AccountLine" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_ACCOUNTLINE ) );
+ GetPropSet( "WikiLine" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_WIKILINE ) );
+ GetPropSet( "SaveBox" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_EDITSETTING_SAVEBOX ) );
+ GetPropSet( "OkButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_OK ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void InitSaveCheckbox( XComponentContext xContext, boolean bInitSaveCheckBox )
+ {
+ XPropertySet xSaveCheck = GetPropSet( "SaveBox" );
+ try
+ {
+ xSaveCheck.setPropertyValue( "State", new Short( bInitSaveCheckBox ? (short)1 : (short)0 ) );
+ xSaveCheck.setPropertyValue( "Enabled", new Boolean( Helper.PasswordStoringIsAllowed( xContext ) ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void DoLogin( XDialog xDialog )
+ {
+ String sRedirectURL = "";
+ String sURL = "";
+ try
+ {
+ sURL = ( String ) GetPropSet( "UrlField" ).getPropertyValue( "Text" );
+ String sUserName = ( String ) GetPropSet( "UsernameField" ).getPropertyValue( "Text" );
+ String sPassword = ( String ) GetPropSet( "PasswordField" ).getPropertyValue( "Text" );
+
+ HostConfiguration aHostConfig = new HostConfiguration();
+ boolean bInitHost = true;
+ boolean bAllowIndex = true;
+
+ do
+ {
+ if ( sRedirectURL.length() > 0 )
+ {
+ sURL = sRedirectURL;
+ sRedirectURL = "";
+ }
+
+ if ( sURL.length() > 0 )
+ {
+ URI aURI = new URI( sURL );
+ GetMethod aRequest = new GetMethod( aURI.getEscapedPathQuery() );
+ aRequest.setFollowRedirects( false );
+ Helper.ExecuteMethod( aRequest, aHostConfig, aURI, m_xContext, bInitHost );
+ bInitHost = false;
+
+ int nResultCode = aRequest.getStatusCode();
+ String sWebPage = null;
+ if ( nResultCode == 200 )
+ sWebPage = aRequest.getResponseBodyAsString();
+ else if ( nResultCode >= 301 && nResultCode <= 303 || nResultCode == 307 )
+ sRedirectURL = aRequest.getResponseHeader( "Location" ).getValue();
+
+ aRequest.releaseConnection();
+
+ if ( sWebPage != null && sWebPage.length() > 0 )
+ {
+ //the URL is valid
+ String sMainURL = Helper.GetMainURL( sWebPage, sURL );
+
+ if ( sMainURL.equals( "" ) )
+ {
+ // TODO:
+ // it's not a Wiki Page, check first whether a redirect is requested
+ // happens usually in case of https
+ sRedirectURL = Helper.GetRedirectURL( sWebPage, sURL );
+ if ( sRedirectURL.equals( "" ) )
+ {
+ // show error
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.NOURLCONNECTION_ERROR,
+ sURL,
+ false );
+ }
+ }
+ else
+ {
+ URI aMainURI = new URI( sMainURL, true ); // it must be an escaped URL, otherwise an exception should be thrown
+
+ if ( ( sUserName.length() > 0 || sPassword.length() > 0 )
+ && Helper.Login( aMainURI, sUserName, sPassword, m_xContext ) == null )
+ {
+ // a wrong login information is provided
+ // show error
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.WRONGLOGIN_ERROR,
+ null,
+ false );
+ }
+ else
+ {
+ setting.put( "Url", aMainURI.getEscapedURI() );
+ setting.put( "Username", sUserName );
+ setting.put( "Password", sPassword );
+ if ( addMode )
+ {
+ // no cleaning of the settings is necessary
+ Settings.getSettings( m_xContext ).addWikiCon( setting );
+ Settings.getSettings( m_xContext ).storeConfiguration();
+ }
+
+ m_bAction = true;
+ }
+ }
+ }
+ else if ( sRedirectURL == null || sRedirectURL.length() == 0 )
+ {
+ if ( sURL.length() > 0 && !sURL.endsWith( "index.php" ) && bAllowIndex )
+ {
+ // the used MainURL is not alwais directly accessible
+ // add the suffix as workaround, but only once
+ sRedirectURL = sURL + "/index.php";
+ bAllowIndex = false;
+ }
+ else
+ {
+ // URL invalid
+ // show error
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.INVALIDURL_ERROR,
+ null,
+ false );
+ }
+ }
+ }
+ else
+ {
+ // URL field empty
+ // show error
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.NOURL_ERROR,
+ null,
+ false );
+ }
+ } while ( sRedirectURL.length() > 0 );
+ }
+ catch ( WikiCancelException ce )
+ {
+ }
+ catch ( SSLException essl )
+ {
+ if ( Helper.IsConnectionAllowed() )
+ {
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.UNKNOWNCERT_ERROR,
+ null,
+ false );
+ }
+ essl.printStackTrace();
+ }
+ catch ( Exception ex )
+ {
+ if ( Helper.IsConnectionAllowed() )
+ {
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_MEDIAWIKI_TITLE,
+ Helper.NOURLCONNECTION_ERROR,
+ sURL,
+ false );
+ }
+ ex.printStackTrace();
+ }
+ }
+
+ public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
+ {
+ if ( MethodName.equals( sOKMethod ) )
+ {
+ EnableControls( false );
+ SetThrobberVisible( true );
+ SetThrobberActive( true );
+
+ if ( Helper.AllowThreadUsage( m_xContext ) )
+ {
+ final XDialog xDialogForThread = xDialog;
+ final XComponentContext xContext = m_xContext;
+ final WikiEditSettingDialog aThis = this;
+
+ // the thread name is used to allow the error dialogs
+ m_bThreadFinished = false;
+ m_aThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
+ {
+ public void run()
+ {
+ try
+ {
+ Thread.yield();
+ } catch( java.lang.Exception e ){}
+
+ DoLogin( xDialogForThread );
+ aThis.EnableControls( true );
+ aThis.SetThrobberActive( false );
+ aThis.SetThrobberVisible( false );
+
+ ThreadStop( true );
+
+ if ( m_bAction )
+ MainThreadDialogExecutor.Close( xContext, xDialogForThread );
+ }
+ };
+
+ m_aThread.start();
+ }
+ else
+ {
+ try
+ {
+ DoLogin( xDialog );
+ } catch( java.lang.Exception e )
+ {}
+ finally
+ {
+ EnableControls( true );
+ SetThrobberActive( false );
+ SetThrobberVisible( false );
+
+ if ( m_bAction )
+ xDialog.endExecute();
+
+ Helper.AllowConnection( true );
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public void windowClosed( EventObject e )
+ {
+ ThreadStop( false );
+ }
+}
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
new file mode 100644
index 000000000000..0350e07fe8b6
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditorImpl.java
@@ -0,0 +1,476 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.PropertyValue;
+import com.sun.star.frame.DispatchDescriptor;
+import com.sun.star.frame.XComponentLoader;
+import com.sun.star.frame.XController;
+import com.sun.star.frame.XDesktop;
+import com.sun.star.frame.XDispatch;
+import com.sun.star.frame.XDispatchProvider;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XStatusListener;
+import com.sun.star.frame.XStorable;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.XComponent;
+import com.sun.star.lang.XInitialization;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XSingleComponentFactory;
+import com.sun.star.registry.XRegistryKey;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.util.XCloseBroadcaster;
+import com.sun.star.view.XSelectionSupplier;
+import java.io.File;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+import javax.net.ssl.SSLException;
+
+
+public final class WikiEditorImpl extends WeakBase
+ implements com.sun.star.lang.XServiceInfo, XDispatchProvider, XDispatch, XInitialization
+{
+
+ private final XComponentContext m_xContext;
+ private static final String m_implementationName = WikiEditorImpl.class.getName();
+ private static final String[] m_serviceNames = {"com.sun.star.wiki.WikiEditor" };
+
+ // information needed for component registration
+ public static final String[] supportedServiceNames = {"com.sun.star.frame.ProtocolHandler"};
+ public static final Class implementationClass = WikiEditorImpl.class;
+ // protocol name that this protocol handler handles
+ public static final String protocolName = "vnd.com.sun.star.wiki:";
+
+ private Map m_statusListeners = new HashMap();
+
+
+ private XComponent xComp;
+ private String sTempUrl;
+
+ private XFrame m_xFrame;
+ private XModel m_xModel;
+ private Settings m_aSettings;
+
+ private String m_aFilterName;
+
+ public WikiEditorImpl( XComponentContext xContext )
+ {
+ // Helper.trustAllSSL();
+ m_xContext = xContext;
+ m_aSettings = Settings.getSettings( m_xContext );
+ };
+
+ public static XSingleComponentFactory __getComponentFactory( String sImplementationName )
+ {
+ XSingleComponentFactory xFactory = null;
+
+ if ( sImplementationName.equals( m_implementationName ) )
+ xFactory = Factory.createComponentFactory( WikiEditorImpl.class, m_serviceNames );
+ else if ( sImplementationName.equals( WikiOptionsEventHandlerImpl.m_sImplementationName ) )
+ xFactory = Factory.createComponentFactory( WikiOptionsEventHandlerImpl.class,
+ WikiOptionsEventHandlerImpl.m_pServiceNames );
+
+ return xFactory;
+ }
+
+ public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey )
+ {
+ boolean bResult = Factory.writeRegistryServiceInfo( m_implementationName,
+ m_serviceNames,
+ xRegistryKey );
+ return ( bResult && Factory.writeRegistryServiceInfo( WikiOptionsEventHandlerImpl.m_sImplementationName,
+ WikiOptionsEventHandlerImpl.m_pServiceNames,
+ xRegistryKey ) );
+ }
+
+ // com.sun.star.lang.XServiceInfo:
+ public String getImplementationName()
+ {
+ return m_implementationName;
+ }
+
+ public boolean supportsService( String sService )
+ {
+ int len = m_serviceNames.length;
+
+ for( int i=0; i < len; i++ )
+ {
+ if ( sService.equals( m_serviceNames[i] ))
+ return true;
+ }
+ return false;
+ }
+
+ public String[] getSupportedServiceNames()
+ {
+ return m_serviceNames;
+ }
+
+
+ private XSelectionSupplier m_sel;
+ private XController m_ctrl;
+ private boolean m_bInitialized;
+ public synchronized void initialize( Object[] args ) throws com.sun.star.uno.Exception
+ {
+ if ( m_bInitialized )
+ {
+ //logger.log( Level.SEVERE, "Extension instance was initialized again" );
+ }
+ if ( args.length > 0 )
+ {
+ m_bInitialized = true;
+ m_xFrame = ( XFrame )UnoRuntime.queryInterface( XFrame.class, args[0] );
+ // become close listener
+ XCloseBroadcaster cb = ( XCloseBroadcaster )UnoRuntime.queryInterface(
+ XCloseBroadcaster.class, m_xFrame );
+ }
+ }
+
+
+
+ public void dispatch(
+ final com.sun.star.util.URL aURL,
+ com.sun.star.beans.PropertyValue[] propertyValue )
+ {
+ final com.sun.star.util.URL myURL = aURL;
+ //logger.log( Level.INFO, "received dispatch request for: "+aURL.Complete );
+ if ( aURL.Protocol.compareTo( protocolName ) == 0 )
+ {
+ /*
+ synchronized( this )
+ {
+ if( m_bClosing ) return;
+ else m_bActive = true;
+ }
+ **/
+
+ try
+ {
+ if ( myURL.Path.compareTo( "send" ) == 0 )
+ {
+ sendArticle();
+ }
+ } catch( java.lang.Throwable t )
+ {
+ //logger.log( Level.WARNING, "exception while handeling dispatch", t );
+ }
+
+ /*
+ synchronized( this )
+ {
+ m_bActive = false;
+ // if we became owner while we were active
+ // we are responsible for closing the m_xFrame now
+ if ( m_bOwner && m_xFrame != null )
+ {
+ try
+ {
+ XCloseable xclose = ( XCloseable )UnoRuntime.queryInterface(
+ XCloseable.class, m_xFrame );
+ xclose.close( true );
+ } catch ( CloseVetoException cve )
+ {
+ logger.log( Level.SEVERE, "cannot close owned frame" );
+ }
+ // relase reference to the m_xFrame;
+ m_xFrame = null;
+ }
+ }
+ */
+ }
+ }
+
+
+ public com.sun.star.frame.XDispatch queryDispatch(
+ com.sun.star.util.URL aURL,
+ String str,
+ int param )
+ {
+ if ( aURL.Protocol.equals( protocolName ))
+ {
+
+ // by default, we are responsible
+ return this;
+ } else
+ {
+ return null;
+ }
+ }
+
+ public XDispatch[] queryDispatches( DispatchDescriptor[] seqDescripts )
+ {
+ int nCount = seqDescripts.length;
+ XDispatch[] lDispatcher = new XDispatch[nCount];
+
+ for( int i=0; i<nCount; ++i )
+ lDispatcher[i] = queryDispatch(
+ seqDescripts[i].FeatureURL,
+ seqDescripts[i].FrameName,
+ seqDescripts[i].SearchFlags );
+ return lDispatcher;
+ }
+
+
+ public void removeStatusListener(
+ com.sun.star.frame.XStatusListener xStatusListener,
+ com.sun.star.util.URL aURL )
+ {
+ }
+
+
+ public void addStatusListener(
+ com.sun.star.frame.XStatusListener listener,
+ com.sun.star.util.URL url )
+ {
+ String urlstring = url.Complete;
+ m_statusListeners.put( urlstring, listener );
+ // synchroneous callback required!!!
+ callStatusListener( urlstring, listener );
+ }
+
+ public void callStatusListeners()
+ {
+ Set entries = m_statusListeners.entrySet();
+ Iterator iter = entries.iterator();
+ while ( iter.hasNext() )
+ {
+ Map.Entry entry = ( Map.Entry ) iter.next();
+ String uristring = ( String ) entry.getKey();
+ XStatusListener listener = ( XStatusListener ) entry.getValue();
+ callStatusListener( uristring, listener );
+ }
+ }
+
+ public void callStatusListener( String uristring, XStatusListener listener )
+ {
+ try
+ {
+
+ URI uri = new URI( uristring );
+
+ // check whether any blogs are live...
+ setListenerState( listener, "command", false );
+ } catch ( URISyntaxException ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+
+
+ private void setListenerState( XStatusListener listener, String urlstring, boolean state )
+ {
+ com.sun.star.util.URL url = new com.sun.star.util.URL();
+ url.Complete = urlstring;
+ //listener.statusChanged( new FeatureStateEvent( this, url, "", state, false, null ));
+
+ }
+
+ public void sendArticle()
+ {
+ if ( m_xFrame != null )
+ {
+ WikiPropDialog aSendDialog = null;
+ try
+ {
+ if ( m_xModel == null )
+ {
+ XController xController = m_xFrame.getController();
+ if ( xController != null )
+ m_xModel = xController.getModel();
+ }
+
+ if ( m_xModel != null )
+ {
+ // The related Wiki filter must be detected from the typename
+ String aServiceName = Helper.GetDocServiceName( m_xContext, m_xModel );
+ m_aFilterName = Helper.GetFilterName( m_xContext, "MediaWiki", aServiceName );
+
+ if ( m_aFilterName == null || m_aFilterName.length() == 0 )
+ {
+ Helper.ShowError( m_xContext,
+ (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ Helper.DLG_SENDTITLE,
+ Helper.NOWIKIFILTER_ERROR,
+ null,
+ false );
+ throw new com.sun.star.uno.RuntimeException();
+ }
+
+ m_aSettings.loadConfiguration(); // throw away all the noncommited changes
+ // show the send dialog
+ aSendDialog = new WikiPropDialog( m_xContext, "vnd.sun.star.script:WikiEditor.SendToMediaWiki?location=application", this );
+ aSendDialog.fillWikiList();
+ aSendDialog.SetWikiTitle( Helper.GetDocTitle( m_xModel ) );
+ aSendDialog.show(); // triggers the sending
+ }
+ }
+ catch ( Exception e )
+ {
+ // TODO: Error handling here
+ e.printStackTrace();
+ }
+ finally
+ {
+ if ( aSendDialog != null )
+ aSendDialog.DisposeDialog();
+ }
+ }
+ }
+
+ public boolean SendArticleImpl( WikiPropDialog aSendDialog, Hashtable aWikiSetting )
+ {
+ boolean bResult = false;
+
+ if ( aSendDialog != null )
+ {
+ String sTemp2Url = null;
+
+ try
+ {
+ // TODO: stop progress spinning
+ WikiArticle aArticle = new WikiArticle( m_xContext, aSendDialog.GetWikiTitle(), aWikiSetting, true, aSendDialog );
+
+ boolean bAllowSending = true;
+ if ( !aArticle.NotExist() )
+ {
+ // ask whether creation of a new page is allowed
+ aSendDialog.SetThrobberActive( false );
+ bAllowSending = Helper.ShowError(
+ m_xContext,
+ (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ Helper.DLG_SENDTITLE,
+ Helper.DLG_WIKIPAGEEXISTS_LABEL1,
+ aSendDialog.GetWikiTitle(),
+ true );
+ aSendDialog.SetThrobberActive( true );
+ }
+
+ if ( bAllowSending )
+ {
+ PropertyValue[] lProperties = new PropertyValue[2];
+ lProperties[0] = new PropertyValue();
+ lProperties[0].Name = "FilterName";
+ lProperties[0].Value = m_aFilterName;
+ lProperties[1] = new PropertyValue();
+ lProperties[1].Name = "Overwrite";
+ lProperties[1].Value = new Boolean( true );
+
+ sTemp2Url = Helper.CreateTempFile( m_xContext );
+
+ XStorable xStore = ( com.sun.star.frame.XStorable )UnoRuntime.queryInterface ( XStorable.class, m_xModel );
+ if ( xStore == null )
+ throw new com.sun.star.uno.RuntimeException();
+
+ xStore.storeToURL( sTemp2Url, lProperties );
+ String sWikiCode = Helper.EachLine( sTemp2Url );
+
+ if ( aArticle.setArticle( sWikiCode, aSendDialog.m_sWikiComment, aSendDialog.m_bWikiMinorEdit ) )
+ {
+ bResult = true;
+ Object desktop = m_xContext.getServiceManager().createInstanceWithContext( "com.sun.star.frame.Desktop", m_xContext );
+ XDesktop xDesktop = ( XDesktop ) UnoRuntime.queryInterface( com.sun.star.frame.XDesktop.class, desktop );
+ Helper.SetDocTitle( m_xModel, aArticle.GetTitle() );
+ Hashtable aDocInfo = new Hashtable();
+ aDocInfo.put( "Doc", aArticle.GetTitle() );
+ aDocInfo.put( "Url", aArticle.GetMainURL() );
+ aDocInfo.put( "CompleteUrl", aArticle.GetMainURL() + aArticle.GetTitle() );
+ m_aSettings.addWikiDoc( aDocInfo );
+ m_aSettings.storeConfiguration();
+ }
+ else
+ {
+ Helper.ShowError( m_xContext,
+ (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ Helper.DLG_SENDTITLE,
+ Helper.GENERALSEND_ERROR,
+ null,
+ false );
+ }
+ }
+ }
+ catch( WikiCancelException ec )
+ {
+ // nothing to do, the sending was cancelled
+ }
+ catch( SSLException essl )
+ {
+ if ( Helper.IsConnectionAllowed() )
+ {
+ // report the error only if sending was not cancelled
+ Helper.ShowError( m_xContext,
+ (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ Helper.DLG_SENDTITLE,
+ Helper.UNKNOWNCERT_ERROR,
+ null,
+ false );
+ }
+ }
+ catch( Exception e )
+ {
+ if ( Helper.IsConnectionAllowed() )
+ {
+ // report the error only if sending was not cancelled
+ Helper.ShowError( m_xContext,
+ (XWindowPeer)UnoRuntime.queryInterface( XWindowPeer.class, m_xFrame.getContainerWindow() ),
+ Helper.DLG_SENDTITLE,
+ Helper.GENERALSEND_ERROR,
+ null,
+ false );
+ }
+ e.printStackTrace();
+ }
+
+ if ( sTemp2Url != null )
+ {
+ try
+ {
+ // remove the temporary file
+ File aFile = new File( new URI( sTemp2Url ) );
+ aFile.delete();
+ }
+ catch ( java.lang.Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ return bResult;
+ }
+
+}
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
new file mode 100644
index 000000000000..8b635d85c316
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.XContainerWindowEventHandler;
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlContainer;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XDialogEventHandler;
+import com.sun.star.awt.XWindow;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XServiceInfo;
+import com.sun.star.lib.uno.helper.WeakBase;
+import com.sun.star.uno.AnyConverter;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import java.util.Hashtable;
+
+public final class WikiOptionsEventHandlerImpl extends WeakBase
+ implements XServiceInfo, XContainerWindowEventHandler, XDialogEventHandler
+{
+ static final String[] m_pServiceNames = { "com.sun.star.wiki.WikiOptionsEventHandler" };
+ static final String m_sImplementationName = WikiOptionsEventHandlerImpl.class.getName();
+
+ static final String sExternalEvent = "external_event";
+ static final String sAdd = "Add";
+ static final String sEdit = "Edit";
+ static final String sRemove = "Remove";
+ static final String sListStatus = "ListStatus";
+ static final String sListEdit = "ListEdit";
+ static final String sInitialize = "initialize";
+ static final String sOk = "ok";
+ static final String sBack = "back";
+
+ private XComponentContext m_xContext;
+ private XDialog m_xDialog;
+ private XControlContainer m_xControlContainer;
+
+ Settings m_aSettings;
+
+ public WikiOptionsEventHandlerImpl( XComponentContext xContext )
+ {
+ m_xContext = xContext;
+ }
+
+ protected XPropertySet GetPropSet( String sControl )
+ {
+ if ( m_xControlContainer != null )
+ {
+ XControl xControl = m_xControlContainer.getControl(sControl);
+ XPropertySet xListProps = (XPropertySet)UnoRuntime.queryInterface(XPropertySet.class, xControl.getModel() );
+ return xListProps;
+ }
+
+ return null;
+ }
+
+ private void RefreshView()
+ {
+ if ( m_aSettings != null )
+ {
+ String[] pWikiList = m_aSettings.getWikiURLs();
+ XPropertySet xListProps = GetPropSet( "WikiList" );
+ if ( xListProps != null )
+ {
+ try
+ {
+ xListProps.setPropertyValue( "StringItemList", pWikiList );
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private void CheckButtonState()
+ {
+ XPropertySet xListProps = GetPropSet( "WikiList" );
+ if ( xListProps != null )
+ {
+ try
+ {
+ short [] pSel = (short []) xListProps.getPropertyValue( "SelectedItems" );
+ XPropertySet xEditProps = GetPropSet( "EditButton" );
+ XPropertySet xRemoveProps = GetPropSet( "RemoveButton" );
+ Boolean bState = new Boolean( pSel.length != 0 );
+
+ xEditProps.setPropertyValue( "Enabled", bState );
+ xRemoveProps.setPropertyValue( "Enabled", bState );
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private void AddSetting()
+ {
+ WikiEditSettingDialog aSettingDialog = new WikiEditSettingDialog( m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application" );
+ if ( aSettingDialog.show() )
+ RefreshView();
+
+ aSettingDialog.DisposeDialog();
+ }
+
+ private void EditSetting()
+ {
+ XPropertySet xListProps = GetPropSet( "WikiList" );
+ if ( xListProps != null )
+ {
+ Hashtable ht = null;
+ try
+ {
+ short[] pSel = (short []) xListProps.getPropertyValue( "SelectedItems" );
+ String[] pItems = (String []) xListProps.getPropertyValue("StringItemList");
+ if ( pSel.length > 0 && pItems.length > pSel[0] )
+ {
+ String selName = pItems[pSel[0]];
+ ht = m_aSettings.getSettingByUrl( pItems[pSel[0]] );
+ }
+ }
+ catch ( Exception ex )
+ {
+ ex.printStackTrace();
+ }
+
+ WikiEditSettingDialog aSettingDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", ht, true );
+ if ( aSettingDialog.show() )
+ RefreshView();
+
+ aSettingDialog.DisposeDialog();
+ }
+ }
+
+ private void RemoveSetting()
+ {
+ XPropertySet xListProps = GetPropSet("WikiList");
+ if ( xListProps != null )
+ {
+ try
+ {
+ short[] pSel = (short []) xListProps.getPropertyValue("SelectedItems");
+ String[] pItems = (String []) GetPropSet("WikiList").getPropertyValue("StringItemList");
+ if ( pSel.length > 0 && pItems.length > pSel[0] )
+ {
+ m_aSettings.removeSettingByUrl( pItems[pSel[0]] );
+ RefreshView();
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+
+ private void InitStrings()
+ {
+ try
+ {
+
+ GetPropSet( "FixedLine1" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_MEDIAWIKIEXTENSION_STRING ) );
+ GetPropSet( "AddButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_ADDBUTTON ) );
+ GetPropSet( "EditButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_EDITBUTTON ) );
+ GetPropSet( "RemoveButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_REMOVEBUTTON ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ // com.sun.star.lang.XServiceInfo:
+ public String getImplementationName()
+ {
+ return m_sImplementationName;
+ }
+
+ public boolean supportsService( String sService )
+ {
+ int len = m_pServiceNames.length;
+
+ for( int i=0; i < len; i++ )
+ {
+ if ( sService.equals( m_pServiceNames[i] ))
+ return true;
+ }
+ return false;
+ }
+
+ public String[] getSupportedServiceNames()
+ {
+ return m_pServiceNames;
+ }
+
+ // XContainerWindowEventHandler
+ public boolean callHandlerMethod( XWindow xWindow, Object aEventObject, String sMethod )
+ throws WrappedTargetException, com.sun.star.uno.RuntimeException
+ {
+ if ( sMethod.equals( sExternalEvent ) )
+ {
+ try
+ {
+ String sEvent = (String)AnyConverter.toString( aEventObject );
+ if ( sEvent != null )
+ {
+ if ( sEvent.equals( sOk ) )
+ {
+ if ( m_aSettings != null )
+ m_aSettings.storeConfiguration();
+ }
+ else if ( sEvent.equals( sInitialize ) || sEvent.equals( sBack ) )
+ {
+ if ( sEvent.equals( sInitialize ) )
+ {
+ m_xDialog = (XDialog)UnoRuntime.queryInterface( XDialog.class, xWindow );
+ m_xControlContainer = (XControlContainer)UnoRuntime.queryInterface(
+ XControlContainer.class, m_xDialog );
+ m_aSettings = Settings.getSettings( m_xContext );
+ m_aSettings.loadConfiguration(); // throw away all the noncommited changes
+ InitStrings();
+ }
+ else if ( m_aSettings != null )
+ m_aSettings.loadConfiguration(); // throw away all the noncommited changes
+
+ RefreshView();
+ CheckButtonState();
+ }
+ }
+ }
+ catch ( com.sun.star.uno.RuntimeException r )
+ {
+ throw r;
+ }
+ catch ( com.sun.star.uno.Exception e )
+ {
+ throw new WrappedTargetException( sMethod, this, e );
+ }
+ }
+ else if ( sMethod.equals( sAdd ) )
+ {
+ AddSetting();
+ }
+ else if ( sMethod.equals( sEdit ) || sMethod.equals( sListEdit ) )
+ {
+ EditSetting();
+ }
+ else if ( sMethod.equals( sRemove ) )
+ {
+ RemoveSetting();
+ CheckButtonState();
+ }
+ else if ( sMethod.equals( sListStatus ) )
+ {
+ CheckButtonState();
+ }
+
+ return true;
+ }
+
+ public boolean callHandlerMethod( XDialog xDialog, Object aEventObject, String sMethod )
+ throws WrappedTargetException, com.sun.star.uno.RuntimeException
+ {
+
+
+ return true;
+ }
+
+ public String[] getSupportedMethodNames()
+ {
+ return new String[] { sExternalEvent, sAdd, sEdit, sRemove };
+ }
+};
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
new file mode 100644
index 000000000000..317f35a3170b
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java
@@ -0,0 +1,388 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import com.sun.star.awt.XControl;
+import com.sun.star.awt.XControlModel;
+import com.sun.star.awt.XDialog;
+import com.sun.star.awt.XThrobber;
+import com.sun.star.awt.XWindowPeer;
+import com.sun.star.beans.UnknownPropertyException;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.container.XNameContainer;
+import com.sun.star.lang.WrappedTargetException;
+import com.sun.star.lang.XMultiComponentFactory;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.EventObject;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import java.util.Hashtable;
+
+public class WikiPropDialog extends WikiDialog{
+
+ WikiEditorImpl m_aWikiEditor;
+
+ private final String sSendMethod = "Send";
+ private final String sWikiListMethod = "WikiListChange";
+ private final String sArticleTextMethod = "ArticleTextChange";
+ private final String sAddWikiMethod = "AddWiki";
+
+ String[] m_pMethods = {sSendMethod, sWikiListMethod, sArticleTextMethod, sAddWikiMethod};
+
+ private String m_sWikiTitle = "";
+ protected String m_sWikiEngineURL = "";
+ protected String m_sWikiComment = "";
+ protected boolean m_bWikiMinorEdit = false;
+
+ /** Creates a new instance of WikiPropDialog */
+ public WikiPropDialog(XComponentContext xContext, String DialogURL, WikiEditorImpl aWikiEditorForThrobber )
+ {
+ super(xContext, DialogURL);
+ super.setMethods(m_pMethods);
+
+ if ( aWikiEditorForThrobber != null )
+ {
+ InsertThrobber( 224, 122, 10, 10 );
+ m_aWikiEditor = aWikiEditorForThrobber;
+ }
+
+ InitStrings( xContext );
+ InitShowBrowser( xContext );
+ InitControls( xContext );
+ }
+
+ private void InitControls( XComponentContext xContext )
+ {
+ try
+ {
+ GetPropSet( "CommentText" ).setPropertyValue( "AutoVScroll", Boolean.TRUE );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void InitStrings( XComponentContext xContext )
+ {
+ try
+ {
+ SetTitle( Helper.GetLocalizedString( xContext, Helper.DLG_SENDTITLE ) );
+ GetPropSet( "Label1" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL1 ) );
+ GetPropSet( "FixedLine2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_WIKIARTICLE ) );
+ GetPropSet( "Label2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL2 ) );
+ GetPropSet( "Label3" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL3 ) );
+ GetPropSet( "MinorCheck" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_MINORCHECK ) );
+ GetPropSet( "BrowserCheck" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_BROWSERCHECK ) );
+ GetPropSet( "AddButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_ADDBUTTON ) );
+ GetPropSet( "SendButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDBUTTON ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private void InitShowBrowser( XComponentContext xContext )
+ {
+ try
+ {
+ GetPropSet( "BrowserCheck" ).setPropertyValue( "State", new Short( Helper.GetShowInBrowserByDefault( m_xContext ) ? (short)1 : (short)0 ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public boolean show()
+ {
+ EnableControls( true );
+ boolean bResult = super.show();
+
+ if ( bResult && Helper.GetShowInBrowserByDefault( m_xContext ) )
+ Helper.ShowURLInBrowser( m_xContext, m_sWikiEngineURL + "index.php?title=" + m_sWikiTitle );
+
+ return bResult;
+ }
+
+ public synchronized void ThreadStop( boolean bSelf )
+ {
+ boolean bShowError = ( !bSelf && m_aThread != null && !m_bThreadFinished );
+
+ super.ThreadStop( bSelf );
+
+ if ( bShowError )
+ Helper.ShowError( m_xContext,
+ m_xDialog,
+ Helper.DLG_SENDTITLE,
+ Helper.CANCELSENDING_ERROR,
+ null,
+ false );
+ }
+
+ public void fillWikiList()
+ {
+ String [] WikiList = m_aSettings.getWikiURLs();
+
+ try
+ {
+ XPropertySet xPS = GetPropSet("WikiList");
+ xPS.setPropertyValue("StringItemList", WikiList);
+ // short [] nSel = new short[1];
+ // nSel[0] = (short) m_aSettings.getLastUsedWikiServer();
+ // xPS.setPropertyValue("SelectedItems", sel);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public void fillDocList()
+ {
+ XPropertySet xPS = GetPropSet("ArticleText");
+ try
+ {
+ short [] sel = (short[]) GetPropSet("WikiList").getPropertyValue("SelectedItems");
+ xPS.setPropertyValue("StringItemList", m_aSettings.getWikiDocList(sel[0], 5));
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+
+ public String GetWikiTitle()
+ {
+ return m_sWikiTitle;
+ }
+
+ public void SetWikiTitle(String sArticle)
+ {
+ m_sWikiTitle = sArticle;
+ try
+ {
+ XPropertySet xPS = GetPropSet("ArticleText");
+ xPS.setPropertyValue("Text", sArticle);
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+
+ public void switchSendButtonIfNecessary()
+ {
+ XPropertySet xSendButton = GetPropSet( "SendButton" );
+ if ( xSendButton != null )
+ {
+ XPropertySet xWikiListProps = GetPropSet( "WikiList" );
+ XPropertySet xArticleProps = GetPropSet( "ArticleText" );
+ if ( xWikiListProps != null && xArticleProps != null )
+ {
+ try
+ {
+ short [] pSel = (short[]) GetPropSet("WikiList").getPropertyValue("SelectedItems");
+ String sArticle = (String)xArticleProps.getPropertyValue( "Text" );
+ if ( pSel != null && pSel.length > 0 && sArticle != null && sArticle.length() != 0 )
+ xSendButton.setPropertyValue( "Enabled", Boolean.TRUE );
+ else
+ xSendButton.setPropertyValue( "Enabled", Boolean.FALSE );
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+ public void EnableControls( boolean bEnable )
+ {
+ try
+ {
+ String[] pControls = { "WikiList",
+ "ArticleText",
+ "CommentText",
+ "MinorCheck",
+ "BrowserCheck",
+ "HelpButton",
+ "AddButton" };
+
+ for ( int nInd = 0; nInd < pControls.length; nInd++ )
+ GetPropSet( pControls[nInd] ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+
+ if ( bEnable )
+ {
+ SetFocusTo( "WikiList" );
+ switchSendButtonIfNecessary();
+ }
+ else
+ {
+ GetPropSet( "SendButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
+ SetFocusTo( "CancelButton" );
+ }
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+ }
+
+ public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
+ {
+ if ( MethodName.equals( sSendMethod ) )
+ {
+ try
+ {
+ XPropertySet aWikiListProps = GetPropSet( "WikiList" );
+ XPropertySet aArticleTextProps = GetPropSet( "ArticleText" );
+ XPropertySet aCommentTextProps = GetPropSet( "CommentText" );
+ XPropertySet aMinorCheckProps = GetPropSet( "MinorCheck" );
+ XPropertySet aBrowserCheckProps = GetPropSet( "BrowserCheck" );
+
+ short [] sel = (short[]) aWikiListProps.getPropertyValue("SelectedItems");
+ String [] items = (String []) aWikiListProps.getPropertyValue("StringItemList");
+ m_sWikiEngineURL = items[sel[0]];
+ m_aSettings.setLastUsedWikiServer(sel[0]);
+ m_sWikiTitle = (String) aArticleTextProps.getPropertyValue("Text");
+ m_sWikiComment = (String) aCommentTextProps.getPropertyValue("Text");
+
+ short minorState = ((Short) aMinorCheckProps.getPropertyValue("State")).shortValue();
+ if (minorState != 0)
+ m_bWikiMinorEdit = true;
+ else
+ m_bWikiMinorEdit = false;
+
+ short nBrowserState = ((Short) aBrowserCheckProps.getPropertyValue("State")).shortValue();
+ Helper.SetShowInBrowserByDefault( m_xContext, nBrowserState != 0 );
+
+ // allow to disable other buttons
+ EnableControls( false );
+ }
+ catch (Exception ex)
+ {
+ ex.printStackTrace();
+ }
+
+ final WikiPropDialog aThisDialog = this;
+ final XDialog xDialogToClose = xDialog;
+ final XComponentContext xContext = m_xContext;
+
+ // start spinning
+ SetThrobberVisible( true );
+ SetThrobberActive( true );
+
+ // the following method might show a dialog, should be used in main thread
+ final Hashtable aWikiSettings = m_aSettings.getSettingByUrl( m_sWikiEngineURL );
+ if ( Helper.AllowThreadUsage( m_xContext ) )
+ {
+ m_aThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
+ {
+ public void run()
+ {
+ try
+ {
+ if ( m_aWikiEditor != null )
+ {
+ Thread.yield();
+ m_bAction = m_aWikiEditor.SendArticleImpl( aThisDialog, aWikiSettings );
+ }
+ }
+ finally
+ {
+ EnableControls( true );
+ SetThrobberActive( false );
+ SetThrobberVisible( false );
+
+ ThreadStop( true );
+ if ( m_bAction )
+ MainThreadDialogExecutor.Close( xContext, xDialogToClose );
+ }
+ }
+ };
+
+ m_aThread.start();
+ }
+ else
+ {
+ try
+ {
+ if ( m_aWikiEditor != null )
+ {
+ m_bAction = m_aWikiEditor.SendArticleImpl( aThisDialog, aWikiSettings );
+ }
+ } catch( java.lang.Exception e )
+ {}
+ finally
+ {
+ EnableControls( true );
+ SetThrobberActive( false );
+ SetThrobberVisible( false );
+
+ if ( m_bAction )
+ xDialogToClose.endExecute();
+ }
+ }
+
+ return true;
+ }
+ else if ( MethodName.equals( sWikiListMethod ) )
+ {
+ fillDocList();
+ switchSendButtonIfNecessary();
+ return true;
+ }
+ else if ( MethodName.equals( sArticleTextMethod ) )
+ {
+ switchSendButtonIfNecessary();
+ return true;
+ }
+ else if ( MethodName.equals( sAddWikiMethod ) )
+ {
+ WikiEditSettingDialog xAddDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application");
+ if ( xAddDialog.show() )
+ fillWikiList();
+
+ xAddDialog.DisposeDialog();
+
+ return true;
+ }
+
+ return false;
+ }
+
+ public void windowClosed( EventObject e )
+ {
+ ThreadStop( false );
+ }
+}
+
diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java
new file mode 100644
index 000000000000..653eaca8466a
--- /dev/null
+++ b/swext/mediawiki/src/com/sun/star/wiki/WikiProtocolSocketFactory.java
@@ -0,0 +1,168 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package com.sun.star.wiki;
+
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.security.KeyStore;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import org.apache.commons.httpclient.ConnectTimeoutException;
+import org.apache.commons.httpclient.HttpClientError;
+import org.apache.commons.httpclient.params.HttpConnectionParams;
+import org.apache.commons.httpclient.protocol.SecureProtocolSocketFactory;
+
+class WikiProtocolSocketFactory implements SecureProtocolSocketFactory
+{
+ private SSLContext m_aSSLContext;
+
+ public WikiProtocolSocketFactory()
+ {
+ super();
+ }
+
+ public synchronized SSLContext GetNotSoSecureSSLContext()
+ {
+ if ( m_aSSLContext == null )
+ {
+ TrustManager[] pTrustUnknownCerts = new TrustManager[]
+ {
+ new X509TrustManager() {
+ private X509TrustManager m_aOrgTrustManager;
+
+ private X509TrustManager GetOrgTrustManager()
+ {
+ if ( m_aOrgTrustManager == null )
+ {
+ try
+ {
+ TrustManagerFactory aFactory = TrustManagerFactory.getInstance( TrustManagerFactory.getDefaultAlgorithm() );
+ aFactory.init( (KeyStore)null );
+ TrustManager[] pTrustmanagers = aFactory.getTrustManagers();
+ if ( pTrustmanagers.length != 0 && pTrustmanagers[0] != null )
+ m_aOrgTrustManager = (X509TrustManager)pTrustmanagers[0];
+ }
+ catch( Exception e )
+ {
+ throw new RuntimeException( "No access to the default trust manager!" );
+ }
+ }
+
+ return m_aOrgTrustManager;
+ }
+
+ public X509Certificate[] getAcceptedIssuers()
+ {
+ return GetOrgTrustManager().getAcceptedIssuers();
+ }
+
+ public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException
+ {
+ GetOrgTrustManager().checkClientTrusted( certs, authType );
+ }
+
+ public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException
+ {
+ if ( certs == null || certs.length == 0 )
+ GetOrgTrustManager().checkServerTrusted( certs, authType );
+ else
+ for ( int nInd = 0; nInd < certs.length; nInd++ )
+ certs[nInd].checkValidity();
+ }
+ }
+ };
+
+ try
+ {
+ SSLContext aContext = SSLContext.getInstance("SSL");
+ if ( aContext != null )
+ {
+ aContext.init( null, pTrustUnknownCerts, null );
+ m_aSSLContext = aContext;
+ }
+ }
+ catch ( Exception e )
+ {
+ }
+ }
+
+ if ( m_aSSLContext == null )
+ throw new HttpClientError();
+
+ return m_aSSLContext;
+ }
+
+ public Socket createSocket( String sHost, int nPort, InetAddress clientHost, int clientPort )
+ throws IOException, UnknownHostException
+ {
+ return GetNotSoSecureSSLContext().getSocketFactory().createSocket( sHost, nPort, clientHost, clientPort );
+ }
+
+ public Socket createSocket( final String sHost, final int nPort, final InetAddress aLocalAddress, final int nLocalPort, final HttpConnectionParams params )
+ throws IOException, UnknownHostException, ConnectTimeoutException
+ {
+ if ( params == null )
+ return createSocket( sHost, nPort, aLocalAddress, nLocalPort );
+
+ int nTimeout = params.getConnectionTimeout();
+ Socket aSocket = GetNotSoSecureSSLContext().getSocketFactory().createSocket();
+ aSocket.bind( new InetSocketAddress( aLocalAddress, nLocalPort ) );
+ aSocket.connect( new InetSocketAddress( sHost, nPort ), nTimeout );
+ return aSocket;
+ }
+
+ public Socket createSocket( String sHost, int nPort )
+ throws IOException, UnknownHostException
+ {
+ return GetNotSoSecureSSLContext().getSocketFactory().createSocket( sHost, nPort );
+ }
+
+ public Socket createSocket( Socket aSocket, String sHost, int nPort, boolean bAutoClose )
+ throws IOException, UnknownHostException
+ {
+ return GetNotSoSecureSSLContext().getSocketFactory().createSocket( aSocket, sHost, nPort, bAutoClose );
+ }
+
+ public boolean equals(Object obj)
+ {
+ return ((obj != null) && obj.getClass().equals(WikiProtocolSocketFactory.class));
+ }
+
+ public int hashCode()
+ {
+ return WikiProtocolSocketFactory.class.hashCode();
+ }
+};
+
diff --git a/swext/mediawiki/src/description.xml b/swext/mediawiki/src/description.xml
new file mode 100644
index 000000000000..7f533d97d320
--- /dev/null
+++ b/swext/mediawiki/src/description.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<description xmlns="http://openoffice.org/extensions/description/2006" xmlns:d="http://openoffice.org/extensions/description/2006" xmlns:xlink="http://www.w3.org/1999/xlink">
+ <version value="1.1.1"/>
+ <identifier value="@WIKIEXTENSIONID@"/>
+ <display-name>
+ <name lang="en-US">@WIKIEXTENSIONPRODUCTNAME@</name>
+ </display-name>
+ <dependencies>
+ <OpenOffice.org-minimal-version value="3.0" d:name="OpenOffice.org 3.0 or StarOffice 9"/>
+ </dependencies>
+ <publisher>
+ <name xlink:href="http://www.oracle.com/us/products/applications/open-office" lang="en">Oracle</name>
+ </publisher>
+</description>
diff --git a/swext/mediawiki/src/filter/mediawiki.ott b/swext/mediawiki/src/filter/mediawiki.ott
new file mode 100644
index 000000000000..eb94e9607bc0
--- /dev/null
+++ b/swext/mediawiki/src/filter/mediawiki.ott
Binary files differ
diff --git a/swext/mediawiki/src/filter/odt2mediawiki.xsl b/swext/mediawiki/src/filter/odt2mediawiki.xsl
new file mode 100755
index 000000000000..8d21a1cda1fd
--- /dev/null
+++ b/swext/mediawiki/src/filter/odt2mediawiki.xsl
@@ -0,0 +1,1567 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+ odt2wiki: OpenDocument to WikiMedia transformation
+ Copyright (C) 2007 Bernhard Haumacher (haui at haumacher dot de)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+-->
+<stylesheet version="1.0"
+ xmlns="http://www.w3.org/1999/XSL/Transform"
+
+ xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0"
+ xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0"
+ xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0"
+ xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0"
+ xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"
+ xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"
+ xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0"
+ xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"
+ xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"
+ xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0"
+ xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"
+ xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0"
+ xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:math="http://www.w3.org/1998/Math/MathML"
+ xmlns:dom="http://www.w3.org/2001/xml-events"
+ xmlns:xforms="http://www.w3.org/2002/xforms"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+>
+
+ <!--
+ == Customization options ==
+ -->
+
+ <!-- Constant defining the newline token. -->
+ <param name="NL" select="'&#10;'"/>
+
+ <!-- String that a tabulator is expanded with in preformatted paragraphs. -->
+
+ <variable name="codetabdocument-value"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='CODE_TAB_REPLACEMENT']"/>
+
+ <param name="CODE_TAB_REPLACEMENT">
+
+ <choose>
+
+ <when test="boolean($codetabdocument-value)">
+ <value-of select="$codetabdocument-value"/>
+ </when>
+
+ <otherwise>
+ <value-of select="' '"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <!--
+ Switch that suppresses separation of paragraphs with empty lines.
+ (Set to 1 to activate) -->
+ <param name="CODE_JOIN_PARAGRAPHS"
+ select="boolean(string(/office:document/office:meta/meta:user-defined[@meta:name='CODE_JOIN_PARAGRAPHS']) != 'false')"/>
+
+ <variable name="document-value"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='CODE_STYLES']"/>
+
+ <param name="CODE_STYLES">
+
+ <choose>
+ <when test="boolean($document-value)">
+ <value-of select="$document-value"/>
+ </when>
+
+ <otherwise>
+ <value-of select="''"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <variable name="table-class"
+ select="/office:document/office:meta/meta:user-defined[@meta:name='TABLE_CLASS']"/>
+
+ <param name="TABLE_CLASS">
+ <choose>
+ <when test="boolean($table-class)">
+ <value-of select="$table-class"/>
+ </when>
+
+ <otherwise>
+ <value-of select="''"/>
+ </otherwise>
+ </choose>
+ </param>
+
+ <variable name="USE_DEFAULT_TABLE_CLASS" select="string-length($TABLE_CLASS) &gt; 0"/>
+
+
+ <!--
+ == Wiki style constants ==
+ -->
+
+ <!-- Bold character style. -->
+ <variable name="BOLD_BIT" select="1"/>
+
+ <!-- Italic character style. -->
+ <variable name="ITALIC_BIT" select="2"/>
+
+ <!-- Subscript character style. -->
+ <variable name="SUBSCRIPT_BIT" select="4"/>
+
+ <!-- Superscript character style. -->
+ <variable name="SUPERSCRIPT_BIT" select="8"/>
+
+ <!-- Typewriter character style. -->
+ <variable name="TYPEWRITER_BIT" select="16"/>
+
+ <!-- Preformatted text paragraph style. -->
+ <variable name="CODE_BIT" select="32"/>
+
+ <!-- Centered paragraph style. -->
+ <variable name="CENTER_BIT" select="64"/>
+
+ <!-- Right aligned paragraph style. -->
+ <variable name="RIGHT_BIT" select="128"/>
+
+ <!-- Constant defining the empty style. -->
+ <variable name="NO_STYLE" select="0"/>
+
+
+
+ <output
+ method="text"
+ media-type="text/plain"
+ encoding="UTF-8"
+ />
+
+
+ <!--
+ == Reference resolution ==
+ -->
+
+ <key
+ name="style-ref"
+ match="//style:style"
+ use="@style:name"
+ />
+
+ <key
+ name="list-style-ref"
+ match="//text:list-style"
+ use="@style:name"
+ />
+
+ <key
+ name="font-face-ref"
+ match="//style:font-face"
+ use="@style:name"
+ />
+
+ <key
+ name="reference-resolution"
+ match="//text:reference-mark | //text:reference-mark-start"
+ use="@text:name"
+ />
+
+
+ <!--
+ Multiple pages (draw only)
+ -->
+
+ <template match="draw:page">
+ <value-of select="concat('&#10;&lt;!-- Page ', @draw:name, '--&gt;&#10;')"/>
+ <apply-templates/>
+ <value-of select="'&#10;----&#10;&#10;'"/>
+ </template>
+
+
+ <!--
+ == Lists ==
+ -->
+
+ <template match="text:list">
+ <!--
+ Check, whether this list is used to implement the outline numbering
+ for headings. Such list must not be exported, because within the wiki,
+ automatic outline numbering is performed. An outline list has a single
+ text:h element as its single leaf grandchild.
+
+ This method of section numbering seems not to be used when creating new
+ documents with OpenOffice.org 2.2, but the document containing the
+ OpenDocument specification version 1.1 uses such numbering through nested
+ lists.
+ -->
+ <choose>
+ <when test="boolean(./descendant::node()[not(./self::text:list) and not(./self::text:list-item) and not(./ancestor-or-self::text:h)])">
+ <apply-templates/>
+ </when>
+
+ <otherwise>
+ <apply-templates select=".//text:h"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template match="text:list-item">
+ <if test="position() &gt; 1 or boolean(ancestor::text:list-item)">
+ <value-of select="$NL"/>
+ </if>
+ <variable name="list-style"
+ select="key('list-style-ref',ancestor::text:list[boolean(@text:style-name)][1]/@text:style-name)"/>
+ <call-template name="mk-list-token">
+ <with-param name="list-style" select="$list-style"/>
+ <with-param name="level" select="count(ancestor::text:list)"/>
+ </call-template>
+ <text> </text>
+ <apply-templates/>
+ <if test="position() = last() and not(boolean(ancestor::text:list-item))">
+ <!-- End of (potentially nested) list is marked with a double newline. -->
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template name="mk-list-token">
+ <param name="list-style"/>
+ <param name="level"/>
+
+ <if test="$level &gt; 1">
+ <call-template name="mk-list-token">
+ <with-param name="list-style" select="$list-style"/>
+ <with-param name="level" select="$level - 1"/>
+ </call-template>
+ </if>
+
+ <variable name="number-style" select="$list-style/text:list-level-style-number[@text:level=$level]"/>
+ <variable name="bullet-style" select="$list-style/text:list-level-style-bullet[@text:level=$level]"/>
+ <choose>
+ <when test="boolean($number-style)">
+ <choose>
+ <when test="string-length($number-style/@style:num-format) &gt; 0">
+ <text>#</text>
+ </when>
+ <otherwise>
+ <text>:</text>
+ </otherwise>
+ </choose>
+ </when>
+ <when test="boolean($bullet-style)">
+ <text>*</text>
+ </when>
+ </choose>
+ </template>
+
+
+ <!--
+ == Headings ==
+ -->
+
+ <template match="text:h">
+ <if test="string-length(.) &gt; 0">
+ <variable name="token">
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="@text:outline-level"/>
+ </call-template>
+ </variable>
+ <value-of select="$token"/>
+ <text> </text>
+ <apply-templates/>
+ <text> </text>
+ <value-of select="$token"/>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template match="text:index-title">
+ <text>== </text>
+ <apply-templates/>
+ <text> ==</text>
+ <value-of select="$NL"/>
+ </template>
+
+ <!--
+ Function generating a wiki heading prefix.
+
+ @param level
+ The heading level. The value must be between 1 and 5.
+ -->
+ <template name="mk-heading-prefix">
+ <param name="level"/>
+ <choose>
+ <when test="$level &gt; 5">
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="5"/>
+ </call-template>
+ </when>
+ <when test="$level &gt; 0">
+ <text>=</text>
+ <call-template name="mk-heading-prefix">
+ <with-param name="level" select="$level - 1"/>
+ </call-template>
+ </when>
+ </choose>
+ </template>
+
+ <!--
+ Funktion generating a token consisting of the given character
+ repeated 'level' times.
+
+ @param level
+ The lengh of the result.
+ @param char
+ The character that should be repeated 'level' times.
+ -->
+ <template name="mk-token">
+ <param name="level"/>
+ <param name="char"/>
+ <if test="$level &gt; 0">
+ <value-of select="$char"/>
+ <call-template name="mk-token">
+ <with-param name="level" select="$level - 1"/>
+ <with-param name="char" select="$char"/>
+ </call-template>
+ </if>
+ </template>
+
+
+ <!--
+ == Tables ==
+ -->
+
+ <template match="table:table">
+ <text>&#10;</text>
+ <text>{|</text>
+
+ <choose>
+ <when test="$USE_DEFAULT_TABLE_CLASS">
+ <text> class="</text>
+ <value-of select="$TABLE_CLASS"/>
+ <text>"</text>
+ </when>
+
+ <otherwise>
+ <!-- Default setting to translate detailed office table cell styles correctly. -->
+ <text> style="border-spacing:0;"</text>
+ </otherwise>
+ </choose>
+
+ <text>&#10;</text>
+ <apply-templates/>
+ <text>&#10;</text>
+ <text>|}</text>
+ <text>&#10;</text>
+ </template>
+
+ <template match="table:table-header-rows">
+ <apply-templates/>
+ </template>
+
+ <template match="table:table-row[position() &lt; last()] | table:table-header-rows/table:table-row">
+ <apply-templates/>
+ <text>&#10;</text>
+ <text>|-</text>
+ <text>&#10;</text>
+ </template>
+
+ <template match="table:table-row">
+ <apply-templates/>
+ </template>
+
+ <template match="table:table-header-rows//table:table-cell">
+ <text>! </text>
+ <if test="@table:number-columns-spanned">
+ <text>colspan="</text>
+ <value-of select="@table:number-columns-spanned"/>
+ <text>" | </text>
+ </if>
+ <apply-templates/>
+ <value-of select="$NL"/>
+ </template>
+
+ <template match="table:table-cell">
+ <text>|</text>
+ <if test="@table:number-columns-spanned">
+ <text> colspan="</text>
+ <value-of select="@table:number-columns-spanned"/>
+ <text>" </text>
+ </if>
+ <if test="not($USE_DEFAULT_TABLE_CLASS) and boolean(@table:style-name)">
+ <variable name="style-element" select="key('style-ref', @table:style-name)"/>
+
+ <variable name="style">
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'background-color'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:background-color"/>
+ </call-template>
+
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-top'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-top"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-bottom'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-bottom"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-left'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-left"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'border-right'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:border-right"/>
+ </call-template>
+
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-top'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-top"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-bottom'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-bottom"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-left'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-left"/>
+ </call-template>
+ <call-template name="translate-style-property">
+ <with-param name="style-name" select="'padding-right'"/>
+ <with-param name="style-property" select="$style-element/style:table-cell-properties/@fo:padding-right"/>
+ </call-template>
+ </variable>
+
+ <if test="string-length($style) &gt; 0">
+ <text> style="</text>
+ <value-of select="$style"/>
+ <text>"</text>
+ </if>
+ </if>
+ <text>| </text>
+ <apply-templates/>
+ <value-of select="$NL"/>
+ </template>
+
+ <template name="translate-style-property">
+ <param name="style-name"/>
+ <param name="style-property"/>
+
+ <if test="boolean($style-property)">
+ <value-of select="$style-name"/>
+ <text>:</text>
+ <value-of select="string($style-property)"/>
+ <text>;</text>
+ </if>
+ </template>
+
+ <!--
+ == WikiMath ==
+ -->
+
+ <template match="text:span[@text:style-name='WikiMath']">
+ <value-of select="'&lt;math&gt;'"/>
+ <apply-templates/>
+ <value-of select="'&lt;/math&gt;'"/>
+ </template>
+
+
+ <!--
+ == Native links ==
+ -->
+
+ <template match="text:a">
+ <variable name="link-ref" select="@xlink:href"/>
+ <choose>
+ <when test="string-length($link-ref) &gt; 0">
+ <variable name="link-label" select="string(.)"/>
+ <text>[</text>
+ <value-of select="$link-ref"/>
+ <text> </text>
+ <value-of select="$link-label"/>
+ <text>]</text>
+ </when>
+
+ <otherwise>
+ <apply-templates/>
+ </otherwise>
+ </choose>
+ </template>
+
+
+ <!--
+ == WikiLink ==
+ -->
+
+ <template match="text:span[@text:style-name='WikiLink']">
+ <value-of select="'[['"/>
+ <variable name="link-def" select="string(.)"/>
+ <variable name="link-label" select="normalize-space(substring-before($link-def, '['))"/>
+ <variable name="link-ref" select="normalize-space(substring-before(substring-after($link-def, '['), ']'))"/>
+ <choose>
+ <when test="boolean($link-ref)">
+ <value-of select="concat($link-ref, '|', $link-label)"/>
+ </when>
+ <otherwise>
+ <value-of select="$link-def"/>
+ </otherwise>
+ </choose>
+ <value-of select="']]'"/>
+ </template>
+
+
+ <!--
+ == Paragraphs ==
+ -->
+
+ <template match="text:p[string-length(.) &gt; 0]">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+ <variable name="center"
+ select="($style mod (2 * $CENTER_BIT)) - ($style mod ($CENTER_BIT)) != 0"/>
+ <variable name="right"
+ select="($style mod (2 * $RIGHT_BIT)) - ($style mod ($RIGHT_BIT)) != 0"/>
+
+ <choose>
+ <when test="$center">
+ <text>&lt;center&gt;</text>
+ </when>
+ <when test="$right">
+ <text>&lt;div align="right"&gt;</text>
+ </when>
+ <when test="$code">
+ <value-of select="' '"/>
+ </when>
+ </choose>
+
+ <apply-templates/>
+
+ <choose>
+ <when test="$center">
+ <text>&lt;/center&gt;</text>
+ </when>
+ <when test="$right">
+ <text>&lt;/div&gt;</text>
+ </when>
+ </choose>
+
+ <variable name="paragraph-right"
+ select="./following-sibling::*[1]/self::text:p"/>
+
+ <choose>
+ <when test="boolean($paragraph-right)">
+ <!--
+ Insert end of line only if not within a list. Within wiki lists,
+ a line break leaves the current list item.
+ -->
+ <choose>
+ <when test="boolean(ancestor::text:list-item)">
+ <text>&lt;br/&gt; </text>
+ </when>
+ <when test="$code">
+ <variable name="style-right">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$paragraph-right"/>
+ </call-template>
+ </variable>
+
+ <variable name="code-right"
+ select="($style-right mod (2 * $CODE_BIT)) - ($style-right mod ($CODE_BIT)) != 0"/>
+
+ <choose>
+ <when test="$code-right">
+ <choose>
+ <when test="$CODE_JOIN_PARAGRAPHS">
+ <value-of select="$NL"/>
+ </when>
+
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="' '"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </otherwise>
+ </choose>
+ </when>
+ <when test="boolean(./following-sibling::*[1]/self::text:h) or boolean(./following-sibling::*[1]/self::table:table) or boolean(./following-sibling::*[1]/self::text:bibliography)">
+ <!-- Newline before following heading or table. -->
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </when>
+ <when test="./following-sibling::*[1]/self::text:list and not(ancestor::text:list-item)">
+ <value-of select="$NL"/>
+ <value-of select="$NL"/>
+ </when>
+ </choose>
+ </template>
+
+ <template match="text:p[string-length(.) = 0 and string-length(preceding-sibling::*[1]/self::text:p) &gt; 0]">
+ <value-of select="$NL"/>
+ </template>
+
+
+ <!--
+ == Preformatted text ==
+ -->
+
+ <template match="text:s">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <choose>
+ <when test="@text:c">
+ <call-template name="mk-token">
+ <with-param name="level" select="@text:c"/>
+ <with-param name="char" select="' '"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="' '"/>
+ </otherwise>
+ </choose>
+ </if>
+ </template>
+
+ <template match="text:tab">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <value-of select="$CODE_TAB_REPLACEMENT"/>
+ </if>
+ </template>
+
+ <template match="text:line-break">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+
+ <if test="$code">
+ <value-of select="$NL"/>
+ <value-of select="' '"/>
+ </if>
+ </template>
+
+ <!--
+ Footnotes
+ -->
+
+ <template match="text:note-body">
+ <variable name="note" select="./parent::text:note"/>
+
+ <if test="$note/@text:note-class = 'footnote'">
+ <text>&lt;ref name="</text>
+ <value-of select="$note/@text:id"/>
+ <text>"&gt;</text>
+ <apply-templates/>
+ <text>&lt;/ref&gt;</text>
+ </if>
+ </template>
+
+ <template match="text:note-ref[@text:note-class='footnote']">
+ <text>&lt;ref name="</text>
+ <value-of select="@text:ref-name"/>
+ <text>"/&gt;</text>
+ </template>
+
+
+ <!--
+ == Images ==
+ -->
+
+ <template match="draw:text-box[boolean(.//draw:image)]">
+ <variable name="image" select=".//draw:image[1]"/>
+
+ <variable name="image-description">
+ <apply-templates/>
+ </variable>
+
+ <text>[[</text>
+ <call-template name="mk-image-name">
+ <with-param name="image" select="$image"/>
+ </call-template>
+ <text>|thumb|</text>
+ <value-of select="normalize-space($image-description)"/>
+ <text>]]</text>
+ </template>
+
+ <template match="draw:image[not(boolean(ancestor::draw:text-box))]">
+ <text>[[</text>
+ <call-template name="mk-image-name">
+ <with-param name="image" select="."/>
+ </call-template>
+ <text>]]</text>
+ </template>
+
+ <template name="mk-image-name">
+ <param name="image"/>
+
+ <variable name="base-name">
+ <call-template name="mk-base-name">
+ <with-param name="href" select="$image/@xlink:href"/>
+ </call-template>
+ </variable>
+
+ <if test="not(starts-with($base-name, 'Image:'))">
+ <value-of select="'Image:'"/>
+ </if>
+ <value-of select="$base-name"/>
+ </template>
+
+ <template name="mk-base-name">
+ <param name="href"/>
+
+ <variable name="result" select="substring-after($href, '/')"/>
+ <choose>
+ <when test="boolean($result)">
+ <call-template name="mk-base-name">
+ <with-param name="href" select="$result"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$href"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!-- Frames -->
+
+ <template match="draw:frame">
+ <choose>
+ <when test="draw:object/math:math">
+ <apply-templates select="draw:object/math:math[1]"/>
+ </when>
+
+ <when test="draw:image">
+ <apply-templates select="draw:image[1]"/>
+ </when>
+
+ <otherwise>
+ <apply-templates select="./*[1]"/>
+ </otherwise>
+ </choose>
+
+ </template>
+
+ <!-- Formulas (Objects) -->
+
+ <include href="math/mmltex.xsl"/>
+
+ <template match="math:math" priority="1">
+ <text>&lt;math&gt;</text>
+ <apply-templates/>
+ <text>&lt;/math&gt;</text>
+ </template>
+
+
+ <!--
+ References
+ -->
+
+ <!-- TODO: text:bibliography-mark -->
+
+ <template match="text:reference-ref">
+ <variable name="reference-mark" select="key('reference-resolution', @text:ref-name)"/>
+
+ <choose>
+ <when test="boolean($reference-mark)">
+ <!--
+ In wiki syntax, only a local reference to a heading can be inserted.
+ If the link target is a descendant of a heading element, a link can be
+ inserted in the result. -->
+ <variable name="header-anchor" select="$reference-mark/ancestor::text:h[1]"/>
+ <if test="boolean($header-anchor)">
+ <text>[[#</text>
+ <value-of select="string($header-anchor)"/>
+ <text>|</text>
+ </if>
+
+ <variable name="reference-text" select="string(.)"/>
+
+ <choose>
+ <!-- Check, whether the reference text is cached in the document. -->
+ <when test="string-length($reference-text) &gt; 0">
+ <value-of select="$reference-text"/>
+ </when>
+
+ <otherwise>
+ <!--
+ TODO: Evaluate the @text:reference-format attribute and
+ generate the replacement text (difficult).-->
+ <text>(REFERENCE TEXT UNAVAILABLE: "</text>
+ <value-of select="@text:ref-name"/>
+ <text>")</text>
+ </otherwise>
+ </choose>
+
+ <if test="boolean($header-anchor)">
+ <text>]]</text>
+ </if>
+ </when>
+
+ <otherwise>
+ <text>(UNDEFINED REFERENCE: "</text>
+ <value-of select="@text:ref-name"/>
+ <text>")</text>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template match="text:reference-mark">
+ <!-- TODO: Output an anchor. -->
+ <apply-templates/>
+ </template>
+
+ <template match="text:reference-mark-start">
+ <!-- TODO: Output an anchor. -->
+ </template>
+
+ <!--
+ == Plain text ==
+ -->
+
+ <template match="text:p/text() | text:h/text() | text:span/text() | text:sequence/text() | text:sequence-ref/text() | text:a/text() | text:bookmark-ref/text() | text:reference-mark/text() | text:date/text() | text:time/text() | text:page-number/text() | text:sender-firstname/text() | text:sender-lastname/text() | text:sender-initials/text() | text:sender-title/text() | text:sender-position/text() | text:sender-email/text() | text:sender-phone-private/text() | text:sender-fax/text() | text:sender-company/text() | text:sender-phone-work/text() | text:sender-street/text() | text:sender-city/text() | text:sender-postal-code/text() | text:sender-country/text() | text:sender-state-or-province/text() | text:author-name/text() | text:author-initials/text() | text:chapter/text() | text:file-name/text() | text:template-name/text() | text:sheet-name/text() | text:variable-get/text() | text:variable-input/text() | text:user-field-get/text() | text:user-field-input/text() | text:expression/text() | text:text-input/text() | text:initial-creator/text() | text:creation-date/text() | text:creation-time/text() | text:description/text() | text:user-defined/text() | text:print-date/text() | text:printed-by/text() | text:title/text() | text:subject/text() | text:keywords/text() | text:editing-cycles/text() | text:editing-duration/text() | text:modification-date/text() | text:creator/text() | text:modification-time/text() | text:page-count/text() | text:paragraph-count/text() | text:word-count/text() | text:character-count/text() | text:table-count/text() | text:image-count/text() | text:object-count/text() | text:database-display/text() | text:database-row-number/text() | text:database-name/text() | text:page-variable-get/text() | text:placeholder/text() | text:conditional-text/text() | text:hidden-text/text() | text:execute-macro/text() | text:dde-connection/text() | text:measure/text() | text:table-formula/text()">
+ <choose>
+ <when test="boolean(./ancestor::table:table-header-rows | ./ancestor::text:h)">
+ <!--
+ No explicit styles within table headings or section headings,
+ because those styles are consistently declared by the Wiki engine. -->
+ <value-of select="."/>
+ </when>
+
+ <when test="string-length(.) &gt; 0">
+ <variable name="style">
+ <call-template name="mk-style-set">
+ <with-param name="node" select="."/>
+ </call-template>
+ </variable>
+
+ <variable name="current-paragraph"
+ select="./ancestor::text:p[1]"/>
+ <variable name="paragraph-id"
+ select="generate-id($current-paragraph)"/>
+ <variable name="frames"
+ select="$current-paragraph/descendant::draw:frame"/>
+ <variable name="frame-count"
+ select="count($frames)"/>
+
+ <!--
+ The current style context consists of all text nodes that are
+ descendants of the paragraph ancestor of this text node but not
+ descendants of any frame nodes that are descendants of the current
+ text nodes paragraph.
+ -->
+ <variable name="context"
+ select="$current-paragraph//text()[not(boolean(./ancestor::draw:frame[1]) and count(./ancestor::draw:frame[1] | $frames) = $frame-count)]"/>
+ <variable name="context-size" select="count($context)"/>
+
+ <variable name="context-index">
+ <call-template name="mk-context-index">
+ <with-param name="current-id" select="generate-id(.)"/>
+ <with-param name="context" select="$context"/>
+ <with-param name="test-index" select="1"/>
+ </call-template>
+ </variable>
+
+ <variable name="style-left">
+ <choose>
+ <when test="$context-index &gt; 1">
+ <variable name="left" select="$context[$context-index - 1]"/>
+ <!--
+ The preceding text node is a child of this nodes topmost
+ styled ancestor. This means that the result of the
+ transformation will be directly concatenated.
+ -->
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$left"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="style-right">
+ <choose>
+ <when test="$context-index &lt; count($context)">
+ <variable name="right" select="$context[$context-index + 1]"/>
+ <!--
+ The preceding text node is a child of this nodes topmost
+ styled ancestor. This means that the result of the
+ transformation will be directly concatenated.
+ -->
+ <call-template name="mk-style-set">
+ <with-param name="node" select="$right"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="bold"
+ select="($style mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic"
+ select="($style mod (2 * $ITALIC_BIT)) - ($style mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript"
+ select="($style mod (2 * $SUPERSCRIPT_BIT)) - ($style mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript"
+ select="($style mod (2 * $SUBSCRIPT_BIT)) - ($style mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="code"
+ select="($style mod (2 * $CODE_BIT)) - ($style mod ($CODE_BIT)) != 0"/>
+ <variable name="typewriter"
+ select="($style mod (2 * $TYPEWRITER_BIT)) - ($style mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <variable name="bold-left"
+ select="($style-left mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic-left"
+ select="($style-left mod (2 * $ITALIC_BIT)) - ($style-left mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript-left"
+ select="($style-left mod (2 * $SUPERSCRIPT_BIT)) - ($style-left mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript-left"
+ select="($style-left mod (2 * $SUBSCRIPT_BIT)) - ($style-left mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="typewriter-left"
+ select="($style-left mod (2 * $TYPEWRITER_BIT)) - ($style-left mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <variable name="bold-right"
+ select="($style-right mod (2 * $BOLD_BIT)) != 0"/>
+ <variable name="italic-right"
+ select="($style-right mod (2 * $ITALIC_BIT)) - ($style-right mod ($ITALIC_BIT)) != 0"/>
+ <variable name="superscript-right"
+ select="($style-right mod (2 * $SUPERSCRIPT_BIT)) - ($style-right mod ($SUPERSCRIPT_BIT)) != 0"/>
+ <variable name="subscript-right"
+ select="($style-right mod (2 * $SUBSCRIPT_BIT)) - ($style-right mod ($SUBSCRIPT_BIT)) != 0"/>
+ <variable name="typewriter-right"
+ select="($style-right mod (2 * $TYPEWRITER_BIT)) - ($style-right mod ($TYPEWRITER_BIT)) != 0"/>
+
+ <!-- Debugging: Add style infos to the output. -->
+ <!--
+ <value-of select="'{'"/>
+ <value-of select="$style-left"/>
+ <value-of select="'-'"/>
+ <value-of select="$style"/>
+ <value-of select="','"/>
+ <value-of select="$context-size"/>
+ <value-of select="'}'"/>
+ -->
+
+ <if test="$superscript and not($superscript-left)">
+ <text>&lt;sup&gt;</text>
+ </if>
+ <if test="$subscript and not($subscript-left)">
+ <text>&lt;sub&gt;</text>
+ </if>
+ <if test="not($code) and $typewriter and not($typewriter-left)">
+ <text>&lt;tt&gt;</text>
+ </if>
+ <if test="$bold and not($bold-left)">
+ <text>'''</text>
+ </if>
+ <if test="$italic and not($italic-left)">
+ <text>''</text>
+ </if>
+
+ <call-template name="render-quoted-text">
+ <with-param name="text" select="."/>
+ </call-template>
+
+ <if test="$italic and not($italic-right)">
+ <text>''</text>
+ </if>
+ <if test="$bold and not($bold-right)">
+ <text>'''</text>
+ </if>
+ <if test="not($code) and $typewriter and not($typewriter-right)">
+ <text>&lt;/tt&gt;</text>
+ </if>
+ <if test="$subscript and not($subscript-right)">
+ <text>&lt;/sub&gt;</text>
+ </if>
+ <if test="$superscript and not($superscript-right)">
+ <text>&lt;/sup&gt;</text>
+ </if>
+
+ <!-- Debugging: Add style details to the output. -->
+ <!--
+ <value-of select="'{'"/>
+ <value-of select="$style"/>
+ <value-of select="'-'"/>
+ <value-of select="$style-right"/>
+ <value-of select="'}'"/>
+ -->
+
+ </when>
+ </choose>
+ </template>
+
+ <!--
+ Function for looking up the position of a node identified by the given
+ 'current-id' within a node set 'context'.
+
+ The search starts with the the index 'test-index'. The search is recursive
+ in the 'test-index' argument. To save recursion depth, each recursive call
+ iteratively tests a fixed number of indexes (by loop unrolling).
+ -->
+ <template name="mk-context-index">
+ <param name="current-id"/>
+ <param name="context"/>
+ <param name="test-index"/>
+
+ <variable name="context-size" select="count($context)"/>
+
+ <choose>
+ <when test="context-size &lt; $test-index">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index])">
+ <value-of select="$test-index"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 1)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 1])">
+ <value-of select="$test-index + 1"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 2)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 2])">
+ <value-of select="$test-index + 2"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 3)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 3])">
+ <value-of select="$test-index + 3"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 4)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 4])">
+ <value-of select="$test-index + 4"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 5)">
+ </when>
+ <when test="$current-id = generate-id($context[$test-index + 5])">
+ <value-of select="$test-index + 5"/>
+ </when>
+ <when test="context-size &lt; ($test-index + 6)">
+ </when>
+ <otherwise>
+ <call-template name="mk-context-index">
+ <with-param name="current-id" select="$current-id"/>
+ <with-param name="context" select="$context"/>
+ <with-param name="test-index" select="$test-index + 6"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-quoted-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&lt;') or contains($text, '[') or starts-with($text, '----') or starts-with($text, '=') or starts-with($text, '*') or starts-with($text, ';') or starts-with($text, '#')">
+ <text>&lt;nowiki&gt;</text>
+ <choose>
+ <when test="contains($text, '&lt;/nowiki&gt;')">
+ <call-template name="render-escaped-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ <text>&lt;/nowiki&gt;</text>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-escaped-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&lt;')">
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="substring-before($text, '&lt;')"/>
+ </call-template>
+ <value-of select="'&amp;lt;'"/>
+ <call-template name="render-escaped-text">
+ <with-param name="text" select="substring-after($text, '&lt;')"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="$text"/>
+ </call-template>
+ </otherwise>
+ </choose>
+ </template>
+
+ <template name="render-encoded-text">
+ <param name="text"/>
+
+ <choose>
+ <when test="contains($text, '&#160;')">
+ <value-of select="substring-before($text, '&#160;')"/>
+ <value-of select="'&amp;nbsp;'"/>
+ <call-template name="render-encoded-text">
+ <with-param name="text" select="substring-after($text, '&#160;')"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$text"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!--
+ == Wiki styles: bold, italics, ... ==
+ -->
+
+ <template name="mk-style-set">
+ <param name="node"/>
+
+ <variable
+ name="context"
+ select="$node/ancestor-or-self::*[@text:style-name][1]"
+ />
+
+ <choose>
+ <when test="boolean($context)">
+ <variable
+ name="style"
+ select="key('style-ref', $context/@text:style-name)"
+ />
+
+ <!-- Debugging: Print inspected styles. -->
+ <!--
+ <message>
+ <value-of select="'=== '"/>
+ <value-of select="$style/@style:name"/>
+ <value-of select="' ==='"/>
+ </message>
+ -->
+
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$context"/>
+ <with-param name="style" select="$style"/>
+ <with-param name="style-set" select="$NO_STYLE"/>
+ <with-param name="style-mask" select="$NO_STYLE"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </template>
+
+ <!--
+ Compute the wiki style set that corresponds
+ to the given office style at the given context node.
+
+ @param node
+ A node in which context the style is computed. If neither the given style
+ nor one of its linked styles does specify a style of the given type,
+ ancestor nodes of the given context node are considered.
+ @param style
+ A style:style element node. The style of the requested type is searched
+ in the given style and its linked styles.
+ @style-set
+ A bit set of styles already defined by the context.
+ @style-mask
+ A bit set of styles that must not be taken from the currently inspected
+ style, because those styles are already defined by the context.
+
+ @return A bit set composed of the wiki style constants.
+ -->
+ <template name="mk-style-set-internal">
+ <param name="node"/>
+ <param name="style"/>
+ <param name="style-set"/>
+ <param name="style-mask"/>
+
+ <variable name="text-properties" select="$style/style:text-properties"/>
+
+ <!-- Decompose style-mask into individual bits. -->
+ <variable name="bold-requested"
+ select="($style-mask mod (2 * $BOLD_BIT)) = 0"/>
+ <variable name="italic-requested"
+ select="($style-mask mod (2 * $ITALIC_BIT)) - ($style-mask mod ($ITALIC_BIT)) = 0"/>
+ <variable name="superscript-requested"
+ select="($style-mask mod (2 * $SUPERSCRIPT_BIT)) - ($style-mask mod ($SUPERSCRIPT_BIT)) = 0"/>
+ <variable name="subscript-requested"
+ select="($style-mask mod (2 * $SUBSCRIPT_BIT)) - ($style-mask mod ($SUBSCRIPT_BIT)) = 0"/>
+ <variable name="typewriter-requested"
+ select="($style-mask mod (2 * $TYPEWRITER_BIT)) - ($style-mask mod ($TYPEWRITER_BIT)) = 0"/>
+ <variable name="code-requested"
+ select="($style-mask mod (2 * $CODE_BIT)) - ($style-mask mod ($CODE_BIT)) = 0"/>
+ <variable name="center-requested"
+ select="($style-mask mod (2 * $CENTER_BIT)) - ($style-mask mod ($CENTER_BIT)) = 0"/>
+ <variable name="right-requested"
+ select="($style-mask mod (2 * $RIGHT_BIT)) - ($style-mask mod ($RIGHT_BIT)) = 0"/>
+
+ <!-- Extract styles that are not already defined by the context. -->
+ <variable name="bold-style">
+ <choose>
+ <when test="$bold-requested and boolean($text-properties/@fo:font-weight='bold')">
+ <!-- Bold found in current style. -->
+ <value-of select="$BOLD_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="bold-mask">
+ <choose>
+ <when test="$bold-requested and boolean($text-properties/@fo:font-weight)">
+ <!--
+ Other value than "bold" means that the character style is not
+ bold and no parent style must be considered.
+ -->
+ <value-of select="$BOLD_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="italic-style">
+ <choose>
+ <when test="$italic-requested and boolean($text-properties/@fo:font-style='italic')">
+ <!-- Italic found in current style. -->
+ <value-of select="$ITALIC_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="italic-mask">
+ <choose>
+ <when test="$italic-requested and boolean($text-properties/@fo:font-style)">
+ <!--
+ Other value than "italic" means that the character style is not
+ italic and no parent style must be considered.
+ -->
+ <value-of select="$ITALIC_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="superscript-style">
+ <choose>
+ <when test="$superscript-requested and contains($text-properties/@style:text-position, 'super')">
+ <value-of select="$SUPERSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="superscript-mask">
+ <choose>
+ <when test="$superscript-requested and boolean($text-properties/@style:text-position)">
+ <value-of select="$SUPERSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="subscript-style">
+ <choose>
+ <when test="$subscript-requested and contains($text-properties/@style:text-position, 'sub')">
+ <value-of select="$SUBSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="subscript-mask">
+ <choose>
+ <when test="$subscript-requested and boolean($text-properties/@style:text-position)">
+ <value-of select="$SUBSCRIPT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="typewriter-style">
+ <choose>
+ <when test="$typewriter-requested and ($style/@style:family='text') and boolean($text-properties/@style:font-name)">
+ <variable name="font-face"
+ select="key('font-face-ref', $text-properties/@style:font-name)"/>
+ <choose>
+ <when test="$font-face/@style:font-pitch='fixed'">
+ <value-of select="$TYPEWRITER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="typewriter-mask">
+ <choose>
+ <!-- Note: Suppress the typewriter style on text within a code paragraph. -->
+ <when test="$typewriter-requested and boolean($text-properties/@style:font-name)">
+ <value-of select="$TYPEWRITER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="code-style">
+ <choose>
+ <when test="$code-requested and ($style/@style:family='paragraph') and boolean($text-properties/@style:font-name)">
+ <variable name="font-face"
+ select="key('font-face-ref', $text-properties/@style:font-name)"/>
+ <choose>
+ <when test="$font-face/@style:font-pitch='fixed' or (boolean(@style:display-name) and contains($CODE_STYLES, $style/@style:display-name))">
+ <value-of select="$CODE_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="code-mask">
+ <choose>
+ <when test="$code-requested and ($style/@style:family='paragraph') and boolean($text-properties/@style:font-name)">
+ <value-of select="$CODE_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="center-style">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align='center')">
+ <value-of select="$CENTER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="center-mask">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align)">
+ <value-of select="$CENTER_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+ <variable name="right-style">
+ <choose>
+ <when test="$right-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align='end')">
+ <value-of select="$RIGHT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+ <variable name="right-mask">
+ <choose>
+ <when test="$center-requested and ($style/@style:family='paragraph') and boolean($style/style:paragraph-properties/@fo:text-align)">
+ <value-of select="$RIGHT_BIT"/>
+ </when>
+ <otherwise>
+ <value-of select="$NO_STYLE"/>
+ </otherwise>
+ </choose>
+ </variable>
+
+
+ <!-- Compute the updated styles and mask. -->
+ <!--
+ Note: The bit masks style-mask, bold-style, italic-style,... are
+ guaranteed to be disjoint, therefore, addition can be use instead
+ of bitwise or (which is missing in XPath). -->
+ <variable name="updated-style"
+ select="$style-set + $bold-style + $italic-style + $superscript-style + $subscript-style + $code-style + $typewriter-style + $center-style + $right-style"/>
+ <variable name="updated-mask"
+ select="$style-mask + $bold-mask + $italic-mask + $superscript-mask + $subscript-mask + $code-mask + $typewriter-mask + $center-mask + $right-mask"/>
+
+ <!-- Inspect linked and nested styles. -->
+ <choose>
+ <when test="boolean($style/@style:parent-style-name)">
+ <!-- Look through the style, the current style is based on. -->
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$node"/>
+ <with-param name="style" select="key('style-ref', $style/@style:parent-style-name)"/>
+ <with-param name="style-set" select="$updated-style"/>
+ <with-param name="style-mask" select="$updated-mask"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <variable name="ancestors" select="$node/ancestor::*[@text:style-name][1]"/>
+
+ <!-- Debugging: Print currently inspected style. -->
+ <!--
+ <message>
+ <value-of select="'{'"/>
+ <value-of select="$style/@style:name"/>
+ <value-of select="','"/>
+ <value-of select="$updated-style"/>
+ <value-of select="','"/>
+ <value-of select="$updated-mask"/>
+ <value-of select="','"/>
+ <value-of select="local-name($ancestors)"/>
+ <value-of select="',('"/>
+ <value-of select="$node"/>
+ <value-of select="')'"/>
+ <value-of select="'}'"/>
+ </message>
+ -->
+
+ <!--
+ If there is an ancestor that has a style, use that style,
+ otherwise, a style is not found. -->
+ <choose>
+ <when test="boolean($ancestors)">
+ <!-- Look through the style of the nearest ancestor that has a style. -->
+ <call-template name="mk-style-set-internal">
+ <with-param name="node" select="$ancestors"/>
+ <with-param name="style" select="key('style-ref', $ancestors/@text:style-name)"/>
+ <with-param name="style-set" select="$updated-style"/>
+ <with-param name="style-mask" select="$updated-mask"/>
+ </call-template>
+ </when>
+ <otherwise>
+ <!-- No more styles to inspect. Return the result. -->
+ <value-of select="$updated-style"/>
+ </otherwise>
+ </choose>
+ </otherwise>
+ </choose>
+ </template>
+
+
+ <!--
+ == Descending the tree ==
+ -->
+
+ <template match="/">
+ <apply-templates/>
+ <value-of select="$NL"/>
+ <if test="boolean(//text:note[@text:note-class='footnote'])">
+ <value-of select="$NL"/>
+ <text>----</text>
+ <value-of select="$NL"/>
+ <text>&lt;references/&gt;</text>
+ <value-of select="$NL"/>
+ </if>
+ </template>
+
+ <template match="office:document-content">
+ <apply-templates/>
+ </template>
+
+ <template match="office:body">
+ <apply-templates/>
+ </template>
+
+ <template match="text:tracked-changes">
+ <!-- Ignore change history. -->
+ </template>
+
+ <template match="office:* | text:* | draw:text-box | draw:a">
+ <apply-templates/>
+ </template>
+
+ <template match="node()">
+ </template>
+</stylesheet>
+
+<!--
+ Local Variables:
+ tab-width: 4
+ sgml-indent-step: 4
+ End:
+-->
diff --git a/swext/mediawiki/src/makefile.mk b/swext/mediawiki/src/makefile.mk
new file mode 100644
index 000000000000..8d920ab20976
--- /dev/null
+++ b/swext/mediawiki/src/makefile.mk
@@ -0,0 +1,54 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..
+PRJNAME=swext
+TARGET=mediawiki
+GEN_HID=FALSE
+
+ENABLE_EXCEPTIONS=TRUE
+
+# --- Settings ----------------------------------
+
+.INCLUDE : settings.mk
+
+DESCRIPTION:=$(MISC)$/$(TARGET)$/description.xml
+
+common_build_zip=
+
+.INCLUDE : target.mk
+
+ALLTAR: $(DESCRIPTION)
+
+.INCLUDE .IGNORE : $(MISC)$/$(TARGET)_lang_track.mk
+.IF "$(LAST_WITH_LANG)"!="$(WITH_LANG)"
+PHONYDESC=.PHONY
+.ENDIF # "$(LAST_WITH_LANG)"!="$(WITH_LANG)"
+$(DESCRIPTION) $(PHONYDESC) : $$(@:f)
+ @@-$(MKDIRHIER) $(@:d)
+ $(PERL) $(SOLARENV)$/bin$/licinserter.pl description.xml license/LICENSE_xxx $@
+ @echo LAST_WITH_LANG=$(WITH_LANG) > $(MISC)$/$(TARGET)_lang_track.mk
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/Addons.xcu b/swext/mediawiki/src/registry/data/org/openoffice/Office/Addons.xcu
new file mode 100644
index 000000000000..b8e96e1f1139
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/Addons.xcu
@@ -0,0 +1,67 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Addons" oor:package="org.openoffice.Office">
+ <node oor:name="AddonUI">
+ <node oor:name="OfficeMenuBarMerging">
+ <node oor:name="com.sun.star.wiki" oor:op="replace">
+ <node oor:name="S1" oor:op="replace">
+ <prop oor:name="MergePoint">
+ <value>.uno:PickList\.uno:SendToMenu\.uno:SendMailDocAsPDF</value>
+ </prop>
+ <prop oor:name="MergeCommand">
+ <value>AddAfter</value>
+ </prop>
+ <prop oor:name="MergeFallback">
+ <value>AddLast</value>
+ </prop>
+ <prop oor:name="MergeContext" oor:type="xs:string">
+ <value>com.sun.star.text.TextDocument,com.sun.star.text.WebDocument</value>
+ </prop>
+ <node oor:name="MenuItems">
+ <node oor:name="M1" oor:op="replace">
+ <prop oor:name="URL">
+ <value>private:separator</value>
+ </prop>
+ </node>
+ <node oor:name="M2" oor:op="replace">
+ <prop oor:name="Title">
+ <value xml:lang="en-US">To Media~Wiki...</value>
+ </prop>
+ <prop oor:name="URL">
+ <value>vnd.com.sun.star.wiki:send</value>
+ </prop>
+ <prop oor:name="Target" oor:type="xs:string">
+ <value>_self</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/WikiExtension.xcu b/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/WikiExtension.xcu
new file mode 100644
index 000000000000..8dbde907af37
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/WikiExtension.xcu
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="WikiExtension" oor:package="org.openoffice.Office.Custom">
+ <node oor:name="SpecialData">
+ <node oor:name="so-wiki.germany.sun.com" oor:op="fuse">
+ <prop oor:name="AllowUnknownCertificate">
+ <value>true</value>
+ </prop>
+ <node oor:name="AdditionalLoginArguments">
+ <node oor:name="wpDomain" oor:op="fuse">
+ <prop oor:name="Value">
+ <value>sun</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+
+ <node oor:name="ConnectionList">
+ </node>
+
+ <node oor:name="RecentDocs">
+ </node>
+
+ <node oor:name="Settings">
+ <prop oor:name="PreselectShowBrowser">
+ <value>true</value>
+ </prop>
+ </node>
+ <node oor:name="Strings">
+ <prop oor:name="GeneralSendError">
+ <value xml:lang="en-US">The operation 'Send to MediaWiki' could not be completed successfully.</value>
+ </prop>
+ <prop oor:name="NoWikiFilter">
+ <value xml:lang="en-US">The MediaWiki export filter cannot be found. Choose 'Tools-XML Filter Settings' to install the filter, or use the setup to install the component.</value>
+ </prop>
+ <prop oor:name="NoConnectionToURL">
+ <value xml:lang="en-US">A connection to the MediaWiki system at '$ARG1' could not be created.</value>
+ </prop>
+ <prop oor:name="WrongLogin">
+ <value xml:lang="en-US">User name or password is incorrect. Please try again, or leave the fields blank for an anonymous connection.</value>
+ </prop>
+ <prop oor:name="InvalidURL">
+ <value xml:lang="en-US">A connection could not be created because the URL is invalid.</value>
+ </prop>
+ <prop oor:name="NoURL">
+ <value xml:lang="en-US">Specify a MediaWiki server by providing a URL.</value>
+ </prop>
+ <prop oor:name="CancelSending">
+ <value xml:lang="en-US">The transfer has been interrupted. Please check the integrity of the wiki article.</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_UrlLabel">
+ <value xml:lang="en-US">U~RL</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_UsernameLabel">
+ <value xml:lang="en-US">~Username</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_PasswordLabel">
+ <value xml:lang="en-US">~Password</value>
+ </prop>
+ <prop oor:name="Dlg_SendTitle">
+ <value xml:lang="en-US">Send to MediaWiki</value>
+ </prop>
+ <prop oor:name="Dlg_WikiArticle">
+ <value xml:lang="en-US">Wiki article</value>
+ </prop>
+ <prop oor:name="Dlg_No">
+ <value xml:lang="en-US">No</value>
+ </prop>
+ <prop oor:name="Dlg_OK">
+ <value xml:lang="en-US">OK</value>
+ </prop>
+ <prop oor:name="Dlg_Yes">
+ <value xml:lang="en-US">Yes</value>
+ </prop>
+ <prop oor:name="Dlg_AddButton">
+ <value xml:lang="en-US">~Add...</value>
+ </prop>
+ <prop oor:name="Dlg_EditButton">
+ <value xml:lang="en-US">~Edit...</value>
+ </prop>
+ <prop oor:name="Dlg_SendButton">
+ <value xml:lang="en-US">~Send</value>
+ </prop>
+ <prop oor:name="Dlg_RemoveButton">
+ <value xml:lang="en-US">~Remove</value>
+ </prop>
+ <prop oor:name="Dlg_NewWikiPage_Label1">
+ <value xml:lang="en-US">A wiki article with the title '$ARG1' does not exist yet. Do you want to create a new article with that name?</value>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label1">
+ <value xml:lang="en-US">Media~Wiki Server</value>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label2">
+ <value xml:lang="en-US">~Title</value>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label3">
+ <value xml:lang="en-US">S~ummary</value>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_MinorCheck">
+ <value xml:lang="en-US">This is a ~minor edit</value>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_BrowserCheck">
+ <value xml:lang="en-US">Show in web ~browser</value>
+ </prop>
+ <prop oor:name="UnknownCert">
+ <value xml:lang="en-US">The certificate of the selected site is unknown.</value>
+ </prop>
+ <prop oor:name="Dlg_MediaWiki_Title">
+ <value xml:lang="en-US">MediaWiki</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_AccountLine">
+ <value xml:lang="en-US">Account</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_WikiLine">
+ <value xml:lang="en-US">MediaWiki Server</value>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_SaveBox">
+ <value xml:lang="en-US">~Save password</value>
+ </prop>
+ <prop oor:name="Dlg_MediaWiki_Extension_String">
+ <value xml:lang="en-US">@WIKIEXTENSIONPRODUCTNAME@</value>
+ </prop>
+ <prop oor:name="Dlg_WikiPageExists_Label1">
+ <value xml:lang="en-US">A wiki article with the title '$ARG1' already exists.&#13;&#13;Do you want to replace the current article with your article?&#13;&#13;</value>
+ </prop>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/makefile.mk b/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/makefile.mk
new file mode 100644
index 000000000000..82f8303054ab
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/Custom/makefile.mk
@@ -0,0 +1,48 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..$/..$/..$/..$/..
+PRJNAME=swext
+CUSTID=mediawiki
+TARGET=mediawiki_registry_data_Custom
+PACKAGE=org.openoffice.Office.Custom
+
+.INCLUDE : settings.mk
+.INCLUDE : ${PRJ}$/makefile.pmk
+
+ABSXCSROOT=$(PWD)$/$(MISC)$/$(CUSTID)
+XCSROOT=$(MISC)$/$(CUSTID)
+
+.IF "$(ENABLE_MEDIAWIKI)" == "YES"
+LOCALIZEDFILES= WikiExtension.xcu
+
+MODULEFILES=
+
+XCUFILES = WikiExtension.xcu
+.ENDIF
+
+.INCLUDE : target.mk
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/OptionsDialog.xcu b/swext/mediawiki/src/registry/data/org/openoffice/Office/OptionsDialog.xcu
new file mode 100644
index 000000000000..f6498c5faef3
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/OptionsDialog.xcu
@@ -0,0 +1,50 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="OptionsDialog" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry">
+ <node oor:name="Nodes">
+ <node oor:name="Internet" oor:op="fuse">
+ <node oor:name="Leaves">
+ <node oor:name="com.sun.star.wiki.options" oor:op="fuse">
+ <prop oor:name="Id">
+ <value>@WIKIEXTENSIONID@</value>
+ </prop>
+ <prop oor:name="Label">
+ <value xml:lang="en-US">MediaWiki</value>
+ </prop>
+ <prop oor:name="OptionsPage">
+ <value>%origin%/WikiEditor/Settings.xdl</value>
+ </prop>
+ <prop oor:name="EventHandlerService">
+ <value>com.sun.star.wiki.WikiOptionsEventHandlerImpl</value>
+ </prop>
+ </node>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
+
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/Paths.xcu b/swext/mediawiki/src/registry/data/org/openoffice/Office/Paths.xcu
new file mode 100644
index 000000000000..e39bbc75471c
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/Paths.xcu
@@ -0,0 +1,36 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:name="Paths" oor:package="org.openoffice.Office">
+ <node oor:name="Paths">
+ <node oor:name="Template" oor:op="fuse">
+ <node oor:name="InternalPaths">
+ <node oor:name="%origin%/templates" oor:op="fuse"/>
+ </node>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/ProtocolHandler.xcu b/swext/mediawiki/src/registry/data/org/openoffice/Office/ProtocolHandler.xcu
new file mode 100644
index 000000000000..501c0a42548c
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/ProtocolHandler.xcu
@@ -0,0 +1,36 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-data oor:name="ProtocolHandler" oor:package="org.openoffice.Office" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <node oor:name="HandlerSet">
+ <node oor:name="com.sun.star.wiki.WikiEditorImpl" oor:op="replace">
+ <prop oor:name="Protocols" oor:type="oor:string-list">
+ <value>vnd.com.sun.star.wiki:*</value>
+ </prop>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/Office/makefile.mk b/swext/mediawiki/src/registry/data/org/openoffice/Office/makefile.mk
new file mode 100644
index 000000000000..3d1409827390
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/Office/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..$/..$/..$/..
+PRJNAME=swext
+CUSTID=mediawiki
+TARGET=mediawiki_registry_data_office
+PACKAGE=org.openoffice.Office
+
+.INCLUDE : settings.mk
+.INCLUDE : ${PRJ}$/makefile.pmk
+
+.IF "$(ENABLE_MEDIAWIKI)" == "YES"
+LOCALIZEDFILES= Addons.xcu OptionsDialog.xcu
+
+MODULEFILES=
+
+XCUFILES = Addons.xcu OptionsDialog.xcu ProtocolHandler.xcu Paths.xcu
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Filter.xcu b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Filter.xcu
new file mode 100644
index 000000000000..d0ddad5b2a7c
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Filter.xcu
@@ -0,0 +1,56 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:package="org.openoffice.TypeDetection" oor:name="Filter">
+ <node oor:name="Filters">
+ <node oor:name="MediaWiki" oor:op="fuse">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>MediaWiki</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.TextDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,,com.sun.star.comp.Writer.XMLOasisExporter,,%origin%/filter/odt2mediawiki.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MediaWiki</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
+ <node oor:name="MediaWiki_Web" oor:op="fuse">
+ <prop oor:name="FileFormatVersion"><value>0</value></prop>
+ <prop oor:name="Type"><value>MediaWiki</value></prop>
+ <prop oor:name="DocumentService"><value>com.sun.star.text.WebDocument</value></prop>
+ <prop oor:name="UIComponent"/>
+ <prop oor:name="UserData"><value oor:separator=",">com.sun.star.documentconversion.XSLTFilter,,,com.sun.star.comp.Writer.XMLOasisExporter,,%origin%/filter/odt2mediawiki.xsl</value></prop>
+ <prop oor:name="FilterService"><value>com.sun.star.comp.Writer.XmlFilterAdaptor</value></prop>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MediaWiki</value>
+ </prop>
+ <prop oor:name="Flags"><value>EXPORT ALIEN 3RDPARTYFILTER</value></prop>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Types.xcu b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Types.xcu
new file mode 100644
index 000000000000..64031b844aaf
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/Types.xcu
@@ -0,0 +1,44 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<!DOCTYPE oor:component-data SYSTEM "../../../../component-update.dtd">
+<oor:component-data xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" oor:package="org.openoffice.TypeDetection" oor:name="Types">
+ <node oor:name="Types">
+ <node oor:name="MediaWiki" oor:op="fuse">
+ <prop oor:name="DetectService"><value>com.sun.star.comp.filters.XMLFilterDetect</value></prop>
+ <prop oor:name="URLPattern"/>
+ <prop oor:name="Extensions"><value>txt</value></prop>
+ <prop oor:name="MediaType"/>
+ <prop oor:name="Preferred"><value>false</value></prop>
+ <prop oor:name="PreferredFilter"/>
+ <prop oor:name="UIName">
+ <value xml:lang="x-default">MediaWiki</value>
+ </prop>
+ <prop oor:name="ClipboardFormat"/>
+ </node>
+ </node>
+</oor:component-data>
diff --git a/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/makefile.mk b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/makefile.mk
new file mode 100644
index 000000000000..3224851026c0
--- /dev/null
+++ b/swext/mediawiki/src/registry/data/org/openoffice/TypeDetection/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..$/..$/..$/..
+PRJNAME=swext
+CUSTID=mediawiki
+TARGET=mediawiki_registry_data_typedetection
+PACKAGE=org.openoffice.TypeDetection
+
+.INCLUDE : settings.mk
+.INCLUDE : ${PRJ}$/makefile.pmk
+
+.IF "$(ENABLE_MEDIAWIKI)" == "YES"
+LOCALIZEDFILES=
+
+MODULEFILES=
+
+XCUFILES = Filter.xcu Types.xcu
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/WikiExtension.xcs b/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/WikiExtension.xcs
new file mode 100644
index 000000000000..d210ec999507
--- /dev/null
+++ b/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/WikiExtension.xcs
@@ -0,0 +1,197 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************ -->
+<oor:component-schema
+ xmlns:oor="http://openoffice.org/2001/registry"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ oor:name="WikiExtension"
+ oor:package="org.openoffice.Office.Custom"
+ xml:lang="en-US">
+ <info>
+ <desc>Configuration parameters for the accounts.</desc>
+ </info>
+
+ <templates>
+ <group oor:name="RequestArgument">
+ <info><desc>An argument for a request.</desc></info>
+ <prop oor:name="Value" oor:type="xs:string">
+ <info><desc>The value of the argument.</desc></info>
+ </prop>
+ </group>
+
+ <group oor:name="WikiServerSpecialData">
+ <info><desc>The smart configuration for the MediaWikiServer.</desc></info>
+ <prop oor:name="AllowUnknownCertificate" oor:type="xs:boolean">
+ <info><desc>The value of the argument.</desc></info>
+ </prop>
+ <set oor:name="AdditionalLoginArguments" oor:node-type="RequestArgument">
+ <info><desc>The additional arguments that can be used on login. The name of an entry is the argument name.</desc></info>
+ </set>
+ </group>
+
+ <group oor:name="ConnectionURL">
+ <info><desc>The name of the entry is a connection URL of a wiki server.</desc></info>
+ <prop oor:name="UserName" oor:type="xs:string">
+ <info><desc>The UserName that is used to access the URL.</desc></info>
+ </prop>
+ </group>
+
+ <group oor:name="Document">
+ <info><desc>Wiki Document</desc></info>
+ <prop oor:name="Url" oor:type="xs:string">
+ <info><desc>Main URL for this Wiki</desc></info>
+ </prop>
+ <prop oor:name="Doc" oor:type="xs:string">
+ <info><desc>The Document name</desc></info>
+ </prop>
+ <prop oor:name="CompleteUrl" oor:type="xs:string">
+ <info><desc>Identifier</desc></info>
+ </prop>
+ </group>
+ </templates>
+
+ <component>
+ <set oor:name="SpecialData" oor:node-type="WikiServerSpecialData">
+ <info><desc>The set of smart configurations for MediaWiki Servers.</desc></info>
+ </set>
+ <set oor:name="ConnectionList" oor:node-type="ConnectionURL">
+ <info><desc>The list of the MediaWiki servers.</desc></info>
+ </set>
+ <set oor:name="RecentDocs" oor:node-type="Document">
+ <info><desc>The recenly stored documents.</desc></info>
+ </set>
+ <group oor:name="Settings">
+ <info><desc>The addon related settings.</desc></info>
+ <prop oor:name="PreselectShowBrowser" oor:type="xs:boolean">
+ <info><desc>Specifies whether "Show in webbrowser" checkbox should be preselected.</desc></info>
+ </prop>
+ </group>
+ <group oor:name="Strings">
+ <info>
+ <desc>Contains the strings that should be localized</desc>
+ </info>
+ <prop oor:name="GeneralSendError" oor:type="xs:string" oor:localized="true">
+ <info><desc>The general error shown in case the document could not be sent to the wiki server.</desc></info>
+ </prop>
+ <prop oor:name="NoWikiFilter" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case wiki filter is not evailable.</desc></info>
+ </prop>
+ <prop oor:name="NoConnectionToURL" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case no wiki system was found on specified URL.</desc></info>
+ </prop>
+ <prop oor:name="WrongLogin" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case user name or password is incorrect.</desc></info>
+ </prop>
+ <prop oor:name="InvalidURL" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case the provided URL has invalid syntax.</desc></info>
+ </prop>
+ <prop oor:name="NoURL" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case no wiki server was specified.</desc></info>
+ </prop>
+ <prop oor:name="CancelSending" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case transfer was interrupted by user. The user is notified that the integrity of the wiki article should be checked.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendTitle" oor:type="xs:string" oor:localized="true">
+ <info><desc>The title of the send dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_WikiArticle" oor:type="xs:string" oor:localized="true">
+ <info><desc>The dialog string used to border the wiki article related information.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_No" oor:type="xs:string" oor:localized="true">
+ <info><desc>"No" button in dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_OK" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Ok" button in dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_Yes" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Yes" button in dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_AddButton" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Add..." button text.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditButton" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Edit..." button text.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendButton" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Send" button text.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_RemoveButton" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Remove" button text.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_UrlLabel" oor:type="xs:string" oor:localized="true">
+ <info><desc>"URL" label.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_UsernameLabel" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Username" label.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_PasswordLabel" oor:type="xs:string" oor:localized="true">
+ <info><desc>"Password" label.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_NewWikiPage_Label1" oor:type="xs:string" oor:localized="true">
+ <info><desc>The text asking whether a new wiki page should be created.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label1" oor:type="xs:string" oor:localized="true">
+ <info><desc>The label reffering to the MediaWiki server selection.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label2" oor:type="xs:string" oor:localized="true">
+ <info><desc>The label reffering to the input of wiki article title.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_Label3" oor:type="xs:string" oor:localized="true">
+ <info><desc>The label reffering to the comments input.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_MinorCheck" oor:type="xs:string" oor:localized="true">
+ <info><desc>Text for checkbox specifying whether it is a minor input.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_SendToMediaWiki_BrowserCheck" oor:type="xs:string" oor:localized="true">
+ <info><desc>Text for checkbox specifying whether the article should be shown in browser after editing.</desc></info>
+ </prop>
+ <prop oor:name="UnknownCert" oor:type="xs:string" oor:localized="true">
+ <info><desc>The error is shown in case a wiki site is accessed using https and has an unknown certificate.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_MediaWiki_Title" oor:type="xs:string" oor:localized="true">
+ <info><desc>"MediaWiki" string that is used as title in some dialogs.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_AccountLine" oor:type="xs:string" oor:localized="true">
+ <info><desc>The text bordering the account information in the dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_WikiLine" oor:type="xs:string" oor:localized="true">
+ <info><desc>The text bordering wiki server information in the dialog.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_EditSetting_SaveBox" oor:type="xs:string" oor:localized="true">
+ <info><desc>The checkbox specifying whether the password should be stored using the password container.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_MediaWiki_Extension_String" oor:type="xs:string" oor:localized="true">
+ <info><desc>The string containing the name of the extension.</desc></info>
+ </prop>
+ <prop oor:name="Dlg_WikiPageExists_Label1" oor:type="xs:string" oor:localized="true">
+ <info><desc>The text asking whether an existing wiki page should be overwritten.</desc></info>
+ </prop>
+ </group>
+ </component>
+
+</oor:component-schema>
diff --git a/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/makefile.mk b/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/makefile.mk
new file mode 100644
index 000000000000..bbbb9c664cbb
--- /dev/null
+++ b/swext/mediawiki/src/registry/schema/org/openoffice/Office/Custom/makefile.mk
@@ -0,0 +1,46 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ=..$/..$/..$/..$/..$/..$/..$/..
+PRJNAME=swext
+CUSTID=mediawiki
+TARGET=mediawiki_registry_schema_custom
+PACKAGE=org.openoffice.Office.Custom
+
+.INCLUDE : settings.mk
+.INCLUDE : ${PRJ}$/makefile.pmk
+
+.IF "$(ENABLE_MEDIAWIKI)" == "YES"
+LOCALIZEDFILES=
+
+MODULEFILES=
+
+XCSFILES = WikiExtension.xcs
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/swext/mediawiki/src/uno-extension-manifest.xml b/swext/mediawiki/src/uno-extension-manifest.xml
new file mode 100644
index 000000000000..f3d9a0e2399b
--- /dev/null
+++ b/swext/mediawiki/src/uno-extension-manifest.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--***********************************************************************
+
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ Copyright 2000, 2010 Oracle and/or its affiliates.
+
+ OpenOffice.org - a multi-platform office productivity suite
+
+ This file is part of OpenOffice.org.
+
+ OpenOffice.org is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Lesser General Public License version 3
+ only, as published by the Free Software Foundation.
+
+ OpenOffice.org is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Lesser General Public License version 3 for more details
+ (a copy is included in the LICENSE file that accompanied this code).
+
+ You should have received a copy of the GNU Lesser General Public License
+ version 3 along with OpenOffice.org. If not, see
+ <http://www.openoffice.org/license.html>
+ for a copy of the LGPLv3 License.
+
+ ************************************************************************ -->
+<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java"
+ manifest:full-path="mediawiki.jar"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Addons.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="ProtocolHandler.xcu"/>
+ <manifest:file-entry manifest:full-path="WikiEditor/"
+ manifest:media-type="application/vnd.sun.star.basic-library"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-schema"
+ manifest:full-path="WikiExtension.xcs"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="WikiExtension.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="OptionsDialog.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Filter.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Types.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.configuration-data"
+ manifest:full-path="Paths.xcu"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.help"
+ manifest:full-path="help"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description"
+ manifest:full-path="help/component.txt"/>
+</manifest:manifest>
diff --git a/swext/prj/build.lst b/swext/prj/build.lst
new file mode 100644
index 000000000000..0bac744df814
--- /dev/null
+++ b/swext/prj/build.lst
@@ -0,0 +1,10 @@
+swext swext : officecfg TRANSLATIONS:translations DESKTOP:l10ntools javaunohelper ridljar unoil jurt APACHE_COMMONS:apache-commons readlicense_oo xsltml xmlhelp NULL
+swext swext usr1 - all swext_mkout NULL
+swext swext\mediawiki\help nmake - all swext_mwhelp NULL
+swext swext\mediawiki\src\registry\schema\org\openoffice\Office\Custom nmake - all swext_mwschema NULL
+swext swext\mediawiki\src\registry\data\org\openoffice\Office\Custom nmake - all swext_mwcustomdata swext_mwschema NULL
+swext swext\mediawiki\src\registry\data\org\openoffice\Office nmake - all swext_mwofficedata NULL
+swext swext\mediawiki\src\registry\data\org\openoffice\TypeDetection nmake - all swext_mwtypedetection NULL
+swext swext\mediawiki\src nmake - all swext_mwlicense NULL
+swext swext\mediawiki nmake - all swext_mw swext_mwhelp swext_mwschema swext_mwcustomdata swext_mwofficedata swext_mwlicense swext_mwtypedetection NULL
+
diff --git a/swext/prj/d.lst b/swext/prj/d.lst
new file mode 100644
index 000000000000..7f7ff29dc0ee
--- /dev/null
+++ b/swext/prj/d.lst
@@ -0,0 +1,5 @@
+mkdir: %_DEST%\bin\swext
+..\%__SRC%\bin\wiki-publisher.oxt %_DEST%\bin\swext\wiki-publisher.oxt
+..\%__SRC%\bin\wiki-publisher.oxt %_DEST%\bin\wiki-publisher.oxt
+..\%__SRC%\bin\mediawiki_develop.zip %_DEST%\bin\swext\mediawiki_develop.zip
+