Restructured the project directory: Moved the sources into a subdirectory. Added build.xml, LICENSE, VERSION for distribution.

This commit is contained in:
依瑪貓 2016-09-09 23:21:50 +08:00
parent 342135d728
commit b16a28f577
30 changed files with 5502 additions and 0 deletions

611
LICENSE Normal file
View File

@ -0,0 +1,611 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE HTTP SERVER SUBCOMPONENTS:
The Apache HTTP Server includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
For the mod_mime_magic component:
/*
* mod_mime_magic: MIME type lookup via file magic numbers
* Copyright (c) 1996-1997 Cisco Systems, Inc.
*
* This software was submitted by Cisco Systems to the Apache Group in July
* 1997. Future revisions and derivatives of this source code must
* acknowledge Cisco Systems as the original contributor of this module.
* All other licensing and usage conditions are those of the Apache Group.
*
* Some of this code is derived from the free version of the file command
* originally posted to comp.sources.unix. Copyright info for that program
* is included below as required.
* ---------------------------------------------------------------------------
* - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
*
* This software is not subject to any license of the American Telephone and
* Telegraph Company or of the Regents of the University of California.
*
* Permission is granted to anyone to use this software for any purpose on any
* computer system, and to alter it and redistribute it freely, subject to
* the following restrictions:
*
* 1. The author is not responsible for the consequences of use of this
* software, no matter how awful, even if they arise from flaws in it.
*
* 2. The origin of this software must not be misrepresented, either by
* explicit claim or by omission. Since few users ever read sources, credits
* must appear in the documentation.
*
* 3. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software. Since few users ever read
* sources, credits must appear in the documentation.
*
* 4. This notice may not be removed or altered.
* -------------------------------------------------------------------------
*
*/
For the modules\mappers\mod_imagemap.c component:
"macmartinized" polygon code copyright 1992 by Eric Haines, erich@eye.com
For the server\util_md5.c component:
/************************************************************************
* NCSA HTTPd Server
* Software Development Group
* National Center for Supercomputing Applications
* University of Illinois at Urbana-Champaign
* 605 E. Springfield, Champaign, IL 61820
* httpd@ncsa.uiuc.edu
*
* Copyright (C) 1995, Board of Trustees of the University of Illinois
*
************************************************************************
*
* md5.c: NCSA HTTPd code which uses the md5c.c RSA Code
*
* Original Code Copyright (C) 1994, Jeff Hostetler, Spyglass, Inc.
* Portions of Content-MD5 code Copyright (C) 1993, 1994 by Carnegie Mellon
* University (see Copyright below).
* Portions of Content-MD5 code Copyright (C) 1991 Bell Communications
* Research, Inc. (Bellcore) (see Copyright below).
* Portions extracted from mpack, John G. Myers - jgm+@cmu.edu
* Content-MD5 Code contributed by Martin Hamilton (martin@net.lut.ac.uk)
*
*/
/* these portions extracted from mpack, John G. Myers - jgm+@cmu.edu */
/* (C) Copyright 1993,1994 by Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Carnegie
* Mellon University not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. Carnegie Mellon University makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/*
* Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
*
* Permission to use, copy, modify, and distribute this material
* for any purpose and without fee is hereby granted, provided
* that the above copyright notice and this permission notice
* appear in all copies, and that the name of Bellcore not be
* used in advertising or publicity pertaining to this
* material without the specific, prior written permission
* of an authorized representative of Bellcore. BELLCORE
* MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
* OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
*/
For the srclib\apr\include\apr_md5.h component:
/*
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
For the srclib\apr\passwd\apr_md5.c component:
/*
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
*/
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/*
* The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0
* MD5 crypt() function, which is licenced as follows:
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*/
For the srclib\apr-util\crypto\apr_md4.c component:
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD4 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\include\apr_md4.h component:
*
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD4 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\test\testmd4.c component:
*
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
* rights reserved.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\xml\expat\conftools\install-sh component:
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
For the srclib\pcre\install-sh component:
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
For the pcre component:
PCRE LICENCE
------------
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Release 5 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
directory, is distributed under the same terms as the software itself.
Written by: Philip Hazel <ph10@cam.ac.uk>
University of Cambridge Computing Service,
Cambridge, England. Phone: +44 1223 334714.
Copyright (c) 1997-2004 University of Cambridge
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* 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.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS 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 COPYRIGHT OWNER OR 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.
End PCRE LICENCE
For the test\zb.c component:
/* ZeusBench V1.01
===============
This program is Copyright (C) Zeus Technology Limited 1996.
This program may be used and copied freely providing this copyright notice
is not removed.
This software is provided "as is" and any express or implied waranties,
including but not limited to, the implied warranties of merchantability and
fitness for a particular purpose are disclaimed. In no event shall
Zeus Technology Ltd. be liable for any direct, indirect, incidental, special,
exemplary, or consequential damaged (including, but not limited to,
procurement of substitute good or services; loss of use, data, or profits;
or business interruption) however caused and on 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.
Written by Adam Twiss (adam@zeus.co.uk). March 1996
Thanks to the following people for their input:
Mike Belshe (mbelshe@netscape.com)
Michael Campanella (campanella@stevms.enet.dec.com)
*/
For the expat xml parser component:
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
and Clark Cooper
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====================================================================

1
VERSION Normal file
View File

@ -0,0 +1 @@
0.0.1

62
build.xml Normal file
View File

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<!-- build.xml: Ant build file for the StatTool project -->
<!-- by imacat <imacat@mail.imacat.idv.tw>, 2016-09-09 -->
<project name="stattool" default="help" basedir=".">
<!-- property: The build variables -->
<loadfile property="project.version" srcfile="${basedir}/VERSION">
<filterchain>
<striplinebreaks />
</filterchain>
</loadfile>
<property name="proj.name.basic" value="StatTool" />
<property name="src.dir" value="${basedir}/oxt" />
<property name="build.dir" value="build" />
<property name="dist.build.dir" value="${build.dir}/dist" />
<property name="dist.dir" value="${basedir}" />
<property name="src.build.dir" value="${build.dir}/${proj.name.basic}" />
<!-- help: Display the help information -->
<target name="help">
<echo level="info" message="Available targets:" />
<echo level="info" message=" oxt: Create the extension ${proj.name.basic}.oxt" />
<echo level="info" message=" dist: Create the pacakge distribution as ${ant.project.name}-${project.version}.zip" />
<echo level="info" message=" clean: Clean-up the build files" />
<echo level="info" message=" help: Display this help" />
</target>
<!-- oxt: Create the extension -->
<target name="oxt">
<copy todir="${src.build.dir}"
preservelastmodified="true">
<fileset dir="${src.dir}" />
</copy>
<replace file="${src.build.dir}/description.xml"
token="@VERSION@" value="${project.version}" />
<zip destfile="${basedir}/${proj.name.basic}.oxt"
basedir="${src.build.dir}" />
</target>
<!-- -distdir: Create the distribution directory -->
<target name="-distdir" depends="oxt">
<copy todir="${dist.build.dir}/${ant.project.name}-${project.version}"
preservelastmodified="true">
<fileset dir="${basedir}"
excludes="${build.dir}/ ${ant.project.name}-*.zip excludes/" />
</copy>
</target>
<!-- dist: Create the pacakge distribution -->
<target name="dist" depends="-distdir">
<zip destfile="${dist.dir}/${ant.project.name}-${project.version}.zip"
basedir="${dist.build.dir}" />
</target>
<!-- clean: Clean-up the build files -->
<target name="clean">
<delete dir="${build.dir}" />
<delete verbose="true">
<fileset file="${dist.dir}/${ant.project.name}-*.zip*" />
<fileset file="${basedir}/${proj.name.basic}.oxt" />
</delete>
</target>
</project>

103
oxt/Addons.xcu Normal file
View File

@ -0,0 +1,103 @@
<?xml version='1.0' encoding='UTF-8'?>
<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="OfficeMenuBar">
<node oor:name="StatTool.OfficeMenuBar" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value>com.sun.star.sheet.SpreadsheetDocument</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>~Statistics</value>
<value xml:lang="zh-TW">統計(~S)</value>
<value xml:lang="zh-CN">统计(~S)</value>
</prop>
<node oor:name="Submenu">
<node oor:name="m001" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:StatTool.1CorRel.subRunCorrelation?language=Basic&amp;location=application</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>Pearsons cor~relation coefficient</value>
<value xml:lang="zh-TW">皮爾森相關係數(~R)</value>
<value xml:lang="zh-CN">皮尔森相关系数(~R)</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="m002" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:StatTool.2PTTest.subRunPairedTTest?language=Basic&amp;location=application</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>~Paired-samples T-test</value>
<value xml:lang="zh-TW">相依樣本T檢定(~P)</value>
<value xml:lang="zh-CN">相依样本T检定(~P)</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="m003" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:StatTool.3ITTest.subRunIndependentTTest?language=Basic&amp;location=application</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>~Independent samples T-test</value>
<value xml:lang="zh-TW">獨立樣本T檢定(~I)</value>
<value xml:lang="zh-CN">独立样本T检定(~I)</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="m004" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:StatTool.4ANOVA.subRunANOVA?language=Basic&amp;location=application</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>One-way ~ANOVA</value>
<value xml:lang="zh-TW">單因子變異數分析(~A)</value>
<value xml:lang="zh-CN">单因子变异数分析(~A)</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
<node oor:name="m005" oor:op="replace">
<prop oor:name="Context" oor:type="xs:string">
<value></value>
</prop>
<prop oor:name="URL" oor:type="xs:string">
<value>vnd.sun.star.script:StatTool.5Chi2GoF.subRunChi2GoodnessOfFit?language=Basic&amp;location=application</value>
</prop>
<prop oor:name="Title" oor:type="xs:string">
<value>~Chi-square goodness of fit</value>
<value xml:lang="zh-TW">卡方檢定:百分比同質性考驗(~C)</value>
<value xml:lang="zh-CN">卡方检定:百分比同质性考验(~C)</value>
</prop>
<prop oor:name="Target" oor:type="xs:string">
<value>_self</value>
</prop>
</node>
</node>
</node>
</node>
</node>
</oor:component-data>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest>
<manifest:file-entry manifest:full-path="StatTool/" manifest:media-type="application/vnd.sun.star.basic-library"/>
<manifest:file-entry manifest:full-path="pkg-desc/pkg-description.txt" manifest:media-type="application/vnd.sun.star.package-bundle-description"/>
<manifest:file-entry manifest:full-path="pkg-desc/pkg-description.zh-TW.txt" manifest:media-type="application/vnd.sun.star.package-bundle-description;locale=zh-TW"/>
<manifest:file-entry manifest:full-path="pkg-desc/pkg-description.zh-CN.txt" manifest:media-type="application/vnd.sun.star.package-bundle-description;locale=zh-CN"/>
<manifest:file-entry manifest:full-path="Addons.xcu" manifest:media-type="application/vnd.sun.star.configuration-data"/>
</manifest:manifest>

334
oxt/StatTool/1CorRel.xba Normal file
View File

@ -0,0 +1,334 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="1CorRel" script:language="StarBasic">&apos; Copyright (c) 2016 imacat.
&apos;
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos;
&apos; http://www.apache.org/licenses/LICENSE-2.0
&apos;
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 1CorRel: The macros to for generating the report of the Pearsons correlation coefficient
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2016-08-10
Option Explicit
&apos; subRunCorrelation: Runs the Pearsons correlation coefficient.
Sub subRunCorrelation As Object
Dim oRange As Object
Dim oSheets As Object, sSheetName As String
Dim oSheet As Object, mRanges As Object
Dim sExisted As String, nResult As Integer
DialogLibraries.loadLibrary &quot;StatTool&quot;
&apos; Asks the user for the data range
oRange = fnAskDataRange (ThisComponent)
If IsNull (oRange) Then
Exit Sub
End If
&apos; Specifies the data
mRanges = fnSpecifyData (oRange, _
&quot;&amp;3.Dlg2SpecData.txtPrompt1.Label1CorRel&quot;, _
&quot;&amp;6.Dlg2SpecData.txtPrompt2.Label1CorRel&quot;)
If IsNull (mRanges) Then
Exit Sub
End If
&apos; Checks the existing report
oSheets = ThisComponent.getSheets
sSheetName = oRange.getSpreadsheet.getName
If oSheets.hasByName (sSheetName &amp; &quot;_correl&quot;) Then
sExisted = &quot;Spreadsheet &quot;&quot;&quot; &amp; sSheetName &amp; &quot;_correl&quot;&quot; exists. Overwrite?&quot;
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
If nResult = IDNO Then
Exit Sub
End If
&apos; Drops the existing report
oSheets.removeByname (sSheetName &amp; &quot;_correl&quot;)
End If
&apos; Reports the paired T-test.
subReportCorrelation (ThisComponent, mRanges (0), mRanges (1))
oSheet = oSheets.getByName (sSheetName &amp; &quot;_correl&quot;)
&apos; Adds an X-Y diagram.
subAddChart (oSheet, mRanges (0), mRanges (1))
&apos; Makes the report sheet active.
ThisComponent.getCurrentController.setActiveSheet (oSheet)
End Sub
&apos; subAddChart: Adds a chart for the data
Sub subAddChart (oSheet As Object, oDataXRange As Object, oDataYRange As Object)
Dim oCharts As Object, oChart As Object
Dim oChartDoc As Object, oDiagram As Object
Dim aPos As New com.sun.star.awt.Rectangle
Dim mAddrs (1) As New com.sun.star.table.CellRangeAddress
Dim sTitle As String
Dim oProvider As Object, oData As Object
Dim sRange As String, mData () As Object
&apos; Adds the chart
With aPos
.X = 0
.Y = 3510
.Width = 10000
.Height = 10000
End With
mAddrs (0) = oDataXRange.getRangeAddress
mAddrs (1) = oDataYRange.getRangeAddress
oCharts = oSheet.getCharts
oCharts.addNewByName (oSheet.getName, aPos, mAddrs, True, False)
oChart = oCharts.getByName (oSheet.getName)
oChartDoc = oChart.getEmbeddedObject
BasicLibraries.loadLibrary &quot;XrayTool&quot;
oDiagram = oChartDoc.createInstance ( _
&quot;com.sun.star.chart.XYDiagram&quot;)
oDiagram.setPropertyValue (&quot;Lines&quot;, False)
oDiagram.setPropertyValue (&quot;HasXAxisGrid&quot;, False)
oDiagram.setPropertyValue (&quot;HasYAxisGrid&quot;, False)
sTitle = oDataXRange.getCellByPosition (0, 0).getString
oDiagram.getXAxisTitle.setPropertyValue (&quot;String&quot;, sTitle)
sTitle = oDataYRange.getCellByPosition (0, 0).getString
oDiagram.getYAxisTitle.setPropertyValue (&quot;String&quot;, sTitle)
oDiagram.getXAxis.setPropertyValue (&quot;Min&quot;, 0)
oDiagram.getYAxis.setPropertyValue (&quot;Min&quot;, 0)
oChartDoc.setDiagram (oDiagram)
oProvider = oChartDoc.getDataProvider
mData = oChartDoc.getDataSequences
sRange = oDataXRange.getCellByPosition(0, 0).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
mData (0).setLabel (oData)
sRange = oDataXRange.getCellRangeByPosition(0, 1, 0, oDataXRange.getRows.getCount - 1).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
oData.Role = &quot;values-x&quot;
mData (0).setValues (oData)
sRange = oDataYRange.getCellByPosition(0, 0).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
mData (1).setLabel (oData)
sRange = oDataYRange.getCellRangeByPosition(0, 1, 0, oDataYRange.getRows.getCount - 1).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
oData.Role = &quot;values-y&quot;
mData (1).setValues (oData)
oChartDoc.setPropertyValue (&quot;HasLegend&quot;, False)
End Sub
&apos; subReportCorrelation: Reports the Pearsons correlation coefficient
Sub subReportCorrelation (oDoc As Object, oDataXRange As Object, oDataYRange As Object)
Dim oSheets As Object, sSheetName As String
Dim mNames () As String, nI As Integer, nSheetIndex As Integer
Dim oSheet As Object, oColumns As Object, nRow As Integer
Dim oCell As Object, oCells As Object, oCursor As Object
Dim nN As Integer, sFormula As String
Dim sNotes As String, nPos As Integer
Dim nFormatN As Integer, nFormatF As Integer, nFormatP As Integer
Dim aBorderSingle As New com.sun.star.table.BorderLine
Dim aBorderDouble As New com.sun.star.table.BorderLine
Dim sCellXLabel As String, sCellsXData As String
Dim sCellYLabel As String, sCellsYData As String
Dim sCellN As String, sCellR As String
oSheets = oDoc.getSheets
sSheetName = oDataXRange.getSpreadsheet.getName
mNames = oSheets.getElementNames
For nI = 0 To UBound (mNames)
If mNames (nI) = sSheetName Then
nSheetIndex = nI
End If
Next nI
oSheets.insertNewByName (sSheetName &amp; &quot;_correl&quot;, nSheetIndex + 1)
oSheet = oSheets.getByName (sSheetName &amp; &quot;_correl&quot;)
nN = oDataXRange.getRows.getCount - 1
sCellXLabel = fnGetRangeName (oDataXRange.getCellByPosition (0, 0))
sCellsXData = fnGetRangeName (oDataXRange.getCellRangeByPosition (0, 1, 0, nN))
sCellYLabel = fnGetRangeName (oDataYRange.getCellByPosition (0, 0))
sCellsYData = fnGetRangeName (oDataYRange.getCellRangeByPosition (0, 1, 0, nN))
&apos; Obtains the format parameters for the report.
nFormatN = fnQueryFormat (oDoc, &quot;#,##0&quot;)
nFormatF = fnQueryFormat (oDoc, &quot;#,###.000&quot;)
nFormatP = fnQueryFormat (oDoc, &quot;[&lt;0.01]#.000&quot;&quot;**&quot;&quot;;[&lt;0.05]#.000&quot;&quot;*&quot;&quot;;#.000&quot;)
aBorderSingle.OuterLineWidth = 2
aBorderDouble.OuterLineWidth = 2
aBorderDouble.InnerLineWidth = 2
aBorderDouble.LineDistance = 2
&apos; Sets the column widths of the report.
oColumns = oSheet.getColumns
oColumns.getByIndex (0).setPropertyValue (&quot;Width&quot;, 3060)
oColumns.getByIndex (1).setPropertyValue (&quot;Width&quot;, 3060)
oColumns.getByIndex (2).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (3).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (4).setPropertyValue (&quot;Width&quot;, 2080)
nRow = -2
&apos; Correlation
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Pearsons Correlation&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;X&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;Y&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;N&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;r&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
&apos; The test result.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellN = fnGetLocalRangeName (oCell)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=CORREL(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellR = fnGetLocalRangeName (oCell)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=TDIST(&quot; &amp; sCellR &amp; &quot;*SQRT((&quot; &amp; sCellN &amp; &quot;-2)/(1-&quot; &amp; sCellR &amp; &quot;*&quot; &amp; sCellR &amp; &quot;))&quot; &amp; &quot;;&quot; &amp; sCellN &amp; &quot;-2;2)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: ρ=0 (the populations of the two groups are irrelavent).&quot; &amp; Chr (10) &amp; _
&quot;H1: ρ≠0 (the populations of the two groups are relevant) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;ρ&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;ρ&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (1, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 4, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (1, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
End Sub
</script:module>

648
oxt/StatTool/2PTTest.xba Normal file
View File

@ -0,0 +1,648 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="2PTTest" script:language="StarBasic">&apos; Copyright (c) 2016 imacat.
&apos;
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos;
&apos; http://www.apache.org/licenses/LICENSE-2.0
&apos;
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 2PTTest: The macros to for generating the report of paired T-Test
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2016-08-11
Option Explicit
&apos; subRunPairedTTest: Runs the paired T-test.
Sub subRunPairedTTest As Object
Dim oRange As Object
Dim oSheets As Object, sSheetName As String
Dim oSheet As Object, mRanges As Object
Dim sExisted As String, nResult As Integer
DialogLibraries.loadLibrary &quot;StatTool&quot;
&apos; Asks the user for the data range
oRange = fnAskDataRange (ThisComponent)
If IsNull (oRange) Then
Exit Sub
End If
&apos; Specifies the data
mRanges = fnSpecifyData (oRange, _
&quot;&amp;3.Dlg2SpecData.txtPrompt1.Label1CorRel&quot;, _
&quot;&amp;6.Dlg2SpecData.txtPrompt2.Label1CorRel&quot;)
If IsNull (mRanges) Then
Exit Sub
End If
&apos; Checks the existing report
oSheets = ThisComponent.getSheets
sSheetName = oRange.getSpreadsheet.getName
If oSheets.hasByName (sSheetName &amp; &quot;_ttest&quot;) Then
sExisted = &quot;Spreadsheet &quot;&quot;&quot; &amp; sSheetName &amp; &quot;_ttest&quot;&quot; exists. Overwrite?&quot;
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
If nResult = IDNO Then
Exit Sub
End If
&apos; Drops the existing report
oSheets.removeByname (sSheetName &amp; &quot;_ttest&quot;)
End If
&apos; Reports the paired T-test.
subReportPairedTTest (ThisComponent, mRanges (0), mRanges (1))
oSheet = oSheets.getByName (sSheetName &amp; &quot;_ttest&quot;)
&apos; Adds an X-Y diagram.
subAddChart (oSheet, mRanges (0), mRanges (1))
&apos; Makes the report sheet active.
ThisComponent.getCurrentController.setActiveSheet (oSheet)
End Sub
&apos; subAddChart: Adds a chart for the data
Sub subAddChart (oSheet As Object, oDataXRange As Object, oDataYRange As Object)
Dim oCharts As Object, oChart As Object
Dim oChartDoc As Object, oDiagram As Object
Dim aPos As New com.sun.star.awt.Rectangle
Dim mAddrs (1) As New com.sun.star.table.CellRangeAddress
Dim sTitle As String
Dim oProvider As Object, oData As Object
Dim sRange As String, mData () As Object
&apos; Adds the chart
With aPos
.X = 0
.Y = 10000
.Width = 10000
.Height = 10000
End With
mAddrs (0) = oDataXRange.getRangeAddress
mAddrs (1) = oDataYRange.getRangeAddress
oCharts = oSheet.getCharts
oCharts.addNewByName (oSheet.getName, aPos, mAddrs, True, False)
oChart = oCharts.getByName (oSheet.getName)
oChartDoc = oChart.getEmbeddedObject
BasicLibraries.loadLibrary &quot;XrayTool&quot;
oDiagram = oChartDoc.createInstance ( _
&quot;com.sun.star.chart.XYDiagram&quot;)
oDiagram.setPropertyValue (&quot;Lines&quot;, False)
oDiagram.setPropertyValue (&quot;HasXAxisGrid&quot;, False)
oDiagram.setPropertyValue (&quot;HasYAxisGrid&quot;, False)
sTitle = oDataXRange.getCellByPosition (0, 0).getString
oDiagram.getXAxisTitle.setPropertyValue (&quot;String&quot;, sTitle)
sTitle = oDataYRange.getCellByPosition (0, 0).getString
oDiagram.getYAxisTitle.setPropertyValue (&quot;String&quot;, sTitle)
oDiagram.getXAxis.setPropertyValue (&quot;Min&quot;, 0)
oDiagram.getYAxis.setPropertyValue (&quot;Min&quot;, 0)
oChartDoc.setDiagram (oDiagram)
oProvider = oChartDoc.getDataProvider
mData = oChartDoc.getDataSequences
sRange = oDataXRange.getCellByPosition(0, 0).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
mData (0).setLabel (oData)
sRange = oDataXRange.getCellRangeByPosition(0, 1, 0, oDataXRange.getRows.getCount - 1).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
oData.Role = &quot;values-x&quot;
mData (0).setValues (oData)
sRange = oDataYRange.getCellByPosition(0, 0).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
mData (1).setLabel (oData)
sRange = oDataYRange.getCellRangeByPosition(0, 1, 0, oDataYRange.getRows.getCount - 1).getPropertyValue (&quot;AbsoluteName&quot;)
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
oData.Role = &quot;values-y&quot;
mData (1).setValues (oData)
oChartDoc.setPropertyValue (&quot;HasLegend&quot;, False)
End Sub
&apos; subReportPairedTTest: Reports the paired T-test
Sub subReportPairedTTest (oDoc As Object, oDataXRange As Object, oDataYRange As Object)
Dim oSheets As Object, sSheetName As String
Dim mNames () As String, nI As Integer, nSheetIndex As Integer
Dim oSheet As Object, oColumns As Object, nRow As Integer
Dim oCell As Object, oCells As Object, oCursor As Object
Dim nN As Integer, sFormula As String
Dim sNotes As String, nPos As Integer
Dim nFormatN As Integer, nFormatF As Integer, nFormatP As Integer
Dim aBorderSingle As New com.sun.star.table.BorderLine
Dim aBorderDouble As New com.sun.star.table.BorderLine
Dim sCellXLabel As String, sCellsXData As String
Dim sCellXN As String, sCellXMean As String, sCellXS As String
Dim sCellYLabel As String, sCellsYData As String
Dim sCellYN As String, sCellYMean As String, sCellYS As String
Dim sCellN As String, sCellXYS As String, sCellR As String
oSheets = oDoc.getSheets
sSheetName = oDataXRange.getSpreadsheet.getName
mNames = oSheets.getElementNames
For nI = 0 To UBound (mNames)
If mNames (nI) = sSheetName Then
nSheetIndex = nI
End If
Next nI
oSheets.insertNewByName (sSheetName &amp; &quot;_ttest&quot;, nSheetIndex + 1)
oSheet = oSheets.getByName (sSheetName &amp; &quot;_ttest&quot;)
nN = oDataXRange.getRows.getCount - 1
sCellXLabel = fnGetRangeName (oDataXRange.getCellByPosition (0, 0))
sCellsXData = fnGetRangeName (oDataXRange.getCellRangeByPosition (0, 1, 0, nN))
sCellYLabel = fnGetRangeName (oDataYRange.getCellByPosition (0, 0))
sCellsYData = fnGetRangeName (oDataYRange.getCellRangeByPosition (0, 1, 0, nN))
&apos; Obtains the format parameters for the report.
nFormatN = fnQueryFormat (oDoc, &quot;#,##0&quot;)
nFormatF = fnQueryFormat (oDoc, &quot;#,###.000&quot;)
nFormatP = fnQueryFormat (oDoc, &quot;[&lt;0.01]#.000&quot;&quot;**&quot;&quot;;[&lt;0.05]#.000&quot;&quot;*&quot;&quot;;#.000&quot;)
aBorderSingle.OuterLineWidth = 2
aBorderDouble.OuterLineWidth = 2
aBorderDouble.InnerLineWidth = 2
aBorderDouble.LineDistance = 2
&apos; Sets the column widths of the report.
oColumns = oSheet.getColumns
oColumns.getByIndex (0).setPropertyValue (&quot;Width&quot;, 3060)
oColumns.getByIndex (1).setPropertyValue (&quot;Width&quot;, 3060)
oColumns.getByIndex (2).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (3).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (4).setPropertyValue (&quot;Width&quot;, 2080)
nRow = -2
&apos; Group description
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Sample Description&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 5, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Sample&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
oCells.merge (True)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;N&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;X&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;s&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (5, nRow)
oCell.setString (&quot;sX&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
&apos; The first group
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
oCells.merge (True)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellXN = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellXMean = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=STDEV(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellXS = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (5, nRow)
sFormula = &quot;=&quot; &amp; sCellXS &amp; &quot;/SQRT(&quot; &amp; sCellXN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; The second group
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
oCells.merge (True)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellYN = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellYMean = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=STDEV(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellYS = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (5, nRow)
sFormula = &quot;=&quot; &amp; sCellYS &amp; &quot;/SQRT(&quot; &amp; sCellYN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; The difference between the two groups
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot;&quot;(&quot;&quot;&amp;&quot; &amp; sCellXLabel &amp; &quot;&amp;&quot;&quot;-&quot;&quot;&amp;&quot; &amp; sCellYLabel &amp; &quot;&amp;&quot;&quot;)&quot;&quot;&quot;
oCell.setFormula (sFormula)
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
oCells.merge (True)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=&quot; &amp; sCellXN
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellN = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=SQRT(&quot; &amp; sCellXS &amp; &quot;*&quot; &amp; sCellXS &amp; &quot;-2*SUMPRODUCT(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;)/(&quot; &amp; sCellN &amp; &quot;-1)+2*&quot; &amp; sCellXMean &amp; &quot;*&quot; &amp; sCellYMean &amp; &quot;*&quot; &amp; sCellN &amp; &quot;/(&quot; &amp; sCellN &amp; &quot;-1)+&quot; &amp; sCellYS &amp; &quot;*&quot; &amp; sCellYS &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellXYS = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (5, nRow)
sFormula = &quot;=&quot; &amp; sCellXYS &amp; &quot;/SQRT(&quot; &amp; sCellN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 3)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - 3, 5, nRow - 3)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (0, nRow - 2, 0, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow, 5, nRow)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; Correlation
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Pearsons Correlation&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;X1&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;X2&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;r&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
&apos; The test result.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=CORREL(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellR = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=TDIST(ABS(&quot; &amp; sCellR &amp; &quot;)*SQRT((&quot; &amp; sCellN &amp; &quot;-2)/(1-&quot; &amp; sCellR &amp; &quot;*&quot; &amp; sCellR &amp; &quot;))&quot; &amp; &quot;;&quot; &amp; sCellN &amp; &quot;-2;2)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: ρ=0 (the populations of the two samples are irrelavent).&quot; &amp; Chr (10) &amp; _
&quot;H1: ρ≠0 (the populations of the two samples are relevant) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;ρ&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (1, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 3, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (1, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 3, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; Paired-samples T-test
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Paired-Samples T-test&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;X1&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;X2&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;t&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;df&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
&apos; The test result.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=(&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean &amp; &quot;)/SQRT((&quot; &amp; sCellXS &amp; &quot;*&quot; &amp; sCellXS &amp; &quot;+&quot; &amp; sCellYS &amp; &quot;*&quot; &amp; sCellYS &amp; &quot;-2*&quot; &amp; sCellR &amp; &quot;*&quot; &amp; sCellXS &amp; &quot;*&quot; &amp; sCellYS &amp; &quot;)/&quot; &amp; sCellN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=&quot; &amp; sCellN &amp; &quot;-1&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=TTEST(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;;2;1)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: μ1=μ2 (the populations of the two samples have the same means).&quot; &amp; Chr (10) &amp; _
&quot;H1: μ1≠μ2 (the populations of the two samples have different means) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;μ&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (nPos + 1, sNotes, &quot;μ&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (1, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 4, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (1, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
End Sub
</script:module>

811
oxt/StatTool/3ITTest.xba Normal file
View File

@ -0,0 +1,811 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="3ITTest" script:language="StarBasic">&apos; Copyright (c) 2016 imacat.
&apos;
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos;
&apos; http://www.apache.org/licenses/LICENSE-2.0
&apos;
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 3ITTest: The macros to for generating the report of independent T-Test
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2016-08-24
Option Explicit
&apos; subRunIndependentTTest: Runs the independent T-test.
Sub subRunIndependentTTest As Object
Dim oRange As Object
Dim oSheets As Object, sSheetName As String
Dim oSheet As Object, mRanges As Object
Dim sExisted As String, nResult As Integer
DialogLibraries.loadLibrary &quot;StatTool&quot;
&apos; Asks the user for the data range
oRange = fnAskDataRange (ThisComponent)
If IsNull (oRange) Then
Exit Sub
End If
&apos; Specifies the data
mRanges = fnSpecifyData (oRange, _
&quot;&amp;10.Dlg2SpecData.txtPrompt1.Label3ITTest&quot;, _
&quot;&amp;11.Dlg2SpecData.txtPrompt2.Label3ITTest&quot;)
If IsNull (mRanges) Then
Exit Sub
End If
&apos; Checks the existing report
oSheets = ThisComponent.getSheets
sSheetName = oRange.getSpreadsheet.getName
sExisted = &quot;&quot;
If oSheets.hasByName (sSheetName &amp; &quot;_ttest&quot;) Then
sExisted = sExisted &amp; &quot;, &quot;&quot;&quot; &amp; sSheetName &amp; &quot;_ttest&quot;&quot;&quot;
End If
If oSheets.hasByName (sSheetName &amp; &quot;_ttesttmp&quot;) Then
sExisted = sExisted &amp; &quot;, &quot;&quot;&quot; &amp; sSheetName &amp; &quot;_ttesttmp&quot;&quot;&quot;
End If
If sExisted &lt;&gt; &quot;&quot; Then
sExisted = Right (sExisted, Len (sExisted) - 2)
If InStr (sExisted, &quot;,&quot;) &gt; 0 Then
sExisted = &quot;Spreadsheets &quot; &amp; sExisted &amp; &quot; exist. Overwrite?&quot;
Else
sExisted = &quot;Spreadsheet &quot; &amp; sExisted &amp; &quot; exists. Overwrite?&quot;
End If
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
If nResult = IDNO Then
Exit Sub
End If
&apos; Drops the existing report
If oSheets.hasByName (sSheetName &amp; &quot;_ttest&quot;) Then
oSheets.removeByname (sSheetName &amp; &quot;_ttest&quot;)
End If
If oSheets.hasByName (sSheetName &amp; &quot;_ttesttmp&quot;) Then
oSheets.removeByname (sSheetName &amp; &quot;_ttesttmp&quot;)
End If
End If
&apos; Reports the independent T-test.
subReportIndependentTTest (ThisComponent, mRanges (0), mRanges (1))
oSheet = oSheets.getByName (sSheetName &amp; &quot;_ttest&quot;)
&apos; Makes the report sheet active.
ThisComponent.getCurrentController.setActiveSheet (oSheet)
End Sub
&apos; subReportIndependentTTest: Reports the independent T-test
Sub subReportIndependentTTest (oDoc As Object, oLabelColumn As Object, oScoreColumn As Object)
Dim oSheets As Object, sSheetName As String
Dim mNames () As String, nI As Integer, nSheetIndex As Integer
Dim oSheet As Object, oColumns As Object, nRow As Integer
Dim oCell As Object, oCells As Object, oCursor As Object, oTempDataRange As Object
Dim nN As Integer, sFormula As String, sSP2 As String
Dim sNotes As String, nPos As Integer
Dim nFormatN As Integer, nFormatF As Integer, nFormatP As Integer
Dim aBorderSingle As New com.sun.star.table.BorderLine
Dim aBorderDouble As New com.sun.star.table.BorderLine
Dim sCellXLabel As String, sCellsXData As String
Dim sCellXN As String, sCellXMean As String, sCellXS As String
Dim sCellYLabel As String, sCellsYData As String
Dim sCellYN As String, sCellYMean As String, sCellYS As String
Dim sCellF As String, sCellsN As String, sCellN As String
oSheets = oDoc.getSheets
sSheetName = oLabelColumn.getSpreadsheet.getName
mNames = oSheets.getElementNames
For nI = 0 To UBound (mNames)
If mNames (nI) = sSheetName Then
nSheetIndex = nI
End If
Next nI
oSheets.insertNewByName (sSheetName &amp; &quot;_ttesttmp&quot;, nSheetIndex + 1)
oSheet = oSheets.getByName (sSheetName &amp; &quot;_ttesttmp&quot;)
oTempDataRange = fnCollectIndependentTTestData (oSheet, oLabelColumn, oScoreColumn)
oSheets.insertNewByName (sSheetName &amp; &quot;_ttest&quot;, nSheetIndex + 1)
oSheet = oSheets.getByName (sSheetName &amp; &quot;_ttest&quot;)
sCellXLabel = fnGetRangeName (oTempDataRange.getCellByPosition (0, 0))
nN = oTempDataRange.getCellByPosition (0, oTempDataRange.getRows.getCount - 3).getValue
oCells = oTempDataRange.getCellRangeByPosition (0, 1, 0, nN)
sCellsXData = fnGetRangeName (oCells)
sCellYLabel = fnGetRangeName (oTempDataRange.getCellByPosition (1, 0))
nN = oTempDataRange.getCellByPosition (1, oTempDataRange.getRows.getCount - 3).getValue
oCells = oTempDataRange.getCellRangeByPosition (1, 1, 1, nN)
sCellsYData = fnGetRangeName (oCells)
&apos; Obtains the format parameters for the report.
nFormatN = fnQueryFormat (oDoc, &quot;#,##0&quot;)
nFormatF = fnQueryFormat (oDoc, &quot;#,###.000&quot;)
nFormatP = fnQueryFormat (oDoc, &quot;[&lt;0.01]#.000&quot;&quot;**&quot;&quot;;[&lt;0.05]#.000&quot;&quot;*&quot;&quot;;#.000&quot;)
aBorderSingle.OuterLineWidth = 2
aBorderDouble.OuterLineWidth = 2
aBorderDouble.InnerLineWidth = 2
aBorderDouble.LineDistance = 2
&apos; Sets the column widths of the report.
oColumns = oSheet.getColumns
oColumns.getByIndex (0).setPropertyValue (&quot;Width&quot;, 3060)
oColumns.getByIndex (1).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (2).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (3).setPropertyValue (&quot;Width&quot;, 2080)
oColumns.getByIndex (4).setPropertyValue (&quot;Width&quot;, 2080)
nRow = -2
&apos; Group description
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Group Description&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Group&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;N&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;X&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;s&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;sX&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
&apos; The first group
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellXN = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellXMean = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=STDEV(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellXS = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=&quot; &amp; sCellXS &amp; &quot;/SQRT(&quot; &amp; sCellXN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; The second group
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellYN = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellYMean = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=STDEV(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellYS = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=&quot; &amp; sCellYS &amp; &quot;/SQRT(&quot; &amp; sCellYN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 4, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow, 4, nRow)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; Levene&apos;s test for homogeneity of variances
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Test for Homogeneity of Variances&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Test&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;F&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
&apos; The test result.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Levenes Test&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; fnGetLeveneTest (oTempDataRange)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellF = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (2, nRow)
sCellsN = fnGetRangeName (oTempDataRange.getCellRangeByPosition (0, oTempDataRange.getRows.getCount - 3, 1, oTempDataRange.getRows.getCount - 3))
sCellN = fnGetRangeName (oTempDataRange.getCellByPosition (4, oTempDataRange.getRows.getCount - 3))
sFormula = &quot;=FDIST(&quot; &amp; sCellF &amp; &quot;;COUNT(&quot; &amp; sCellsN &amp; &quot;)-1;&quot; &amp; sCellN &amp; &quot;-COUNT(&quot; &amp; sCellsN &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: σ1=σ2 (homogeneity; the populations of the two groups have the same variances).&quot; &amp; Chr (10) &amp; _
&quot;H1: σ1≠σ2 (heterogeneity; the populations of the two groups have different variances) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;σ&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (nPos + 1, sNotes, &quot;σ&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 2, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 2, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; The independent samples T-test
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Independent Samples T-Test&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Type&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;t&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;df&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;X1-X2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.goRight (1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharOverline&quot;, com.sun.star.awt.FontUnderline.SINGLE)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; The test of the homogeneity of variances.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Homogeneity&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
sSP2 = &quot;((SUMPRODUCT(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsXData &amp; &quot;)-POWER(SUM(&quot; &amp; sCellsXData &amp; &quot;);2)/&quot; &amp; sCellXN &amp; &quot;+SUMPRODUCT(&quot; &amp; sCellsYData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;)-POWER(SUM(&quot; &amp; sCellsYData &amp; &quot;);2)/&quot; &amp; sCellYN &amp; &quot;)/(&quot; &amp; sCellXN &amp; &quot;+&quot; &amp; sCellYN &amp; &quot;-2))&quot;
sFormula = &quot;=(&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean &amp; &quot;)/SQRT(&quot; &amp; sSP2 &amp; &quot;*(1/&quot; &amp; sCellXN &amp; &quot;+1/&quot; &amp; sCellYN &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=&quot; &amp; sCellXN &amp; &quot;+&quot; &amp; sCellYN &amp; &quot;-2&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=TTEST(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;;2;2)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; The test of the heterogeneity of variances.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Heterogeneity&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=(&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean &amp; &quot;)/SQRT(POWER(&quot; &amp; sCellXS &amp; &quot;;2)/&quot; &amp; sCellXN &amp; &quot;+POWER(&quot; &amp; sCellYS &amp; &quot;;2)/&quot; &amp; sCellYN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=POWER(POWER(&quot; &amp; sCellXS &amp; &quot;;2)/&quot; &amp; sCellXN &amp; &quot;+POWER(&quot; &amp; sCellYS &amp; &quot;;2)/&quot; &amp; sCellYN &amp; &quot;;2)/(POWER(&quot; &amp; sCellXS &amp; &quot;;4)/(POWER(&quot; &amp; sCellXN &amp; &quot;;2)*(&quot; &amp; sCellXN &amp; &quot;-1))+POWER(&quot; &amp; sCellYS &amp; &quot;;4)/(POWER(&quot; &amp; sCellYN &amp; &quot;;2)*(&quot; &amp; sCellYN &amp; &quot;-1)))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=TTEST(&quot; &amp; sCellsXData &amp; &quot;;&quot; &amp; sCellsYData &amp; &quot;;2;3)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=&quot; &amp; sCellXMean &amp; &quot;-&quot; &amp; sCellYMean
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: μ1=μ2 (the populations of the two groups have the same means).&quot; &amp; Chr (10) &amp; _
&quot;H1: μ1≠μ2 (the populations of the two groups have different means) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;μ&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (nPos + 1, sNotes, &quot;μ&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 3)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - 3, 4, nRow - 3)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 4, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
End Sub
&apos; fnCollectIndependentTTestData: Collects the data for the independent T-test.
Function fnCollectIndependentTTestData (oReportSheet As Object, oLabelColumn As Object, oScoreColumn As Object) As Object
Dim nRow As Integer, nNRow As Integer, sCellZMean As String, sCellsN As String
Dim oCell As Object, oCells As Object, oCursor As Object
Dim sCell As String, sLabel As String, sFormula As String
Dim sCellXLabel As String, sCellsXData As String, sCellXMean As String
Dim sXLabel As String, nNX As Integer
Dim sCellsXZData As String, sCellXZMean As String
Dim sCellYLabel As String, sCellsYData As String, sCellYMean As String
Dim sYLabel As String, nNY As Integer
Dim sCellsYZData As String, sCellYZMean As String
sCellXLabel = &quot;&quot;
sCellYLabel = &quot;&quot;
For nRow = 1 To oLabelColumn.getRows.getCount - 1
oCell = oLabelColumn.getCellByPosition (0, nRow)
sLabel = oCell.getString
If sLabel &lt;&gt; &quot;&quot; Then
If sCellXLabel = &quot;&quot; Then
sCellXLabel = fnGetRangeName (oCell)
sXLabel = sLabel
Else
If sLabel &lt;&gt; sXLabel And sCellYLabel = &quot;&quot; Then
sCellYLabel = fnGetRangeName (oCell)
sYLabel = sLabel
nRow = oLabelColumn.getRows.getCount - 1
End If
End If
End If
Next nRow
&apos; The data labels
oCell = oReportSheet.getCellByPosition (0, 0)
sFormula = &quot;=&quot; &amp; sCellXLabel
oCell.setFormula (sFormula)
oCell = oReportSheet.getCellByPosition (1, 0)
sFormula = &quot;=&quot; &amp; sCellYLabel
oCell.setFormula (sFormula)
&apos; The data
nNX = 0
nNY = 0
For nRow = 1 To oLabelColumn.getRows.getCount - 1
If oLabelColumn.getCellByPosition (0, nRow).getString = sXLabel Then
nNX = nNX + 1
sFormula = &quot;=&quot; &amp; fnGetRangeName (oScoreColumn.getCellByPosition (0, nRow))
oReportSheet.getCellByPosition (0, nNX).setFormula (sFormula)
Else
If oLabelColumn.getCellByPosition (0, nRow).getString = sYLabel Then
nNY = nNY + 1
sFormula = &quot;=&quot; &amp; fnGetRangeName (oScoreColumn.getCellByPosition (0, nRow))
oReportSheet.getCellByPosition (1, nNY).setFormula (sFormula)
End If
End If
Next nRow
&apos; Collects the data
sCellsXData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (0, 1, 0, nNX))
sCellsYData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (1, 1, 1, nNY))
If nNX &gt; nNY Then
nNRow = nNX + 1
Else
nNRow = nNY + 1
End If
oCell = oReportSheet.getCellByPosition (0, nNRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell = oReportSheet.getCellByPosition (1, nNRow)
sFormula = &quot;=COUNT(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell = oReportSheet.getCellByPosition (0, nNRow + 1)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsXData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellXMean = fnGetLocalRangeName (oCell)
oCell = oReportSheet.getCellByPosition (1, nNRow + 1)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsYData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellYMean = fnGetLocalRangeName (oCell)
oCells = oReportSheet.getCellRangeByPosition (0, nNRow, 1, nNRow)
sCellsN = fnGetLocalRangeName (oCells)
&apos; Calculates the Z values
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, 0))
sFormula = &quot;=&quot;&quot;Z&quot;&quot;&amp;&quot; &amp; sCell
oCell = oReportSheet.getCellByPosition (2, 0)
oCell.setFormula (sFormula)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
For nRow = 1 To nNX
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, nRow))
sFormula = &quot;=ABS(&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellXMean &amp; &quot;)&quot;
oCell = oReportSheet.getCellByPosition (2, nRow)
oCell.setFormula (sFormula)
Next nRow
sCellsXZData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (2, 1, 2, nNX))
oCell = oReportSheet.getCellByPosition (2, nNRow + 1)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsXZData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellXZMean = fnGetLocalRangeName (oCell)
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, 0))
sFormula = &quot;=&quot;&quot;Z&quot;&quot;&amp;&quot; &amp; sCell
oCell = oReportSheet.getCellByPosition (3, 0)
oCell.setFormula (sFormula)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
For nRow = 1 To nNY
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, nRow))
sFormula = &quot;=ABS(&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellYMean &amp; &quot;)&quot;
oCell = oReportSheet.getCellByPosition (3, nRow)
oCell.setFormula (sFormula)
Next nRow
sCellsYZData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (3, 1, 3, nNY))
oCell = oReportSheet.getCellByPosition (3, nNRow + 1)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsYZData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellYZMean = fnGetLocalRangeName (oCell)
&apos; Calculates the total average
oCell = oReportSheet.getCellByPosition (4, nNRow)
sFormula = &quot;=SUM(&quot; &amp; sCellsN &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell = oReportSheet.getCellByPosition (4, nNRow + 1)
sFormula = &quot;=AVERAGE(&quot; &amp; sCellsXZData &amp; &quot;;&quot; &amp; sCellsYZData &amp; &quot;)&quot;
oCell.setFormula (sFormula)
sCellZMean = fnGetLocalRangeName (oCell)
&apos; Calculates the difference of the Z values to their means
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, 0))
sFormula = &quot;=&quot;&quot;dZ&quot;&quot;&amp;&quot; &amp; sCell
oCell = oReportSheet.getCellByPosition (4, 0)
oCell.setFormula (sFormula)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -44)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
For nRow = 1 To nNX
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (2, nRow))
sFormula = &quot;=&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellXZMean
oCell = oReportSheet.getCellByPosition (4, nRow)
oCell.setFormula (sFormula)
Next nRow
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, 0))
sFormula = &quot;=&quot;&quot;dZ&quot;&quot;&amp;&quot; &amp; sCell
oCell = oReportSheet.getCellByPosition (5, 0)
oCell.setFormula (sFormula)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -44)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
For nRow = 1 To nNY
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (3, nRow))
sFormula = &quot;=&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellYZMean
oCell = oReportSheet.getCellByPosition (5, nRow)
oCell.setFormula (sFormula)
Next nRow
&apos; Calculates the difference of the Z means to the total mean
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (2, nNRow + 1))
sFormula = &quot;=&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellZMean
oCell = oReportSheet.getCellByPosition (2, nNRow + 2)
oCell.setFormula (sFormula)
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (3, nNRow + 1))
sFormula = &quot;=&quot; &amp; sCell &amp; &quot;-&quot; &amp; sCellZMean
oCell = oReportSheet.getCellByPosition (3, nNRow + 2)
oCell.setFormula (sFormula)
fnCollectIndependentTTestData = oReportSheet.getCellRangeByPosition (0, 0, 5, nNRow + 2)
End Function
&apos; fnGetLeveneTest: Returns the Levene&apos;s test result.
Function fnGetLeveneTest (oZDataRange As Object) As String
Dim nK As Integer, nRows As Integer
Dim oCell As Object, oCells As Object
Dim sCellN As String, sCellsN As String
Dim sCellsDZMean As String, sCellsDZData As String
nRows = oZDataRange.getRows.getCount
nK = oZDataRange.getColumns.getCount / 3
oCell = oZDataRange.getCellByPosition (nK * 2, nRows - 3)
sCellN = fnGetRangeName (oCell)
oCells = oZDataRange.getCellRangeByPosition (0, nRows - 3, nK - 1, nRows - 3)
sCellsN = fnGetRangeName (oCells)
oCells = oZDataRange.getCellRangeByPosition (nK, nRows - 1, nK * 2 - 1, nRows - 1)
sCellsDZMean = fnGetRangeName (oCells)
oCells = oZDataRange.getCellRangeByPosition (nK * 2, 1, nK * 3 - 1, nRows - 4)
sCellsDZData = fnGetRangeName (oCells)
fnGetLeveneTest = &quot;((&quot; &amp; sCellN &amp; &quot;-COUNT(&quot; &amp; sCellsN &amp; &quot;))/(COUNT(&quot; &amp; sCellsN &amp; &quot;)-1))*(SUMPRODUCT(&quot; &amp; sCellsN &amp; &quot;;&quot; &amp; sCellsDZMean &amp; &quot;;&quot; &amp; sCellsDZMean &amp; &quot;)/SUMPRODUCT(&quot; &amp; sCellsDZData &amp; &quot;;&quot; &amp; sCellsDZData &amp; &quot;))&quot;
End Function
</script:module>

1075
oxt/StatTool/4ANOVA.xba Normal file

File diff suppressed because it is too large Load Diff

865
oxt/StatTool/5Chi2GoF.xba Normal file
View File

@ -0,0 +1,865 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="5Chi2GoF" script:language="StarBasic">&apos; Copyright (c) 2016 imacat.
&apos;
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos;
&apos; http://www.apache.org/licenses/LICENSE-2.0
&apos;
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 5Chi2GoF: The macros to for generating the report of Chi-square goodness of fit
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2016-09-05
Option Explicit
&apos; subRunChi2GoodnessOfFit: Runs the chi-square goodness of fit.
Sub subRunChi2GoodnessOfFit As Object
Dim oRange As Object
Dim oSheets As Object, sSheetName As String
Dim oSheet As Object, mRanges As Object
Dim sExisted As String, nResult As Integer
DialogLibraries.loadLibrary &quot;StatTool&quot;
&apos; Asks the user for the data range
oRange = fnAskDataRange (ThisComponent)
If IsNull (oRange) Then
Exit Sub
End If
&apos; Specifies the data
mRanges = fnSpecifyData (oRange, _
&quot;&amp;12.Dlg2SpecData.txtPrompt1.Label5Chi2GoF&quot;, _
&quot;&amp;13.Dlg2SpecData.txtPrompt2.Label5Chi2GoF&quot;)
If IsNull (mRanges) Then
Exit Sub
End If
&apos; Checks the existing report
oSheets = ThisComponent.getSheets
sSheetName = oRange.getSpreadsheet.getName
If oSheets.hasByName (sSheetName &amp; &quot;_chi2&quot;) Then
sExisted = &quot;Spreadsheet &quot;&quot;&quot; &amp; sSheetName &amp; &quot;_chi2&quot;&quot; exists. Overwrite?&quot;
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
If nResult = IDNO Then
Exit Sub
End If
&apos; Drops the existing report
oSheets.removeByname (sSheetName &amp; &quot;_chi2&quot;)
End If
&apos; Reports the chi-square goodness of fit
subReportChi2GoodnessOfFit (ThisComponent, mRanges (0), mRanges (1))
oSheet = oSheets.getByName (sSheetName &amp; &quot;_chi2&quot;)
&apos; Makes the report sheet active.
ThisComponent.getCurrentController.setActiveSheet (oSheet)
End Sub
&apos; subReportChi2GoodnessOfFit: Reports the chi-square goodness of fit
Sub subReportChi2GoodnessOfFit (oDoc As Object, oColumnColumn As Object, oRowColumn As Object)
Dim oSheets As Object, sSheetName As String
Dim nI As Integer, nJ As Integer, nJ1 As Integer, nJ2 As Integer
Dim mNames () As String, nSheetIndex As Integer
Dim oSheet As Object, oColumns As Object, nRow As Integer, nStartRow As Integer
Dim oCell As Object, oCells As Object, oCursor As Object
Dim nN As Integer, sFormula As String
Dim sNotes As String, nPos As Integer
Dim nFormatN As Integer, nFormatF As Integer, nFormatP As Integer, nFormatPct As Integer
Dim aBorderSingle As New com.sun.star.table.BorderLine
Dim aBorderDouble As New com.sun.star.table.BorderLine
Dim sCellsJData As String, sCellsIData As String
Dim sLabel As String, sLabelsColumn As String, sLabelsRow As String
Dim nGroups As Integer, nEvents As Integer
Dim mCellLabelColomn () As String, mCellLabelRow () As String
Dim mCellNJ () As String, mCellNI () As String, mCellPI () As String
Dim mCellFrequency (0, 0) As String, mCellProportion (0, 0) As String
Dim sCellN As String
Dim sCell As String, sCells As String
Dim sCellsRow As String, sCellsColumn As String
Dim sCellChi2 As String, sCellDF As String
Dim sSE2 AS String, nTotalColumns As Integer
oSheets = oDoc.getSheets
sSheetName = oColumnColumn.getSpreadsheet.getName
mNames = oSheets.getElementNames
For nI = 0 To UBound (mNames)
If mNames (nI) = sSheetName Then
nSheetIndex = nI
End If
Next nI
oSheets.insertNewByName (sSheetName &amp; &quot;_chi2&quot;, nSheetIndex + 1)
oSheet = oSheets.getByName (sSheetName &amp; &quot;_chi2&quot;)
sCellsJData = fnGetRangeName (oColumnColumn.getCellRangeByPosition (0, 1, 0, oColumnColumn.getRows.getCount - 1))
sCellsIData = fnGetRangeName (oRowColumn.getCellRangeByPosition (0, 1, 0, oRowColumn.getRows.getCount - 1))
&apos; Counts the number of groups and events
sLabelsColumn = &quot; &quot;
sLabelsRow = &quot; &quot;
nGroups = 0
nEvents = 0
For nRow = 1 To oColumnColumn.getRows.getCount - 1
sLabel = oColumnColumn.getCellByPosition (0, nRow).getString
If InStr (sLabelsColumn, &quot; &quot; &amp; sLabel &amp; &quot; &quot;) = 0 Then
sLabelsColumn = sLabelsColumn &amp; sLabel &amp; &quot; &quot;
nGroups = nGroups + 1
End If
sLabel = oRowColumn.getCellByPosition (0, nRow).getString
If InStr (sLabelsRow, &quot; &quot; &amp; sLabel &amp; &quot; &quot;) = 0 Then
sLabelsRow = sLabelsRow &amp; sLabel &amp; &quot; &quot;
nEvents = nEvents + 1
End If
Next nRow
ReDim mCellLabelColomn (nGroups - 1) As String, mCellLabelRow (nEvents - 1) As String
ReDim mCellNJ (nGroups - 1) As String, mCellNI (nEvents - 1) As String
ReDim mCellPI (nEvents - 1) As String
ReDim mCellFrequency (nGroups - 1, nEvents - 1) As String
ReDim mCellProportion (nGroups - 1, nEvents - 1) As String
&apos; Collects the group and event labels
sLabelsColumn = &quot; &quot;
sLabelsRow = &quot; &quot;
nJ = 0
nI = 0
For nRow = 1 To oColumnColumn.getRows.getCount - 1
oCell = oColumnColumn.getCellByPosition (0, nRow)
sLabel = oCell.getString
If InStr (sLabelsColumn, &quot; &quot; &amp; sLabel &amp; &quot; &quot;) = 0 Then
sLabelsColumn = sLabelsColumn &amp; sLabel &amp; &quot; &quot;
mCellLabelColomn (nJ) = fnGetRangeName (oCell)
nJ = nJ + 1
End If
oCell = oRowColumn.getCellByPosition (0, nRow)
sLabel = oCell.getString
If InStr (sLabelsRow, &quot; &quot; &amp; sLabel &amp; &quot; &quot;) = 0 Then
sLabelsRow = sLabelsRow &amp; sLabel &amp; &quot; &quot;
mCellLabelRow (nI) = fnGetRangeName (oCell)
nI = nI + 1
End If
Next nRow
&apos; Obtains the format parameters for the report.
nFormatN = fnQueryFormat (oDoc, &quot;#,##0&quot;)
nFormatF = fnQueryFormat (oDoc, &quot;#,###.000&quot;)
nFormatP = fnQueryFormat (oDoc, &quot;[&lt;0.01]#.000&quot;&quot;**&quot;&quot;;[&lt;0.05]#.000&quot;&quot;*&quot;&quot;;#.000&quot;)
nFormatPct = fnQueryFormat (oDoc, &quot;0.0%&quot;)
aBorderSingle.OuterLineWidth = 2
aBorderDouble.OuterLineWidth = 2
aBorderDouble.InnerLineWidth = 2
aBorderDouble.LineDistance = 2
&apos; Sets the column widths of the report.
nTotalColumns = nGroups + 2
If nEvents = 2 Then
If nTotalColumns &lt; 5 Then
nTotalColumns = 5
End If
Else
If nTotalColumns &lt; 6 Then
nTotalColumns = 6
End If
End If
oColumns = oSheet.getColumns
For nJ = 0 To nTotalColumns - 1
oColumns.getByIndex (nJ).setPropertyValue (&quot;Width&quot;, 3060)
Next nJ
nRow = -2
&apos; Group description
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Crosstabulation&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, nGroups + 1, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Event&quot;)
For nJ = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (nJ + 1, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelColomn (nJ)
oCell.setFormula (sFormula)
mCellLabelColomn (nJ) = fnGetLocalRangeName (oCell)
Next nJ
oCell = oSheet.getCellByPosition (nGroups + 1, nRow)
oCell.setString (&quot;Total&quot;)
&apos; Shows each event
nRow = nRow - 1
For nI = 0 To nEvents - 1
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelRow (nI)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;VertJustify&quot;, com.sun.star.table.CellVertJustify.TOP)
mCellLabelRow (nI) = fnGetLocalRangeName (oCell)
oCells = oSheet.getCellRangeByPosition (0, nRow, 0, nRow + 1)
oCells.merge (True)
For nJ = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (1 + nJ, nRow)
sFormula = &quot;=COUNTIFS(&quot; &amp; sCellsJData &amp; &quot;;&quot; &amp; mCellLabelColomn (nJ) &amp; &quot;;&quot; &amp; sCellsIData &amp; &quot;;&quot; &amp; mCellLabelRow (nI) &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
mCellFrequency (nJ, nI) = fnGetLocalRangeName (oCell)
Next nJ
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
sFormula = &quot;=SUM(&quot; &amp; sCells &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
mCellNI (nI) = fnGetLocalRangeName (oCell)
Next nI
&apos; Shows the total
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Total&quot;)
oCell.setPropertyValue (&quot;VertJustify&quot;, com.sun.star.table.CellVertJustify.TOP)
oCells = oSheet.getCellRangeByPosition (0, nRow, 0, nRow + 1)
oCells.merge (True)
For nJ = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (1 + nJ, nRow)
sFormula = &quot;&quot;
For nI = 0 To nEvents - 1
sFormula = sFormula &amp; &quot;+&quot; &amp; mCellFrequency (nJ, nI)
Next nI
sFormula = &quot;=&quot; &amp; Right (sFormula, Len (sFormula) - 1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
mCellNJ (nJ) = fnGetLocalRangeName (oCell)
Next nJ
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
sFormula = &quot;&quot;
For nI = 0 To nEvents - 1
sFormula = sFormula &amp; &quot;+&quot; &amp; mCellNI (nI)
Next nI
sFormula = &quot;=&quot; &amp; Right (sFormula, Len (sFormula) - 1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellN = fnGetLocalRangeName (oCell)
&apos; Shows the proportions
nRow = nRow - nEvents * 2 - 1
For nI = 0 To nEvents - 1
nRow = nRow + 2
For nJ = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (1 + nJ, nRow)
sFormula = &quot;=&quot; &amp; mCellFrequency (nJ, nI) &amp; &quot;/&quot; &amp; mCellNJ (nJ)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
mCellProportion (nJ, nI) = fnGetLocalRangeName (oCell)
Next nJ
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
sFormula = &quot;=&quot; &amp; mCellNI (nI) &amp; &quot;/&quot; &amp; sCellN
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
mCellPI (nI) = fnGetLocalRangeName (oCell)
Next nI
&apos; Shows the total
nRow = nRow + 2
For nJ = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (1 + nJ, nRow)
sFormula = &quot;&quot;
For nI = 0 To nEvents - 1
sFormula = sFormula &amp; &quot;+&quot; &amp; mCellProportion (nJ, nI)
Next nI
sFormula = &quot;=&quot; &amp; Right (sFormula, Len (sFormula) - 1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
Next nJ
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
sFormula = &quot;&quot;
For nI = 0 To nEvents - 1
sFormula = sFormula &amp; &quot;+&quot; &amp; mCellPI (nI)
Next nI
sFormula = &quot;=&quot; &amp; Right (sFormula, Len (sFormula) - 1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
oCells = oSheet.getCellRangeByPosition (1, nRow - nEvents * 2 - 1, nGroups, nRow - nEvents * 2 - 1)
sCellsRow = fnGetLocalRangeName (oCells)
oCells = oSheet.getCellRangeByPosition (1, nRow - nEvents * 2 - 1, 1, nRow - 2)
sCellsColumn = fnGetLocalRangeName (oCells)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - nEvents * 2 - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - nEvents * 2 - 2, nGroups + 1, nRow - nEvents * 2 - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (0, nRow - nEvents * 2 - 1, 0, nRow - 2)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, nGroups + 1, nRow - 1)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow, nGroups + 1, nRow)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; The Chi-square test
nRow = nRow + 2
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Chi-Square Test&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Test&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;χ2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, 33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;df&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
&apos; The test result.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Pearsons Chi-Square&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;&quot;
For nI = 0 To nEvents - 1
For nJ = 0 To nGroups - 1
sFormula = sFormula &amp; &quot;+POWER(&quot; &amp; mCellFrequency (nJ, nI) &amp; &quot;;2)/(&quot; &amp; mCellNI (nI) &amp; &quot;*&quot; &amp; mCellNJ (nJ) &amp; &quot;)&quot;
Next nJ
Next nI
sFormula = &quot;=&quot; &amp; sCellN &amp; &quot;*(&quot; &amp; Right (sFormula, Len (sFormula) - 1) &amp; &quot;-1)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
sCellChi2 = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=(COUNT(&quot; &amp; sCellsRow &amp; &quot;)-1)*(COUNT(&quot; &amp; sCellsColumn &amp; &quot;)/2-1)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatN)
sCellDF = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=CHIDIST(&quot; &amp; sCellChi2 &amp; &quot;;&quot; &amp; sCellDF &amp; &quot;)&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: P1=P2=…PN=P (the proportions of the events in each group are the same).&quot; &amp; Chr (10) &amp; _
&quot;H1: The above is false (the proportions of the events in each group are different) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (1, sNotes, &quot;P&quot;, 0)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
If oCursor.getString &lt;&gt; &quot; &quot; Then
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
End If
nPos = InStr (nPos + 1, sNotes, &quot;P&quot;, 0)
Loop
nPos = InStr (sNotes, &quot;PN&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
oCells = oSheet.getCellByPosition (0, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 3, nRow - 2)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 3, nRow - 1)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
&apos; The posteriori comparison
nRow = nRow + 2
If nEvents = 2 Then
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Posteriori Comparison&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;j1&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;j2&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;Pj1-Pj2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -52)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
oCursor.collapseToEnd
oCursor.goRight (1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -52)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;χ2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, 33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
Else
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Posteriori Comparison&quot;)
oCell.setPropertyValue (&quot;CellStyle&quot;, &quot;Result2&quot;)
oCells = oSheet.getCellRangeByPosition (0, nRow, 5, nRow)
oCells.merge (True)
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Event&quot;)
oCell = oSheet.getCellByPosition (1, nRow)
oCell.setString (&quot;j1&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (2, nRow)
oCell.setString (&quot;j2&quot;)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (3, nRow)
oCell.setString (&quot;Pj1-Pj2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -52)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
oCursor.collapseToEnd
oCursor.goRight (1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -52)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
oCell = oSheet.getCellByPosition (4, nRow)
oCell.setString (&quot;χ2&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, 33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCell = oSheet.getCellByPosition (5, nRow)
oCell.setString (&quot;p&quot;)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
oCursor = oCell.createTextCursor
oCursor.gotoStart (False)
oCursor.gotoEnd (True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
End If
&apos; The comparison between groups
nRow = nRow + 1
If nEvents = 2 Then
For nJ1 = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelColomn (nJ1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;VertJustify&quot;, com.sun.star.table.CellVertJustify.TOP)
oCells = oSheet.getCellRangeByPosition (0, nRow, 0, nRow + (nGroups - 1) - 1)
oCells.merge (True)
For nJ2 = 0 To nGroups - 1
If nJ1 &lt;&gt; nJ2 Then
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelColomn (nJ2)
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=&quot; &amp; mCellProportion (nJ1, 0) &amp; &quot;-&quot; &amp; mCellProportion (nJ2, 0)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
sCell = fnGetLocalRangeName (oCell)
sSE2 = &quot;(&quot; &amp; mCellProportion (nJ1, 0) &amp; &quot;*(1-&quot; &amp; mCellProportion (nJ1, 0) &amp; &quot;))/&quot; &amp; mCellNJ (nJ1) &amp; _
&quot;+(&quot; &amp; mCellProportion (nJ2, 0) &amp; &quot;*(1-&quot; &amp; mCellProportion (nJ2, 0) &amp; &quot;))/&quot; &amp; mCellNJ (nJ2)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=IF(&quot; &amp; sSE2 &amp; &quot;=0;&quot;&quot;(N/A)&quot;&quot;;POWER(&quot; &amp; sCell &amp; &quot;;2)/(&quot; &amp; sSE2 &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
sCellChi2 = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=IF(&quot; &amp; sSE2 &amp; &quot;=0;&quot;&quot;(N/A)&quot;&quot;;CHIDIST(&quot; &amp; sCellChi2 &amp; &quot;;&quot; &amp; sCellDF &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
nRow = nRow + 1
End If
Next nJ2
Next nJ1
Else
For nI = 0 To nEvents - 1
oCell = oSheet.getCellByPosition (0, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelRow (nI)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;VertJustify&quot;, com.sun.star.table.CellVertJustify.TOP)
oCells = oSheet.getCellRangeByPosition (0, nRow, 0, nRow + nGroups * (nGroups - 1) - 1)
oCells.merge (True)
For nJ1 = 0 To nGroups - 1
oCell = oSheet.getCellByPosition (1, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelColomn (nJ1)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;VertJustify&quot;, com.sun.star.table.CellVertJustify.TOP)
oCells = oSheet.getCellRangeByPosition (1, nRow, 1, nRow + (nGroups - 1) - 1)
oCells.merge (True)
For nJ2 = 0 To nGroups - 1
If nJ1 &lt;&gt; nJ2 Then
oCell = oSheet.getCellByPosition (2, nRow)
sFormula = &quot;=&quot; &amp; mCellLabelColomn (nJ2)
oCell.setFormula (sFormula)
oCell = oSheet.getCellByPosition (3, nRow)
sFormula = &quot;=&quot; &amp; mCellProportion (nJ1, nI) &amp; &quot;-&quot; &amp; mCellProportion (nJ2, nI)
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatPct)
sCell = fnGetLocalRangeName (oCell)
sSE2 = &quot;(&quot; &amp; mCellProportion (nJ1, nI) &amp; &quot;*(1-&quot; &amp; mCellProportion (nJ1, nI) &amp; &quot;))/&quot; &amp; mCellNJ (nJ1) &amp; _
&quot;+(&quot; &amp; mCellProportion (nJ2, nI) &amp; &quot;*(1-&quot; &amp; mCellProportion (nJ2, nI) &amp; &quot;))/&quot; &amp; mCellNJ (nJ2)
oCell = oSheet.getCellByPosition (4, nRow)
sFormula = &quot;=IF(&quot; &amp; sSE2 &amp; &quot;=0;&quot;&quot;(N/A)&quot;&quot;;POWER(&quot; &amp; sCell &amp; &quot;;2)/(&quot; &amp; sSE2 &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatF)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
sCellChi2 = fnGetLocalRangeName (oCell)
oCell = oSheet.getCellByPosition (5, nRow)
sFormula = &quot;=IF(&quot; &amp; sSE2 &amp; &quot;=0;&quot;&quot;(N/A)&quot;&quot;;CHIDIST(&quot; &amp; sCellChi2 &amp; &quot;;&quot; &amp; sCellDF &amp; &quot;))&quot;
oCell.setFormula (sFormula)
oCell.setPropertyValue (&quot;NumberFormat&quot;, nFormatP)
oCell.setPropertyValue (&quot;ParaAdjust&quot;, com.sun.star.style.ParagraphAdjust.RIGHT)
nRow = nRow + 1
End If
Next nJ2
Next nJ1
Next nI
End If
nRow = nRow - 1
&apos; The foot notes of the test.
nRow = nRow + 1
oCell = oSheet.getCellByPosition (0, nRow)
oCell.setString (&quot;Note: *: p&lt;.05, **: p&lt;.01&quot; &amp; Chr (10) &amp; _
&quot;H0: Pj1=Pj2 (the proportions of the event in the two groups are the same).&quot; &amp; Chr (10) &amp; _
&quot;H1: Pj1≠Pj2 (the proportions of the event in the two groups are different) if the probability (p) is small enough.&quot;)
oCell.setPropertyValue (&quot;IsTextWrapped&quot;, True)
If nEvents = 2 Then
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
Else
oCells = oSheet.getCellRangeByPosition (0, nRow, 5, nRow)
End If
oCells.merge (True)
sNotes = oCell.getString
oCursor = oCell.createTextCursor
nPos = InStr (sNotes, &quot;p&lt;&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (nPos + 1, sNotes, &quot;p&lt;&quot;)
Loop
nPos = InStr (sNotes, &quot;(p)&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
nPos = InStr (sNotes, &quot;Pj&quot;)
Do While nPos &lt;&gt; 0
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -52)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 34)
nPos = InStr (nPos + 1, sNotes, &quot;Pj&quot;)
Loop
nPos = InStr (sNotes, &quot;H0&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
nPos = InStr (sNotes, &quot;H1&quot;)
oCursor.gotoStart (False)
oCursor.goRight (nPos - 1, False)
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharPosture&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureAsian&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.setPropertyValue (&quot;CharPostureComplex&quot;, com.sun.star.awt.FontSlant.ITALIC)
oCursor.collapseToEnd
oCursor.goRight (1, True)
oCursor.setPropertyValue (&quot;CharEscapement&quot;, -33)
oCursor.setPropertyValue (&quot;CharEscapementHeight&quot;, 58)
&apos; Draws the table borders.
If nEvents = 2 Then
nStartRow = nRow - nGroups * (nGroups - 1) - 1
oCells = oSheet.getCellByPosition (0, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (1, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (2, nStartRow, 4, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (1, nStartRow + 1, 1, nRow - 2)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1 - (nGroups - 1) + 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (1, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
Else
nStartRow = nRow - nEvents * nGroups * (nGroups - 1) - 1
oCells = oSheet.getCellRangeByPosition (0, nStartRow, 1, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (2, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (3, nStartRow, 5, nStartRow)
oCells.setPropertyValue (&quot;TopBorder&quot;, aBorderDouble)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderSingle)
oCells = oSheet.getCellRangeByPosition (2, nStartRow + 1, 2, nRow - 2)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells = oSheet.getCellByPosition (0, nRow - 1 - nGroups * (nGroups - 1) + 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (1, nRow - 1 - (nGroups - 1) + 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellByPosition (2, nRow - 1)
oCells.setPropertyValue (&quot;RightBorder&quot;, aBorderSingle)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
oCells = oSheet.getCellRangeByPosition (3, nRow - 1, 5, nRow - 1)
oCells.setPropertyValue (&quot;BottomBorder&quot;, aBorderDouble)
End If
End Sub
</script:module>

225
oxt/StatTool/9Utils.xba Normal file
View File

@ -0,0 +1,225 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
<script:module xmlns:script="http://openoffice.org/2000/script" script:name="9Utils" script:language="StarBasic">&apos; Copyright (c) 2016 imacat.
&apos;
&apos; Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
&apos; you may not use this file except in compliance with the License.
&apos; You may obtain a copy of the License at
&apos;
&apos; http://www.apache.org/licenses/LICENSE-2.0
&apos;
&apos; Unless required by applicable law or agreed to in writing, software
&apos; distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
&apos; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
&apos; See the License for the specific language governing permissions and
&apos; limitations under the License.
&apos; 9Utils: The utility macros.
&apos; by imacat &lt;imacat@mail.imacat.idv.tw&gt;, 2016-08-10
Option Explicit
&apos; fnCheckRangeName: Checks the range name and returns the range when
&apos; found, or null when not found.
Function fnCheckRangeName (oDoc As Object, sRangeName As String) As Object
On Error Goto ErrorHandler
Dim oController As Object, oSheet As Object
Dim nPos As Integer, sSheetName As String, oRange As Object
oController = oDoc.getCurrentController
nPos = InStr (sRangeName, &quot;.&quot;)
If nPos = 0 Then
oSheet = oController.getActiveSheet
Else
sSheetName = Left (sRangeName, nPos - 1)
If Left (sSheetName, 1) = &quot;$&quot; Then
sSheetName = Right (sSheetName, Len (sSheetName) - 1)
End If
oSheet = oDoc.getSheets.getByName (sSheetName)
End If
fnCheckRangeName = oSheet.getCellRangeByName (sRangeName)
ErrorHandler:
End Function
&apos; fnQueryFormat: Returns the index of the number format, and creates
&apos; the number format if required.
Function fnQueryFormat (oDoc As Object, sFormat As String) As Integer
Dim oFormats As Object, nIndex As Integer
Dim aLocale As New com.sun.star.lang.Locale
oFormats = oDoc.getNumberFormats
nIndex = oFormats.queryKey (sFormat, aLocale, True)
If nIndex = -1 Then
oFormats.addNew (sFormat, aLocale)
nIndex = oFormats.queryKey (sFormat, aLocale, True)
End If
fnQueryFormat = nIndex
End Function
&apos; fnGetRangeName: Obtains the name of a spreadsheet cell range
Function fnGetRangeName (oRange As Object) As String
Dim nPos As Integer, sName As String
sName = oRange.getPropertyValue (&quot;AbsoluteName&quot;)
nPos = InStr (sName, &quot;$&quot;)
Do While nPos &lt;&gt; 0
sName = Left (sName, nPos - 1) &amp; Right (sName, Len (sName) - nPos)
nPos = InStr (sName, &quot;$&quot;)
Loop
fnGetRangeName = sName
End Function
&apos; fnGetLocalRangeName: Obtains the name of a local spreadsheet cell range
Function fnGetLocalRangeName (oRange As Object) As String
Dim nPos As Integer, sName As String
sName = fnGetRangeName (oRange)
nPos = InStr (sName, &quot;.&quot;)
If nPos &lt;&gt; 0 Then
sName = Right (sName, Len (sName) - nPos)
End If
fnGetLocalRangeName = sName
End Function
&apos; fnSpecifyData: Specifies the data
Function fnSpecifyData (oRange As Object, sPrompt1 As String, sPrompt2 As String) As Object
Dim mLabels (oRange.getColumns.getCount - 1) As String
Dim nI As Integer, mSelected (0) As Integer
Dim oDialog As Object, oTextModel As Object
Dim oListModel1 As object, oListModel2 As Object
Dim nResult As Integer, nColumn As Integer, mRanges (1) As Object
For nI = 0 To oRange.getColumns.getCount - 1
mLabels (nI) = oRange.getCellByPosition (nI, 0).getString
Next nI
&apos; Runs the dialog
oDialog = CreateUnoDialog (DialogLibraries.StatTool.Dlg2SpecData)
oTextModel = oDialog.getControl (&quot;txtPrompt1&quot;).getModel
oTextModel.setPropertyValue (&quot;Label&quot;, sPrompt1)
oListModel1 = oDialog.getControl (&quot;lstData1&quot;).getModel
oListModel1.setPropertyValue (&quot;StringItemList&quot;, mLabels)
mSelected (0) = 0
oListModel1.setPropertyValue (&quot;SelectedItems&quot;, mSelected)
oTextModel = oDialog.getControl (&quot;txtPrompt2&quot;).getModel
oTextModel.setPropertyValue (&quot;Label&quot;, sPrompt2)
oListModel2 = oDialog.getControl (&quot;lstData2&quot;).getModel
oListModel2.setPropertyValue (&quot;StringItemList&quot;, mLabels)
mSelected (0) = 1
oListModel2.setPropertyValue (&quot;SelectedItems&quot;, mSelected)
nResult = oDialog.execute
oDialog.dispose
&apos; Cancelled
If nResult = 0 Then
Exit Function
End If
nColumn = oListModel1.getPropertyValue (&quot;SelectedItems&quot;) (0)
mRanges (0) = oRange.getCellRangeByPosition ( _
nColumn, 0, nColumn, oRange.getRows.getCount - 1)
nColumn = oListModel2.getPropertyValue (&quot;SelectedItems&quot;) (0)
mRanges (1) = oRange.getCellRangeByPosition ( _
nColumn, 0, nColumn, oRange.getRows.getCount - 1)
fnSpecifyData = mRanges
End Function
&apos; fnAskDataRange: Asks the user for the data range, or null when
&apos; the user cancelled
Function fnAskDataRange (oDoc As Object) As Object
Dim oRange As Object
Dim oDialog As Object, nResult As Integer
Dim oTextModel As Object, oEditModel As Object
Dim sPrompt As String, sCellsData As String
oRange = fnFindActiveDataRange (oDoc)
If IsNull (oRange) Then
sCellsData = &quot;&quot;
Else
sCellsData = oRange.getPropertyValue (&quot;AbsoluteName&quot;)
End If
sPrompt = &quot;&amp;27.Dlg1AskRange.txtPrompt.Label&quot;
&apos; Loop until we finds good data
Do While sPrompt &lt;&gt; &quot;&quot;
&apos; Runs the dialog
oDialog = CreateUnoDialog (DialogLibraries.StatTool.Dlg1AskRange)
oTextModel = oDialog.getControl (&quot;txtPrompt&quot;).getModel
oTextModel.setPropertyValue (&quot;Label&quot;, sPrompt)
oEditModel = oDialog.getControl (&quot;edtCellsData&quot;).getModel
oEditModel.setPropertyValue (&quot;Text&quot;, sCellsData)
nResult = oDialog.execute
oDialog.dispose
&apos; Cancelled
If nResult = 0 Then
Exit Function
End If
sCellsData = oEditModel.getPropertyValue (&quot;Text&quot;)
If sCellsData = &quot;&quot; Then
sPrompt = &quot;&amp;27.Dlg1AskRange.txtPrompt.Label&quot;
Else
oRange = fnCheckRangeName (oDoc, sCellsData)
If IsNull (oRange) Then
sPrompt = &quot;&amp;35.Dlg1AskRange.txtPrompt.LabelNotExists&quot;
Else
If oRange.getRows.getCount &lt; 2 Or oRange.getColumns.getCount &lt; 2 Then
sPrompt = &quot;&amp;36.Dlg1AskRange.txtPrompt.LabelTooSmall&quot;
Else
sPrompt = &quot;&quot;
oDoc.getCurrentController.select (oRange)
fnAskDataRange = oRange
Exit Function
End If
End If
End If
Loop
End Function
&apos; fnFindActiveDataRange: Finds the selected data range.
Function fnFindActiveDataRange (oDoc)
Dim oSelection As Object, nI As Integer
Dim oRanges As Object, oRange As Object
Dim aCellAddress As New com.sun.star.table.CellAddress
Dim aRangeAddress As New com.sun.star.table.CellRangeAddress
oSelection = oDoc.getCurrentSelection
&apos; Some data ranges are already selected.
If Not oSelection.supportsService (&quot;com.sun.star.sheet.SheetCell&quot;) Then
&apos; Takes the first selection in multiple selections
If oSelection.supportsService (&quot;com.sun.star.sheet.SheetCellRanges&quot;) Then
fnFindActiveDataRange = oSelection.getByIndex (0)
&apos; The only selection
Else
fnFindActiveDataRange = oSelection
End If
Exit Function
End If
&apos; Finds the data range containing the single active cell
aCellAddress = oSelection.getCellAddress
oRanges = oSelection.getSpreadsheet.queryContentCells ( _
com.sun.star.sheet.CellFlags.VALUE _
+ com.sun.star.sheet.CellFlags.DATETIME _
+ com.sun.star.sheet.CellFlags.STRING _
+ com.sun.star.sheet.CellFlags.FORMULA)
For nI = 0 To oRanges.getCount - 1
oRange = oRanges.getByIndex (nI)
aRangeAddress = oRange.getRangeAddress
If aRangeAddress.StartRow &lt;= aCellAddress.Row _
And aRangeAddress.EndRow &gt;= aCellAddress.Row _
And aRangeAddress.StartColumn &lt;= aCellAddress.Column _
And aRangeAddress.EndColumn &gt;= aCellAddress.Column Then
oDoc.getCurrentController.select (oRange)
fnFindActiveDataRange = oRange
Exit Function
End If
Next nI
&apos; Not in a data cell range
End Function
</script:module>

View File

View File

@ -0,0 +1,24 @@
# Strings for Dialog Library StatTool
0.Dlg2SpecData.HelpText=
1.Dlg2SpecData.Title=Step 2/2: Specify the data
2.Dlg2SpecData.txtPrompt1.HelpText=
3.Dlg2SpecData.txtPrompt1.Label1CorRel=First scores:
4.Dlg2SpecData.lstData1.HelpText=
5.Dlg2SpecData.txtPrompt2.HelpText=
6.Dlg2SpecData.txtPrompt2.Label1CorRel=Second scores:
7.Dlg2SpecData.lstData2.HelpText=
8.Dlg2SpecData.btnCancel.HelpText=
9.Dlg2SpecData.btnOK.HelpText=
10.Dlg2SpecData.txtPrompt1.Label3ITTest=Groups:
11.Dlg2SpecData.txtPrompt2.Label3ITTest=Scores:
12.Dlg2SpecData.txtPrompt1.Label5Chi2GoF=Groups (column):
13.Dlg2SpecData.txtPrompt2.Label5Chi2GoF=Events (row):
16.Dlg1AskRange.HelpText=
17.Dlg1AskRange.Title=Step 1/2: Select the data range
26.Dlg1AskRange.txtPrompt.HelpText=
27.Dlg1AskRange.txtPrompt.Label="Cells with the data:"
30.Dlg1AskRange.edtCellsData.HelpText=
32.Dlg1AskRange.btnCancel.HelpText=
34.Dlg1AskRange.btnOK.HelpText=
35.Dlg1AskRange.txtPrompt.LabelNotExists=This range does not exist.
36.Dlg1AskRange.txtPrompt.LabelTooSmall=This range is too small. (at least 2\u00d72)

View File

@ -0,0 +1,24 @@
# Strings for Dialog Library StatTool
0.Dlg2SpecData.HelpText=
1.Dlg2SpecData.Title=\u6b65\u9aa4 2/2 \uff1a\u6570\u636e\u6e90\u8bbe\u5b9a
2.Dlg2SpecData.txtPrompt1.HelpText=
3.Dlg2SpecData.txtPrompt1.Label1CorRel=\u7b2c\u4e00\u7ec4\uff1a
4.Dlg2SpecData.lstData1.HelpText=
5.Dlg2SpecData.txtPrompt2.HelpText=
6.Dlg2SpecData.txtPrompt2.Label1CorRel=\u7b2c\u4e8c\u7ec4\uff1a
7.Dlg2SpecData.lstData2.HelpText=
8.Dlg2SpecData.btnCancel.HelpText=
9.Dlg2SpecData.btnOK.HelpText=
10.Dlg2SpecData.txtPrompt1.Label3ITTest=\u5206\u7ec4\uff1a
11.Dlg2SpecData.txtPrompt2.Label3ITTest=\u5206\u6570\uff1a
12.Dlg2SpecData.txtPrompt1.Label5Chi2GoF=\u5206\u7d44\uff08\u76f4\u6b04\uff09\uff1a
13.Dlg2SpecData.txtPrompt2.Label5Chi2GoF=\u4e8b\u4ef6\uff08\u6a6b\u5217\uff09\uff1a
16.Dlg1AskRange.HelpText=
17.Dlg1AskRange.Title=\u6b65\u9aa4 1/2 \uff1a\u8bbe\u5b9a\u6570\u636e\u8303\u56f4
26.Dlg1AskRange.txtPrompt.HelpText=
27.Dlg1AskRange.txtPrompt.Label=\u6570\u636e\u8303\u56f4\uff1a
30.Dlg1AskRange.edtCellsData.HelpText=
32.Dlg1AskRange.btnCancel.HelpText=
34.Dlg1AskRange.btnOK.HelpText=
35.Dlg1AskRange.txtPrompt.LabelNotExists=\u67e5\u65e0\u6b64\u6570\u636e\u8303\u56f4\u3002
36.Dlg1AskRange.txtPrompt.LabelTooSmall=\u6570\u636e\u8303\u56f4\u592a\u5c0f\uff08\u81f3\u5c11\u5e94\u6709 2\u00d72 \uff09\u3002

View File

@ -0,0 +1,24 @@
# Strings for Dialog Library StatTool
0.Dlg2SpecData.HelpText=
1.Dlg2SpecData.Title=\u6b65\u9a5f 2/2 \uff1a\u8a2d\u5b9a\u8cc7\u6599\u4f86\u6e90
2.Dlg2SpecData.txtPrompt1.HelpText=
3.Dlg2SpecData.txtPrompt1.Label1CorRel=\u7b2c\u4e00\u7d44\uff1a
4.Dlg2SpecData.lstData1.HelpText=
5.Dlg2SpecData.txtPrompt2.HelpText=
6.Dlg2SpecData.txtPrompt2.Label1CorRel=\u7b2c\u4e8c\u7d44\uff1a
7.Dlg2SpecData.lstData2.HelpText=
8.Dlg2SpecData.btnCancel.HelpText=
9.Dlg2SpecData.btnOK.HelpText=
10.Dlg2SpecData.txtPrompt1.Label3ITTest=\u5206\u7d44\uff1a
11.Dlg2SpecData.txtPrompt2.Label3ITTest=\u5206\u6578\uff1a
12.Dlg2SpecData.txtPrompt1.Label5Chi2GoF=\u5206\u7d44\uff08\u76f4\u6b04\uff09\uff1a
13.Dlg2SpecData.txtPrompt2.Label5Chi2GoF=\u4e8b\u4ef6\uff08\u6a6b\u5217\uff09\uff1a
16.Dlg1AskRange.HelpText=
17.Dlg1AskRange.Title=\u6b65\u9a5f 1/2 \uff1a\u8a2d\u5b9a\u8cc7\u6599\u7bc4\u570d
26.Dlg1AskRange.txtPrompt.HelpText=
27.Dlg1AskRange.txtPrompt.Label=\u8cc7\u6599\u7bc4\u570d\uff1a
30.Dlg1AskRange.edtCellsData.HelpText=
32.Dlg1AskRange.btnCancel.HelpText=
34.Dlg1AskRange.btnOK.HelpText=
35.Dlg1AskRange.txtPrompt.LabelNotExists=\u67e5\u7121\u6b64\u8cc7\u6599\u7bc4\u570d\u3002
36.Dlg1AskRange.txtPrompt.LabelTooSmall=\u8cc7\u6599\u7bc4\u570d\u592a\u5c0f\uff08\u81f3\u5c11\u61c9\u6709 2\u00d72 \uff09\u3002

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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="Dlg1AskRange" dlg:left="188" dlg:top="92" dlg:width="95" dlg:height="65" dlg:help-text="&amp;16.Dlg1AskRange.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;17.Dlg1AskRange.Title">
<dlg:bulletinboard>
<dlg:text dlg:id="txtPrompt" dlg:tab-index="0" dlg:left="5" dlg:top="5" dlg:width="85" dlg:height="15" dlg:help-text="&amp;26.Dlg1AskRange.txtPrompt.HelpText" dlg:value="&amp;27.Dlg1AskRange.txtPrompt.Label"/>
<dlg:textfield dlg:id="edtCellsData" dlg:tab-index="1" dlg:left="5" dlg:top="25" dlg:width="85" dlg:height="15" dlg:help-text="&amp;30.Dlg1AskRange.edtCellsData.HelpText"/>
<dlg:button dlg:id="btnCancel" dlg:tab-index="2" dlg:left="5" dlg:top="45" dlg:width="40" dlg:height="15" dlg:help-text="&amp;32.Dlg1AskRange.btnCancel.HelpText" dlg:button-type="cancel"/>
<dlg:button dlg:id="btnOK" dlg:tab-index="3" dlg:left="50" dlg:top="45" dlg:width="40" dlg:height="15" dlg:help-text="&amp;34.Dlg1AskRange.btnOK.HelpText" dlg:default="true" dlg:button-type="ok"/>
</dlg:bulletinboard>
</dlg:window>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!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="Dlg2SpecData" dlg:left="188" dlg:top="92" dlg:width="95" dlg:height="80" dlg:help-text="&amp;0.Dlg2SpecData.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&amp;1.Dlg2SpecData.Title">
<dlg:bulletinboard>
<dlg:text dlg:id="txtPrompt1" dlg:tab-index="0" dlg:left="5" dlg:top="5" dlg:width="85" dlg:height="10" dlg:help-text="&amp;2.Dlg2SpecData.txtPrompt1.HelpText" dlg:value="&amp;3.Dlg2SpecData.txtPrompt1.Label1CorRel"/>
<dlg:menulist dlg:id="lstData1" dlg:tab-index="1" dlg:left="5" dlg:top="15" dlg:width="85" dlg:height="10" dlg:help-text="&amp;4.Dlg2SpecData.lstData1.HelpText" dlg:spin="true"/>
<dlg:text dlg:id="txtPrompt2" dlg:tab-index="2" dlg:left="5" dlg:top="30" dlg:width="85" dlg:height="10" dlg:help-text="&amp;5.Dlg2SpecData.txtPrompt2.HelpText" dlg:value="&amp;6.Dlg2SpecData.txtPrompt2.Label1CorRel"/>
<dlg:menulist dlg:id="lstData2" dlg:tab-index="3" dlg:left="5" dlg:top="40" dlg:width="85" dlg:height="10" dlg:help-text="&amp;7.Dlg2SpecData.lstData2.HelpText" dlg:spin="true"/>
<dlg:button dlg:id="btnCancel" dlg:tab-index="4" dlg:left="5" dlg:top="60" dlg:width="40" dlg:height="15" dlg:help-text="&amp;8.Dlg2SpecData.btnCancel.HelpText" dlg:button-type="cancel"/>
<dlg:button dlg:id="btnOK" dlg:tab-index="5" dlg:left="50" dlg:top="60" dlg:width="40" dlg:height="15" dlg:help-text="&amp;9.Dlg2SpecData.btnOK.HelpText" dlg:default="true" dlg:button-type="ok"/>
</dlg:bulletinboard>
</dlg:window>

6
oxt/StatTool/dialog.xlb Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="StatTool" library:readonly="false" library:passwordprotected="false">
<library:element library:name="Dlg2SpecData"/>
<library:element library:name="Dlg1AskRange"/>
</library:library>

10
oxt/StatTool/script.xlb Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd">
<library:library xmlns:library="http://openoffice.org/2000/library" library:name="StatTool" library:readonly="false" library:passwordprotected="false">
<library:element library:name="1CorRel"/>
<library:element library:name="2PTTest"/>
<library:element library:name="3ITTest"/>
<library:element library:name="4ANOVA"/>
<library:element library:name="5Chi2GoF"/>
<library:element library:name="9Utils"/>
</library:library>

26
oxt/description.xml Normal file
View File

@ -0,0 +1,26 @@
<?xml version='1.0' encoding='UTF-8'?>
<description
xmlns="http://openoffice.org/extensions/description/2006"
xmlns:dep="http://openoffice.org/extensions/description/2006"
xmlns:xlink="http://www.w3.org/1999/xlink">
<identifier value="tw.idv.imacat.office.stattool"/>
<version value="@VERSION@"/>
<!-- <dependencies>
<OpenOffice.org-minimal-version value="2.1" dep:name="OpenOffice.org 2.1"/>
</dependencies> -->
<publisher>
<name xlink:href="http://www.imacat.idv.tw/">imacat</name>
<name lang="zh-TW" xlink:href="http://www.imacat.idv.tw/">依瑪貓</name>
<name lang="zh-CN" xlink:href="http://www.imacat.idv.tw/">依玛猫</name>
</publisher>
<registration>
<simple-license accept-by="admin" default-license-id="ID0" suppress-on-update="true" >
<license-text xlink:href="registration/LICENSE" lang="en" license-id="ID0" />
</simple-license>
</registration>
<display-name>
<name>Office Statistics Tools</name>
<name lang="zh-TW">Office 統計工具</name>
<name lang="zh-CN">Office 统计工具</name>
</display-name>
</description>

View File

@ -0,0 +1,4 @@
StatTool - Office Statistics Tools
Copyright (c) 2016 imacat
An additional Calc menu to for statistical tests.

View File

@ -0,0 +1,4 @@
StatTool - Office 统计工具
版权所有 (c) 2016 依玛猫
新增 Calc 试算表统计菜单,计算统计检定。

View File

@ -0,0 +1,4 @@
StatTool - Office 統計工具
版權所有 (c) 2016 依瑪貓
新增 Calc 試算表統計選單,計算統計檢定。

611
oxt/registration/LICENSE Normal file
View File

@ -0,0 +1,611 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
APACHE HTTP SERVER SUBCOMPONENTS:
The Apache HTTP Server includes a number of subcomponents with
separate copyright notices and license terms. Your use of the source
code for the these subcomponents is subject to the terms and
conditions of the following licenses.
For the mod_mime_magic component:
/*
* mod_mime_magic: MIME type lookup via file magic numbers
* Copyright (c) 1996-1997 Cisco Systems, Inc.
*
* This software was submitted by Cisco Systems to the Apache Group in July
* 1997. Future revisions and derivatives of this source code must
* acknowledge Cisco Systems as the original contributor of this module.
* All other licensing and usage conditions are those of the Apache Group.
*
* Some of this code is derived from the free version of the file command
* originally posted to comp.sources.unix. Copyright info for that program
* is included below as required.
* ---------------------------------------------------------------------------
* - Copyright (c) Ian F. Darwin, 1987. Written by Ian F. Darwin.
*
* This software is not subject to any license of the American Telephone and
* Telegraph Company or of the Regents of the University of California.
*
* Permission is granted to anyone to use this software for any purpose on any
* computer system, and to alter it and redistribute it freely, subject to
* the following restrictions:
*
* 1. The author is not responsible for the consequences of use of this
* software, no matter how awful, even if they arise from flaws in it.
*
* 2. The origin of this software must not be misrepresented, either by
* explicit claim or by omission. Since few users ever read sources, credits
* must appear in the documentation.
*
* 3. Altered versions must be plainly marked as such, and must not be
* misrepresented as being the original software. Since few users ever read
* sources, credits must appear in the documentation.
*
* 4. This notice may not be removed or altered.
* -------------------------------------------------------------------------
*
*/
For the modules\mappers\mod_imagemap.c component:
"macmartinized" polygon code copyright 1992 by Eric Haines, erich@eye.com
For the server\util_md5.c component:
/************************************************************************
* NCSA HTTPd Server
* Software Development Group
* National Center for Supercomputing Applications
* University of Illinois at Urbana-Champaign
* 605 E. Springfield, Champaign, IL 61820
* httpd@ncsa.uiuc.edu
*
* Copyright (C) 1995, Board of Trustees of the University of Illinois
*
************************************************************************
*
* md5.c: NCSA HTTPd code which uses the md5c.c RSA Code
*
* Original Code Copyright (C) 1994, Jeff Hostetler, Spyglass, Inc.
* Portions of Content-MD5 code Copyright (C) 1993, 1994 by Carnegie Mellon
* University (see Copyright below).
* Portions of Content-MD5 code Copyright (C) 1991 Bell Communications
* Research, Inc. (Bellcore) (see Copyright below).
* Portions extracted from mpack, John G. Myers - jgm+@cmu.edu
* Content-MD5 Code contributed by Martin Hamilton (martin@net.lut.ac.uk)
*
*/
/* these portions extracted from mpack, John G. Myers - jgm+@cmu.edu */
/* (C) Copyright 1993,1994 by Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
* fee, provided that the above copyright notice appear in all copies
* and that both that copyright notice and this permission notice
* appear in supporting documentation, and that the name of Carnegie
* Mellon University not be used in advertising or publicity
* pertaining to distribution of the software without specific,
* written prior permission. Carnegie Mellon University makes no
* representations about the suitability of this software for any
* purpose. It is provided "as is" without express or implied
* warranty.
*
* CARNEGIE MELLON UNIVERSITY DISCLAIMS ALL WARRANTIES WITH REGARD TO
* THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS, IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY BE LIABLE
* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
* SOFTWARE.
*/
/*
* Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
*
* Permission to use, copy, modify, and distribute this material
* for any purpose and without fee is hereby granted, provided
* that the above copyright notice and this permission notice
* appear in all copies, and that the name of Bellcore not be
* used in advertising or publicity pertaining to this
* material without the specific, prior written permission
* of an authorized representative of Bellcore. BELLCORE
* MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
* OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
* WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
*/
For the srclib\apr\include\apr_md5.h component:
/*
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
For the srclib\apr\passwd\apr_md5.c component:
/*
* This is work is derived from material Copyright RSA Data Security, Inc.
*
* The RSA copyright statement and Licence for that original material is
* included below. This is followed by the Apache copyright statement and
* licence for the modifications made to that material.
*/
/* MD5C.C - RSA Data Security, Inc., MD5 message-digest algorithm
*/
/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
rights reserved.
License to copy and use this software is granted provided that it
is identified as the "RSA Data Security, Inc. MD5 Message-Digest
Algorithm" in all material mentioning or referencing this software
or this function.
License is also granted to make and use derivative works provided
that such works are identified as "derived from the RSA Data
Security, Inc. MD5 Message-Digest Algorithm" in all material
mentioning or referencing the derived work.
RSA Data Security, Inc. makes no representations concerning either
the merchantability of this software or the suitability of this
software for any particular purpose. It is provided "as is"
without express or implied warranty of any kind.
These notices must be retained in any copies of any part of this
documentation and/or software.
*/
/*
* The apr_md5_encode() routine uses much code obtained from the FreeBSD 3.0
* MD5 crypt() function, which is licenced as follows:
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <phk@login.dknet.dk> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*/
For the srclib\apr-util\crypto\apr_md4.c component:
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD4 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\include\apr_md4.h component:
*
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All
* rights reserved.
*
* License to copy and use this software is granted provided that it
* is identified as the "RSA Data Security, Inc. MD4 Message-Digest
* Algorithm" in all material mentioning or referencing this software
* or this function.
*
* License is also granted to make and use derivative works provided
* that such works are identified as "derived from the RSA Data
* Security, Inc. MD4 Message-Digest Algorithm" in all material
* mentioning or referencing the derived work.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\test\testmd4.c component:
*
* This is derived from material copyright RSA Data Security, Inc.
* Their notice is reproduced below in its entirety.
*
* Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All
* rights reserved.
*
* RSA Data Security, Inc. makes no representations concerning either
* the merchantability of this software or the suitability of this
* software for any particular purpose. It is provided "as is"
* without express or implied warranty of any kind.
*
* These notices must be retained in any copies of any part of this
* documentation and/or software.
*/
For the srclib\apr-util\xml\expat\conftools\install-sh component:
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
For the srclib\pcre\install-sh component:
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
For the pcre component:
PCRE LICENCE
------------
PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
Release 5 of PCRE is distributed under the terms of the "BSD" licence, as
specified below. The documentation for PCRE, supplied in the "doc"
directory, is distributed under the same terms as the software itself.
Written by: Philip Hazel <ph10@cam.ac.uk>
University of Cambridge Computing Service,
Cambridge, England. Phone: +44 1223 334714.
Copyright (c) 1997-2004 University of Cambridge
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* 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.
* Neither the name of the University of Cambridge nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS 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 COPYRIGHT OWNER OR 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.
End PCRE LICENCE
For the test\zb.c component:
/* ZeusBench V1.01
===============
This program is Copyright (C) Zeus Technology Limited 1996.
This program may be used and copied freely providing this copyright notice
is not removed.
This software is provided "as is" and any express or implied waranties,
including but not limited to, the implied warranties of merchantability and
fitness for a particular purpose are disclaimed. In no event shall
Zeus Technology Ltd. be liable for any direct, indirect, incidental, special,
exemplary, or consequential damaged (including, but not limited to,
procurement of substitute good or services; loss of use, data, or profits;
or business interruption) however caused and on 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.
Written by Adam Twiss (adam@zeus.co.uk). March 1996
Thanks to the following people for their input:
Mike Belshe (mbelshe@netscape.com)
Michael Campanella (campanella@stevms.enet.dec.com)
*/
For the expat xml parser component:
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
and Clark Cooper
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
====================================================================