Restructured the project directory: Moved the sources into a subdirectory. Added build.xml, LICENSE, VERSION for distribution.
This commit is contained in:
parent
342135d728
commit
b16a28f577
611
LICENSE
Normal file
611
LICENSE
Normal 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.
|
||||
|
||||
====================================================================
|
62
build.xml
Normal file
62
build.xml
Normal 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
103
oxt/Addons.xcu
Normal 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&location=application</value>
|
||||
</prop>
|
||||
<prop oor:name="Title" oor:type="xs:string">
|
||||
<value>Pearson’s 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&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&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&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&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>
|
8
oxt/META-INF/manifest.xml
Normal file
8
oxt/META-INF/manifest.xml
Normal 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
334
oxt/StatTool/1CorRel.xba
Normal 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">' Copyright (c) 2016 imacat.
|
||||
'
|
||||
' 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.
|
||||
|
||||
' 1CorRel: The macros to for generating the report of the Pearson’s correlation coefficient
|
||||
' by imacat <imacat@mail.imacat.idv.tw>, 2016-08-10
|
||||
|
||||
Option Explicit
|
||||
|
||||
' subRunCorrelation: Runs the Pearson’s 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 "StatTool"
|
||||
|
||||
' Asks the user for the data range
|
||||
oRange = fnAskDataRange (ThisComponent)
|
||||
If IsNull (oRange) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Specifies the data
|
||||
mRanges = fnSpecifyData (oRange, _
|
||||
"&3.Dlg2SpecData.txtPrompt1.Label1CorRel", _
|
||||
"&6.Dlg2SpecData.txtPrompt2.Label1CorRel")
|
||||
If IsNull (mRanges) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Checks the existing report
|
||||
oSheets = ThisComponent.getSheets
|
||||
sSheetName = oRange.getSpreadsheet.getName
|
||||
If oSheets.hasByName (sSheetName & "_correl") Then
|
||||
sExisted = "Spreadsheet """ & sSheetName & "_correl"" exists. Overwrite?"
|
||||
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
|
||||
If nResult = IDNO Then
|
||||
Exit Sub
|
||||
End If
|
||||
' Drops the existing report
|
||||
oSheets.removeByname (sSheetName & "_correl")
|
||||
End If
|
||||
|
||||
' Reports the paired T-test.
|
||||
subReportCorrelation (ThisComponent, mRanges (0), mRanges (1))
|
||||
oSheet = oSheets.getByName (sSheetName & "_correl")
|
||||
|
||||
' Adds an X-Y diagram.
|
||||
subAddChart (oSheet, mRanges (0), mRanges (1))
|
||||
|
||||
' Makes the report sheet active.
|
||||
ThisComponent.getCurrentController.setActiveSheet (oSheet)
|
||||
End Sub
|
||||
|
||||
' 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
|
||||
|
||||
' 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 "XrayTool"
|
||||
oDiagram = oChartDoc.createInstance ( _
|
||||
"com.sun.star.chart.XYDiagram")
|
||||
oDiagram.setPropertyValue ("Lines", False)
|
||||
oDiagram.setPropertyValue ("HasXAxisGrid", False)
|
||||
oDiagram.setPropertyValue ("HasYAxisGrid", False)
|
||||
sTitle = oDataXRange.getCellByPosition (0, 0).getString
|
||||
oDiagram.getXAxisTitle.setPropertyValue ("String", sTitle)
|
||||
sTitle = oDataYRange.getCellByPosition (0, 0).getString
|
||||
oDiagram.getYAxisTitle.setPropertyValue ("String", sTitle)
|
||||
oDiagram.getXAxis.setPropertyValue ("Min", 0)
|
||||
oDiagram.getYAxis.setPropertyValue ("Min", 0)
|
||||
oChartDoc.setDiagram (oDiagram)
|
||||
|
||||
oProvider = oChartDoc.getDataProvider
|
||||
mData = oChartDoc.getDataSequences
|
||||
sRange = oDataXRange.getCellByPosition(0, 0).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
mData (0).setLabel (oData)
|
||||
sRange = oDataXRange.getCellRangeByPosition(0, 1, 0, oDataXRange.getRows.getCount - 1).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
oData.Role = "values-x"
|
||||
mData (0).setValues (oData)
|
||||
sRange = oDataYRange.getCellByPosition(0, 0).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
mData (1).setLabel (oData)
|
||||
sRange = oDataYRange.getCellRangeByPosition(0, 1, 0, oDataYRange.getRows.getCount - 1).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
oData.Role = "values-y"
|
||||
mData (1).setValues (oData)
|
||||
|
||||
oChartDoc.setPropertyValue ("HasLegend", False)
|
||||
End Sub
|
||||
|
||||
' subReportCorrelation: Reports the Pearson’s 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 & "_correl", nSheetIndex + 1)
|
||||
oSheet = oSheets.getByName (sSheetName & "_correl")
|
||||
|
||||
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))
|
||||
|
||||
' Obtains the format parameters for the report.
|
||||
nFormatN = fnQueryFormat (oDoc, "#,##0")
|
||||
nFormatF = fnQueryFormat (oDoc, "#,###.000")
|
||||
nFormatP = fnQueryFormat (oDoc, "[<0.01]#.000""**"";[<0.05]#.000""*"";#.000")
|
||||
|
||||
aBorderSingle.OuterLineWidth = 2
|
||||
aBorderDouble.OuterLineWidth = 2
|
||||
aBorderDouble.InnerLineWidth = 2
|
||||
aBorderDouble.LineDistance = 2
|
||||
|
||||
' Sets the column widths of the report.
|
||||
oColumns = oSheet.getColumns
|
||||
oColumns.getByIndex (0).setPropertyValue ("Width", 3060)
|
||||
oColumns.getByIndex (1).setPropertyValue ("Width", 3060)
|
||||
oColumns.getByIndex (2).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (3).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (4).setPropertyValue ("Width", 2080)
|
||||
|
||||
nRow = -2
|
||||
|
||||
' Correlation
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Pearson’s Correlation")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("X")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("Y")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("N")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("r")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
|
||||
' The test result.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=COUNT(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellN = fnGetLocalRangeName (oCell)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=CORREL(" & sCellsXData & ";" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellR = fnGetLocalRangeName (oCell)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=TDIST(" & sCellR & "*SQRT((" & sCellN & "-2)/(1-" & sCellR & "*" & sCellR & "))" & ";" & sCellN & "-2;2)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: ρ=0 (the populations of the two groups are irrelavent)." & Chr (10) & _
|
||||
"H1: ρ≠0 (the populations of the two groups are relevant) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "ρ")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "ρ")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 4, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
End Sub
|
||||
</script:module>
|
648
oxt/StatTool/2PTTest.xba
Normal file
648
oxt/StatTool/2PTTest.xba
Normal 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">' Copyright (c) 2016 imacat.
|
||||
'
|
||||
' 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.
|
||||
|
||||
' 2PTTest: The macros to for generating the report of paired T-Test
|
||||
' by imacat <imacat@mail.imacat.idv.tw>, 2016-08-11
|
||||
|
||||
Option Explicit
|
||||
|
||||
' 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 "StatTool"
|
||||
|
||||
' Asks the user for the data range
|
||||
oRange = fnAskDataRange (ThisComponent)
|
||||
If IsNull (oRange) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Specifies the data
|
||||
mRanges = fnSpecifyData (oRange, _
|
||||
"&3.Dlg2SpecData.txtPrompt1.Label1CorRel", _
|
||||
"&6.Dlg2SpecData.txtPrompt2.Label1CorRel")
|
||||
If IsNull (mRanges) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Checks the existing report
|
||||
oSheets = ThisComponent.getSheets
|
||||
sSheetName = oRange.getSpreadsheet.getName
|
||||
If oSheets.hasByName (sSheetName & "_ttest") Then
|
||||
sExisted = "Spreadsheet """ & sSheetName & "_ttest"" exists. Overwrite?"
|
||||
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
|
||||
If nResult = IDNO Then
|
||||
Exit Sub
|
||||
End If
|
||||
' Drops the existing report
|
||||
oSheets.removeByname (sSheetName & "_ttest")
|
||||
End If
|
||||
|
||||
' Reports the paired T-test.
|
||||
subReportPairedTTest (ThisComponent, mRanges (0), mRanges (1))
|
||||
oSheet = oSheets.getByName (sSheetName & "_ttest")
|
||||
|
||||
' Adds an X-Y diagram.
|
||||
subAddChart (oSheet, mRanges (0), mRanges (1))
|
||||
|
||||
' Makes the report sheet active.
|
||||
ThisComponent.getCurrentController.setActiveSheet (oSheet)
|
||||
End Sub
|
||||
|
||||
' 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
|
||||
|
||||
' 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 "XrayTool"
|
||||
oDiagram = oChartDoc.createInstance ( _
|
||||
"com.sun.star.chart.XYDiagram")
|
||||
oDiagram.setPropertyValue ("Lines", False)
|
||||
oDiagram.setPropertyValue ("HasXAxisGrid", False)
|
||||
oDiagram.setPropertyValue ("HasYAxisGrid", False)
|
||||
sTitle = oDataXRange.getCellByPosition (0, 0).getString
|
||||
oDiagram.getXAxisTitle.setPropertyValue ("String", sTitle)
|
||||
sTitle = oDataYRange.getCellByPosition (0, 0).getString
|
||||
oDiagram.getYAxisTitle.setPropertyValue ("String", sTitle)
|
||||
oDiagram.getXAxis.setPropertyValue ("Min", 0)
|
||||
oDiagram.getYAxis.setPropertyValue ("Min", 0)
|
||||
oChartDoc.setDiagram (oDiagram)
|
||||
|
||||
oProvider = oChartDoc.getDataProvider
|
||||
mData = oChartDoc.getDataSequences
|
||||
sRange = oDataXRange.getCellByPosition(0, 0).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
mData (0).setLabel (oData)
|
||||
sRange = oDataXRange.getCellRangeByPosition(0, 1, 0, oDataXRange.getRows.getCount - 1).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
oData.Role = "values-x"
|
||||
mData (0).setValues (oData)
|
||||
sRange = oDataYRange.getCellByPosition(0, 0).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
mData (1).setLabel (oData)
|
||||
sRange = oDataYRange.getCellRangeByPosition(0, 1, 0, oDataYRange.getRows.getCount - 1).getPropertyValue ("AbsoluteName")
|
||||
oData = oProvider.createDataSequenceByRangeRepresentation (sRange)
|
||||
oData.Role = "values-y"
|
||||
mData (1).setValues (oData)
|
||||
|
||||
oChartDoc.setPropertyValue ("HasLegend", False)
|
||||
End Sub
|
||||
|
||||
' 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 & "_ttest", nSheetIndex + 1)
|
||||
oSheet = oSheets.getByName (sSheetName & "_ttest")
|
||||
|
||||
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))
|
||||
|
||||
' Obtains the format parameters for the report.
|
||||
nFormatN = fnQueryFormat (oDoc, "#,##0")
|
||||
nFormatF = fnQueryFormat (oDoc, "#,###.000")
|
||||
nFormatP = fnQueryFormat (oDoc, "[<0.01]#.000""**"";[<0.05]#.000""*"";#.000")
|
||||
|
||||
aBorderSingle.OuterLineWidth = 2
|
||||
aBorderDouble.OuterLineWidth = 2
|
||||
aBorderDouble.InnerLineWidth = 2
|
||||
aBorderDouble.LineDistance = 2
|
||||
|
||||
' Sets the column widths of the report.
|
||||
oColumns = oSheet.getColumns
|
||||
oColumns.getByIndex (0).setPropertyValue ("Width", 3060)
|
||||
oColumns.getByIndex (1).setPropertyValue ("Width", 3060)
|
||||
oColumns.getByIndex (2).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (3).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (4).setPropertyValue ("Width", 2080)
|
||||
|
||||
nRow = -2
|
||||
' Group description
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Sample Description")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 5, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Sample")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
|
||||
oCells.merge (True)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("N")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("X")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("s")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
oCell.setString ("sX")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
|
||||
' The first group
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
|
||||
oCells.merge (True)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=COUNT(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellXN = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=AVERAGE(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellXMean = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=STDEV(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellXS = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
sFormula = "=" & sCellXS & "/SQRT(" & sCellXN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' The second group
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
|
||||
oCells.merge (True)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=COUNT(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellYN = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=AVERAGE(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellYMean = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=STDEV(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellYS = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
sFormula = "=" & sCellYS & "/SQRT(" & sCellYN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' The difference between the two groups
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=""(""&" & sCellXLabel & "&""-""&" & sCellYLabel & "&"")"""
|
||||
oCell.setFormula (sFormula)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 1, nRow)
|
||||
oCells.merge (True)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=" & sCellXN
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellN = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=" & sCellXMean & "-" & sCellYMean
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=SQRT(" & sCellXS & "*" & sCellXS & "-2*SUMPRODUCT(" & sCellsXData & ";" & sCellsYData & ")/(" & sCellN & "-1)+2*" & sCellXMean & "*" & sCellYMean & "*" & sCellN & "/(" & sCellN & "-1)+" & sCellYS & "*" & sCellYS & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellXYS = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
sFormula = "=" & sCellXYS & "/SQRT(" & sCellN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 3)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 3, 5, nRow - 3)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow - 2, 0, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow, 5, nRow)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' Correlation
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Pearson’s Correlation")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("X1")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("X2")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("r")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
|
||||
' The test result.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=CORREL(" & sCellsXData & ";" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellR = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=TDIST(ABS(" & sCellR & ")*SQRT((" & sCellN & "-2)/(1-" & sCellR & "*" & sCellR & "))" & ";" & sCellN & "-2;2)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: ρ=0 (the populations of the two samples are irrelavent)." & Chr (10) & _
|
||||
"H1: ρ≠0 (the populations of the two samples are relevant) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "ρ")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 3, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 3, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' Paired-samples T-test
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Paired-Samples T-test")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("X1")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("X2")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("t")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("df")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
|
||||
' The test result.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=(" & sCellXMean & "-" & sCellYMean & ")/SQRT((" & sCellXS & "*" & sCellXS & "+" & sCellYS & "*" & sCellYS & "-2*" & sCellR & "*" & sCellXS & "*" & sCellYS & ")/" & sCellN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=" & sCellN & "-1"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=TTEST(" & sCellsXData & ";" & sCellsYData & ";2;1)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: μ1=μ2 (the populations of the two samples have the same means)." & Chr (10) & _
|
||||
"H1: μ1≠μ2 (the populations of the two samples have different means) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "μ")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (nPos + 1, sNotes, "μ")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 2, 4, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
End Sub
|
||||
</script:module>
|
811
oxt/StatTool/3ITTest.xba
Normal file
811
oxt/StatTool/3ITTest.xba
Normal 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">' Copyright (c) 2016 imacat.
|
||||
'
|
||||
' 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.
|
||||
|
||||
' 3ITTest: The macros to for generating the report of independent T-Test
|
||||
' by imacat <imacat@mail.imacat.idv.tw>, 2016-08-24
|
||||
|
||||
Option Explicit
|
||||
|
||||
' 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 "StatTool"
|
||||
|
||||
' Asks the user for the data range
|
||||
oRange = fnAskDataRange (ThisComponent)
|
||||
If IsNull (oRange) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Specifies the data
|
||||
mRanges = fnSpecifyData (oRange, _
|
||||
"&10.Dlg2SpecData.txtPrompt1.Label3ITTest", _
|
||||
"&11.Dlg2SpecData.txtPrompt2.Label3ITTest")
|
||||
If IsNull (mRanges) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Checks the existing report
|
||||
oSheets = ThisComponent.getSheets
|
||||
sSheetName = oRange.getSpreadsheet.getName
|
||||
sExisted = ""
|
||||
If oSheets.hasByName (sSheetName & "_ttest") Then
|
||||
sExisted = sExisted & ", """ & sSheetName & "_ttest"""
|
||||
End If
|
||||
If oSheets.hasByName (sSheetName & "_ttesttmp") Then
|
||||
sExisted = sExisted & ", """ & sSheetName & "_ttesttmp"""
|
||||
End If
|
||||
If sExisted <> "" Then
|
||||
sExisted = Right (sExisted, Len (sExisted) - 2)
|
||||
If InStr (sExisted, ",") > 0 Then
|
||||
sExisted = "Spreadsheets " & sExisted & " exist. Overwrite?"
|
||||
Else
|
||||
sExisted = "Spreadsheet " & sExisted & " exists. Overwrite?"
|
||||
End If
|
||||
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
|
||||
If nResult = IDNO Then
|
||||
Exit Sub
|
||||
End If
|
||||
' Drops the existing report
|
||||
If oSheets.hasByName (sSheetName & "_ttest") Then
|
||||
oSheets.removeByname (sSheetName & "_ttest")
|
||||
End If
|
||||
If oSheets.hasByName (sSheetName & "_ttesttmp") Then
|
||||
oSheets.removeByname (sSheetName & "_ttesttmp")
|
||||
End If
|
||||
End If
|
||||
|
||||
' Reports the independent T-test.
|
||||
subReportIndependentTTest (ThisComponent, mRanges (0), mRanges (1))
|
||||
oSheet = oSheets.getByName (sSheetName & "_ttest")
|
||||
|
||||
' Makes the report sheet active.
|
||||
ThisComponent.getCurrentController.setActiveSheet (oSheet)
|
||||
End Sub
|
||||
|
||||
' 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 & "_ttesttmp", nSheetIndex + 1)
|
||||
oSheet = oSheets.getByName (sSheetName & "_ttesttmp")
|
||||
oTempDataRange = fnCollectIndependentTTestData (oSheet, oLabelColumn, oScoreColumn)
|
||||
|
||||
oSheets.insertNewByName (sSheetName & "_ttest", nSheetIndex + 1)
|
||||
oSheet = oSheets.getByName (sSheetName & "_ttest")
|
||||
|
||||
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)
|
||||
|
||||
' Obtains the format parameters for the report.
|
||||
nFormatN = fnQueryFormat (oDoc, "#,##0")
|
||||
nFormatF = fnQueryFormat (oDoc, "#,###.000")
|
||||
nFormatP = fnQueryFormat (oDoc, "[<0.01]#.000""**"";[<0.05]#.000""*"";#.000")
|
||||
|
||||
aBorderSingle.OuterLineWidth = 2
|
||||
aBorderDouble.OuterLineWidth = 2
|
||||
aBorderDouble.InnerLineWidth = 2
|
||||
aBorderDouble.LineDistance = 2
|
||||
|
||||
' Sets the column widths of the report.
|
||||
oColumns = oSheet.getColumns
|
||||
oColumns.getByIndex (0).setPropertyValue ("Width", 3060)
|
||||
oColumns.getByIndex (1).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (2).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (3).setPropertyValue ("Width", 2080)
|
||||
oColumns.getByIndex (4).setPropertyValue ("Width", 2080)
|
||||
|
||||
nRow = -2
|
||||
|
||||
' Group description
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Group Description")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Group")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("N")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("X")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("s")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("sX")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
|
||||
' The first group
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=COUNT(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellXN = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=AVERAGE(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellXMean = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=STDEV(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellXS = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=" & sCellXS & "/SQRT(" & sCellXN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' The second group
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=COUNT(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellYN = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=AVERAGE(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellYMean = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=STDEV(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellYS = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=" & sCellYS & "/SQRT(" & sCellYN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 4, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow, 4, nRow)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' Levene's test for homogeneity of variances
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Test for Homogeneity of Variances")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Test")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("F")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
|
||||
' The test result.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Levene’s Test")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=" & fnGetLeveneTest (oTempDataRange)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", 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 = "=FDIST(" & sCellF & ";COUNT(" & sCellsN & ")-1;" & sCellN & "-COUNT(" & sCellsN & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: σ1=σ2 (homogeneity; the populations of the two groups have the same variances)." & Chr (10) & _
|
||||
"H1: σ1≠σ2 (heterogeneity; the populations of the two groups have different variances) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "σ")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (nPos + 1, sNotes, "σ")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 2, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 2, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' The independent samples T-test
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Independent Samples T-Test")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Type")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("t")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("df")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("X1-X2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharOverline", com.sun.star.awt.FontUnderline.SINGLE)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' The test of the homogeneity of variances.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Homogeneity")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sSP2 = "((SUMPRODUCT(" & sCellsXData & ";" & sCellsXData & ")-POWER(SUM(" & sCellsXData & ");2)/" & sCellXN & "+SUMPRODUCT(" & sCellsYData & ";" & sCellsYData & ")-POWER(SUM(" & sCellsYData & ");2)/" & sCellYN & ")/(" & sCellXN & "+" & sCellYN & "-2))"
|
||||
sFormula = "=(" & sCellXMean & "-" & sCellYMean & ")/SQRT(" & sSP2 & "*(1/" & sCellXN & "+1/" & sCellYN & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=" & sCellXN & "+" & sCellYN & "-2"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=TTEST(" & sCellsXData & ";" & sCellsYData & ";2;2)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=" & sCellXMean & "-" & sCellYMean
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' The test of the heterogeneity of variances.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Heterogeneity")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=(" & sCellXMean & "-" & sCellYMean & ")/SQRT(POWER(" & sCellXS & ";2)/" & sCellXN & "+POWER(" & sCellYS & ";2)/" & sCellYN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=POWER(POWER(" & sCellXS & ";2)/" & sCellXN & "+POWER(" & sCellYS & ";2)/" & sCellYN & ";2)/(POWER(" & sCellXS & ";4)/(POWER(" & sCellXN & ";2)*(" & sCellXN & "-1))+POWER(" & sCellYS & ";4)/(POWER(" & sCellYN & ";2)*(" & sCellYN & "-1)))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=TTEST(" & sCellsXData & ";" & sCellsYData & ";2;3)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=" & sCellXMean & "-" & sCellYMean
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: μ1=μ2 (the populations of the two groups have the same means)." & Chr (10) & _
|
||||
"H1: μ1≠μ2 (the populations of the two groups have different means) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "μ")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (nPos + 1, sNotes, "μ")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 3)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 3, 4, nRow - 3)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 4, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
End Sub
|
||||
|
||||
' 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 = ""
|
||||
sCellYLabel = ""
|
||||
For nRow = 1 To oLabelColumn.getRows.getCount - 1
|
||||
oCell = oLabelColumn.getCellByPosition (0, nRow)
|
||||
sLabel = oCell.getString
|
||||
If sLabel <> "" Then
|
||||
If sCellXLabel = "" Then
|
||||
sCellXLabel = fnGetRangeName (oCell)
|
||||
sXLabel = sLabel
|
||||
Else
|
||||
If sLabel <> sXLabel And sCellYLabel = "" Then
|
||||
sCellYLabel = fnGetRangeName (oCell)
|
||||
sYLabel = sLabel
|
||||
nRow = oLabelColumn.getRows.getCount - 1
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next nRow
|
||||
|
||||
' The data labels
|
||||
oCell = oReportSheet.getCellByPosition (0, 0)
|
||||
sFormula = "=" & sCellXLabel
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oReportSheet.getCellByPosition (1, 0)
|
||||
sFormula = "=" & sCellYLabel
|
||||
oCell.setFormula (sFormula)
|
||||
|
||||
' 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 = "=" & fnGetRangeName (oScoreColumn.getCellByPosition (0, nRow))
|
||||
oReportSheet.getCellByPosition (0, nNX).setFormula (sFormula)
|
||||
Else
|
||||
If oLabelColumn.getCellByPosition (0, nRow).getString = sYLabel Then
|
||||
nNY = nNY + 1
|
||||
sFormula = "=" & fnGetRangeName (oScoreColumn.getCellByPosition (0, nRow))
|
||||
oReportSheet.getCellByPosition (1, nNY).setFormula (sFormula)
|
||||
End If
|
||||
End If
|
||||
Next nRow
|
||||
|
||||
' Collects the data
|
||||
sCellsXData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (0, 1, 0, nNX))
|
||||
sCellsYData = fnGetLocalRangeName (oReportSheet.getCellRangeByPosition (1, 1, 1, nNY))
|
||||
If nNX > nNY Then
|
||||
nNRow = nNX + 1
|
||||
Else
|
||||
nNRow = nNY + 1
|
||||
End If
|
||||
oCell = oReportSheet.getCellByPosition (0, nNRow)
|
||||
sFormula = "=COUNT(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oReportSheet.getCellByPosition (1, nNRow)
|
||||
sFormula = "=COUNT(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oReportSheet.getCellByPosition (0, nNRow + 1)
|
||||
sFormula = "=AVERAGE(" & sCellsXData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellXMean = fnGetLocalRangeName (oCell)
|
||||
oCell = oReportSheet.getCellByPosition (1, nNRow + 1)
|
||||
sFormula = "=AVERAGE(" & sCellsYData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellYMean = fnGetLocalRangeName (oCell)
|
||||
oCells = oReportSheet.getCellRangeByPosition (0, nNRow, 1, nNRow)
|
||||
sCellsN = fnGetLocalRangeName (oCells)
|
||||
|
||||
' Calculates the Z values
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, 0))
|
||||
sFormula = "=""Z""&" & sCell
|
||||
oCell = oReportSheet.getCellByPosition (2, 0)
|
||||
oCell.setFormula (sFormula)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
For nRow = 1 To nNX
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, nRow))
|
||||
sFormula = "=ABS(" & sCell & "-" & sCellXMean & ")"
|
||||
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 = "=AVERAGE(" & sCellsXZData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellXZMean = fnGetLocalRangeName (oCell)
|
||||
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, 0))
|
||||
sFormula = "=""Z""&" & sCell
|
||||
oCell = oReportSheet.getCellByPosition (3, 0)
|
||||
oCell.setFormula (sFormula)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
For nRow = 1 To nNY
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, nRow))
|
||||
sFormula = "=ABS(" & sCell & "-" & sCellYMean & ")"
|
||||
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 = "=AVERAGE(" & sCellsYZData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellYZMean = fnGetLocalRangeName (oCell)
|
||||
|
||||
' Calculates the total average
|
||||
oCell = oReportSheet.getCellByPosition (4, nNRow)
|
||||
sFormula = "=SUM(" & sCellsN & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oReportSheet.getCellByPosition (4, nNRow + 1)
|
||||
sFormula = "=AVERAGE(" & sCellsXZData & ";" & sCellsYZData & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
sCellZMean = fnGetLocalRangeName (oCell)
|
||||
|
||||
' Calculates the difference of the Z values to their means
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (0, 0))
|
||||
sFormula = "=""dZ""&" & sCell
|
||||
oCell = oReportSheet.getCellByPosition (4, 0)
|
||||
oCell.setFormula (sFormula)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -44)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
For nRow = 1 To nNX
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (2, nRow))
|
||||
sFormula = "=" & sCell & "-" & sCellXZMean
|
||||
oCell = oReportSheet.getCellByPosition (4, nRow)
|
||||
oCell.setFormula (sFormula)
|
||||
Next nRow
|
||||
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (1, 0))
|
||||
sFormula = "=""dZ""&" & sCell
|
||||
oCell = oReportSheet.getCellByPosition (5, 0)
|
||||
oCell.setFormula (sFormula)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -44)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
For nRow = 1 To nNY
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (3, nRow))
|
||||
sFormula = "=" & sCell & "-" & sCellYZMean
|
||||
oCell = oReportSheet.getCellByPosition (5, nRow)
|
||||
oCell.setFormula (sFormula)
|
||||
Next nRow
|
||||
|
||||
' Calculates the difference of the Z means to the total mean
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (2, nNRow + 1))
|
||||
sFormula = "=" & sCell & "-" & sCellZMean
|
||||
oCell = oReportSheet.getCellByPosition (2, nNRow + 2)
|
||||
oCell.setFormula (sFormula)
|
||||
sCell = fnGetLocalRangeName (oReportSheet.getCellByPosition (3, nNRow + 1))
|
||||
sFormula = "=" & sCell & "-" & sCellZMean
|
||||
oCell = oReportSheet.getCellByPosition (3, nNRow + 2)
|
||||
oCell.setFormula (sFormula)
|
||||
|
||||
fnCollectIndependentTTestData = oReportSheet.getCellRangeByPosition (0, 0, 5, nNRow + 2)
|
||||
End Function
|
||||
|
||||
' fnGetLeveneTest: Returns the Levene'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 = "((" & sCellN & "-COUNT(" & sCellsN & "))/(COUNT(" & sCellsN & ")-1))*(SUMPRODUCT(" & sCellsN & ";" & sCellsDZMean & ";" & sCellsDZMean & ")/SUMPRODUCT(" & sCellsDZData & ";" & sCellsDZData & "))"
|
||||
End Function
|
||||
</script:module>
|
1075
oxt/StatTool/4ANOVA.xba
Normal file
1075
oxt/StatTool/4ANOVA.xba
Normal file
File diff suppressed because it is too large
Load Diff
865
oxt/StatTool/5Chi2GoF.xba
Normal file
865
oxt/StatTool/5Chi2GoF.xba
Normal 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">' Copyright (c) 2016 imacat.
|
||||
'
|
||||
' 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.
|
||||
|
||||
' 5Chi2GoF: The macros to for generating the report of Chi-square goodness of fit
|
||||
' by imacat <imacat@mail.imacat.idv.tw>, 2016-09-05
|
||||
|
||||
Option Explicit
|
||||
|
||||
' 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 "StatTool"
|
||||
|
||||
' Asks the user for the data range
|
||||
oRange = fnAskDataRange (ThisComponent)
|
||||
If IsNull (oRange) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Specifies the data
|
||||
mRanges = fnSpecifyData (oRange, _
|
||||
"&12.Dlg2SpecData.txtPrompt1.Label5Chi2GoF", _
|
||||
"&13.Dlg2SpecData.txtPrompt2.Label5Chi2GoF")
|
||||
If IsNull (mRanges) Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' Checks the existing report
|
||||
oSheets = ThisComponent.getSheets
|
||||
sSheetName = oRange.getSpreadsheet.getName
|
||||
If oSheets.hasByName (sSheetName & "_chi2") Then
|
||||
sExisted = "Spreadsheet """ & sSheetName & "_chi2"" exists. Overwrite?"
|
||||
nResult = MsgBox (sExisted, MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)
|
||||
If nResult = IDNO Then
|
||||
Exit Sub
|
||||
End If
|
||||
' Drops the existing report
|
||||
oSheets.removeByname (sSheetName & "_chi2")
|
||||
End If
|
||||
|
||||
' Reports the chi-square goodness of fit
|
||||
subReportChi2GoodnessOfFit (ThisComponent, mRanges (0), mRanges (1))
|
||||
oSheet = oSheets.getByName (sSheetName & "_chi2")
|
||||
|
||||
' Makes the report sheet active.
|
||||
ThisComponent.getCurrentController.setActiveSheet (oSheet)
|
||||
End Sub
|
||||
|
||||
' 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 & "_chi2", nSheetIndex + 1)
|
||||
oSheet = oSheets.getByName (sSheetName & "_chi2")
|
||||
|
||||
sCellsJData = fnGetRangeName (oColumnColumn.getCellRangeByPosition (0, 1, 0, oColumnColumn.getRows.getCount - 1))
|
||||
sCellsIData = fnGetRangeName (oRowColumn.getCellRangeByPosition (0, 1, 0, oRowColumn.getRows.getCount - 1))
|
||||
|
||||
' Counts the number of groups and events
|
||||
sLabelsColumn = " "
|
||||
sLabelsRow = " "
|
||||
nGroups = 0
|
||||
nEvents = 0
|
||||
For nRow = 1 To oColumnColumn.getRows.getCount - 1
|
||||
sLabel = oColumnColumn.getCellByPosition (0, nRow).getString
|
||||
If InStr (sLabelsColumn, " " & sLabel & " ") = 0 Then
|
||||
sLabelsColumn = sLabelsColumn & sLabel & " "
|
||||
nGroups = nGroups + 1
|
||||
End If
|
||||
sLabel = oRowColumn.getCellByPosition (0, nRow).getString
|
||||
If InStr (sLabelsRow, " " & sLabel & " ") = 0 Then
|
||||
sLabelsRow = sLabelsRow & sLabel & " "
|
||||
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
|
||||
|
||||
' Collects the group and event labels
|
||||
sLabelsColumn = " "
|
||||
sLabelsRow = " "
|
||||
nJ = 0
|
||||
nI = 0
|
||||
For nRow = 1 To oColumnColumn.getRows.getCount - 1
|
||||
oCell = oColumnColumn.getCellByPosition (0, nRow)
|
||||
sLabel = oCell.getString
|
||||
If InStr (sLabelsColumn, " " & sLabel & " ") = 0 Then
|
||||
sLabelsColumn = sLabelsColumn & sLabel & " "
|
||||
mCellLabelColomn (nJ) = fnGetRangeName (oCell)
|
||||
nJ = nJ + 1
|
||||
End If
|
||||
oCell = oRowColumn.getCellByPosition (0, nRow)
|
||||
sLabel = oCell.getString
|
||||
If InStr (sLabelsRow, " " & sLabel & " ") = 0 Then
|
||||
sLabelsRow = sLabelsRow & sLabel & " "
|
||||
mCellLabelRow (nI) = fnGetRangeName (oCell)
|
||||
nI = nI + 1
|
||||
End If
|
||||
Next nRow
|
||||
|
||||
' Obtains the format parameters for the report.
|
||||
nFormatN = fnQueryFormat (oDoc, "#,##0")
|
||||
nFormatF = fnQueryFormat (oDoc, "#,###.000")
|
||||
nFormatP = fnQueryFormat (oDoc, "[<0.01]#.000""**"";[<0.05]#.000""*"";#.000")
|
||||
nFormatPct = fnQueryFormat (oDoc, "0.0%")
|
||||
|
||||
aBorderSingle.OuterLineWidth = 2
|
||||
aBorderDouble.OuterLineWidth = 2
|
||||
aBorderDouble.InnerLineWidth = 2
|
||||
aBorderDouble.LineDistance = 2
|
||||
|
||||
' Sets the column widths of the report.
|
||||
nTotalColumns = nGroups + 2
|
||||
If nEvents = 2 Then
|
||||
If nTotalColumns < 5 Then
|
||||
nTotalColumns = 5
|
||||
End If
|
||||
Else
|
||||
If nTotalColumns < 6 Then
|
||||
nTotalColumns = 6
|
||||
End If
|
||||
End If
|
||||
oColumns = oSheet.getColumns
|
||||
For nJ = 0 To nTotalColumns - 1
|
||||
oColumns.getByIndex (nJ).setPropertyValue ("Width", 3060)
|
||||
Next nJ
|
||||
|
||||
nRow = -2
|
||||
|
||||
' Group description
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Crosstabulation")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, nGroups + 1, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Event")
|
||||
For nJ = 0 To nGroups - 1
|
||||
oCell = oSheet.getCellByPosition (nJ + 1, nRow)
|
||||
sFormula = "=" & mCellLabelColomn (nJ)
|
||||
oCell.setFormula (sFormula)
|
||||
mCellLabelColomn (nJ) = fnGetLocalRangeName (oCell)
|
||||
Next nJ
|
||||
oCell = oSheet.getCellByPosition (nGroups + 1, nRow)
|
||||
oCell.setString ("Total")
|
||||
|
||||
' Shows each event
|
||||
nRow = nRow - 1
|
||||
For nI = 0 To nEvents - 1
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & mCellLabelRow (nI)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("VertJustify", 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 = "=COUNTIFS(" & sCellsJData & ";" & mCellLabelColomn (nJ) & ";" & sCellsIData & ";" & mCellLabelRow (nI) & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
mCellFrequency (nJ, nI) = fnGetLocalRangeName (oCell)
|
||||
Next nJ
|
||||
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
|
||||
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
|
||||
sFormula = "=SUM(" & sCells & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
mCellNI (nI) = fnGetLocalRangeName (oCell)
|
||||
Next nI
|
||||
' Shows the total
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Total")
|
||||
oCell.setPropertyValue ("VertJustify", 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 = ""
|
||||
For nI = 0 To nEvents - 1
|
||||
sFormula = sFormula & "+" & mCellFrequency (nJ, nI)
|
||||
Next nI
|
||||
sFormula = "=" & Right (sFormula, Len (sFormula) - 1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
mCellNJ (nJ) = fnGetLocalRangeName (oCell)
|
||||
Next nJ
|
||||
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
|
||||
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
|
||||
sFormula = ""
|
||||
For nI = 0 To nEvents - 1
|
||||
sFormula = sFormula & "+" & mCellNI (nI)
|
||||
Next nI
|
||||
sFormula = "=" & Right (sFormula, Len (sFormula) - 1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellN = fnGetLocalRangeName (oCell)
|
||||
' 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 = "=" & mCellFrequency (nJ, nI) & "/" & mCellNJ (nJ)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatPct)
|
||||
mCellProportion (nJ, nI) = fnGetLocalRangeName (oCell)
|
||||
Next nJ
|
||||
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
|
||||
sFormula = "=" & mCellNI (nI) & "/" & sCellN
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatPct)
|
||||
mCellPI (nI) = fnGetLocalRangeName (oCell)
|
||||
Next nI
|
||||
' Shows the total
|
||||
nRow = nRow + 2
|
||||
For nJ = 0 To nGroups - 1
|
||||
oCell = oSheet.getCellByPosition (1 + nJ, nRow)
|
||||
sFormula = ""
|
||||
For nI = 0 To nEvents - 1
|
||||
sFormula = sFormula & "+" & mCellProportion (nJ, nI)
|
||||
Next nI
|
||||
sFormula = "=" & Right (sFormula, Len (sFormula) - 1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatPct)
|
||||
Next nJ
|
||||
oCell = oSheet.getCellByPosition (1 + nGroups, nRow)
|
||||
sCells = fnGetLocalRangeName (oSheet.getCellRangeByPosition (1, nRow, nGroups, nRow))
|
||||
sFormula = ""
|
||||
For nI = 0 To nEvents - 1
|
||||
sFormula = sFormula & "+" & mCellPI (nI)
|
||||
Next nI
|
||||
sFormula = "=" & Right (sFormula, Len (sFormula) - 1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", 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)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - nEvents * 2 - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - nEvents * 2 - 2, nGroups + 1, nRow - nEvents * 2 - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow - nEvents * 2 - 1, 0, nRow - 2)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, nGroups + 1, nRow - 1)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow, nGroups + 1, nRow)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' The Chi-square test
|
||||
nRow = nRow + 2
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Chi-Square Test")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Test")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("χ2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", 33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("df")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
|
||||
' The test result.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Pearson’s Chi-Square")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = ""
|
||||
For nI = 0 To nEvents - 1
|
||||
For nJ = 0 To nGroups - 1
|
||||
sFormula = sFormula & "+POWER(" & mCellFrequency (nJ, nI) & ";2)/(" & mCellNI (nI) & "*" & mCellNJ (nJ) & ")"
|
||||
Next nJ
|
||||
Next nI
|
||||
sFormula = "=" & sCellN & "*(" & Right (sFormula, Len (sFormula) - 1) & "-1)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
sCellChi2 = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=(COUNT(" & sCellsRow & ")-1)*(COUNT(" & sCellsColumn & ")/2-1)"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatN)
|
||||
sCellDF = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=CHIDIST(" & sCellChi2 & ";" & sCellDF & ")"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: P1=P2=…PN=P (the proportions of the events in each group are the same)." & Chr (10) & _
|
||||
"H1: The above is false (the proportions of the events in each group are different) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", True)
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 3, nRow)
|
||||
oCells.merge (True)
|
||||
sNotes = oCell.getString
|
||||
oCursor = oCell.createTextCursor
|
||||
nPos = InStr (sNotes, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (1, sNotes, "P", 0)
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
If oCursor.getString <> " " Then
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
End If
|
||||
nPos = InStr (nPos + 1, sNotes, "P", 0)
|
||||
Loop
|
||||
nPos = InStr (sNotes, "PN")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 2, 3, nRow - 2)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nRow - 1, 3, nRow - 1)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
|
||||
' The posteriori comparison
|
||||
nRow = nRow + 2
|
||||
If nEvents = 2 Then
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Posteriori Comparison")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 4, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("j1")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("j2")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("Pj1-Pj2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -52)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -52)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("χ2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", 33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
Else
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Posteriori Comparison")
|
||||
oCell.setPropertyValue ("CellStyle", "Result2")
|
||||
oCells = oSheet.getCellRangeByPosition (0, nRow, 5, nRow)
|
||||
oCells.merge (True)
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Event")
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
oCell.setString ("j1")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
oCell.setString ("j2")
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
oCell.setString ("Pj1-Pj2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -52)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -52)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
oCell.setString ("χ2")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharEscapement", 33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
oCell.setString ("p")
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
oCursor = oCell.createTextCursor
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.gotoEnd (True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
End If
|
||||
|
||||
' The comparison between groups
|
||||
nRow = nRow + 1
|
||||
If nEvents = 2 Then
|
||||
For nJ1 = 0 To nGroups - 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
sFormula = "=" & mCellLabelColomn (nJ1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("VertJustify", 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 <> nJ2 Then
|
||||
oCell = oSheet.getCellByPosition (1, nRow)
|
||||
sFormula = "=" & mCellLabelColomn (nJ2)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=" & mCellProportion (nJ1, 0) & "-" & mCellProportion (nJ2, 0)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatPct)
|
||||
sCell = fnGetLocalRangeName (oCell)
|
||||
sSE2 = "(" & mCellProportion (nJ1, 0) & "*(1-" & mCellProportion (nJ1, 0) & "))/" & mCellNJ (nJ1) & _
|
||||
"+(" & mCellProportion (nJ2, 0) & "*(1-" & mCellProportion (nJ2, 0) & "))/" & mCellNJ (nJ2)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=IF(" & sSE2 & "=0;""(N/A)"";POWER(" & sCell & ";2)/(" & sSE2 & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
sCellChi2 = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=IF(" & sSE2 & "=0;""(N/A)"";CHIDIST(" & sCellChi2 & ";" & sCellDF & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
oCell.setPropertyValue ("ParaAdjust", 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 = "=" & mCellLabelRow (nI)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("VertJustify", 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 = "=" & mCellLabelColomn (nJ1)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("VertJustify", 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 <> nJ2 Then
|
||||
oCell = oSheet.getCellByPosition (2, nRow)
|
||||
sFormula = "=" & mCellLabelColomn (nJ2)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell = oSheet.getCellByPosition (3, nRow)
|
||||
sFormula = "=" & mCellProportion (nJ1, nI) & "-" & mCellProportion (nJ2, nI)
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatPct)
|
||||
sCell = fnGetLocalRangeName (oCell)
|
||||
sSE2 = "(" & mCellProportion (nJ1, nI) & "*(1-" & mCellProportion (nJ1, nI) & "))/" & mCellNJ (nJ1) & _
|
||||
"+(" & mCellProportion (nJ2, nI) & "*(1-" & mCellProportion (nJ2, nI) & "))/" & mCellNJ (nJ2)
|
||||
oCell = oSheet.getCellByPosition (4, nRow)
|
||||
sFormula = "=IF(" & sSE2 & "=0;""(N/A)"";POWER(" & sCell & ";2)/(" & sSE2 & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatF)
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
sCellChi2 = fnGetLocalRangeName (oCell)
|
||||
oCell = oSheet.getCellByPosition (5, nRow)
|
||||
sFormula = "=IF(" & sSE2 & "=0;""(N/A)"";CHIDIST(" & sCellChi2 & ";" & sCellDF & "))"
|
||||
oCell.setFormula (sFormula)
|
||||
oCell.setPropertyValue ("NumberFormat", nFormatP)
|
||||
oCell.setPropertyValue ("ParaAdjust", com.sun.star.style.ParagraphAdjust.RIGHT)
|
||||
nRow = nRow + 1
|
||||
End If
|
||||
Next nJ2
|
||||
Next nJ1
|
||||
Next nI
|
||||
End If
|
||||
nRow = nRow - 1
|
||||
|
||||
' The foot notes of the test.
|
||||
nRow = nRow + 1
|
||||
oCell = oSheet.getCellByPosition (0, nRow)
|
||||
oCell.setString ("Note: *: p<.05, **: p<.01" & Chr (10) & _
|
||||
"H0: Pj1=Pj2 (the proportions of the event in the two groups are the same)." & Chr (10) & _
|
||||
"H1: Pj1≠Pj2 (the proportions of the event in the two groups are different) if the probability (p) is small enough.")
|
||||
oCell.setPropertyValue ("IsTextWrapped", 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, "p<")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (nPos + 1, sNotes, "p<")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "(p)")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
nPos = InStr (sNotes, "Pj")
|
||||
Do While nPos <> 0
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -52)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 34)
|
||||
nPos = InStr (nPos + 1, sNotes, "Pj")
|
||||
Loop
|
||||
nPos = InStr (sNotes, "H0")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
nPos = InStr (sNotes, "H1")
|
||||
oCursor.gotoStart (False)
|
||||
oCursor.goRight (nPos - 1, False)
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharPosture", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureAsian", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.setPropertyValue ("CharPostureComplex", com.sun.star.awt.FontSlant.ITALIC)
|
||||
oCursor.collapseToEnd
|
||||
oCursor.goRight (1, True)
|
||||
oCursor.setPropertyValue ("CharEscapement", -33)
|
||||
oCursor.setPropertyValue ("CharEscapementHeight", 58)
|
||||
|
||||
' Draws the table borders.
|
||||
If nEvents = 2 Then
|
||||
nStartRow = nRow - nGroups * (nGroups - 1) - 1
|
||||
oCells = oSheet.getCellByPosition (0, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (1, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nStartRow, 4, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (1, nStartRow + 1, 1, nRow - 2)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1 - (nGroups - 1) + 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nRow - 1, 4, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
Else
|
||||
nStartRow = nRow - nEvents * nGroups * (nGroups - 1) - 1
|
||||
oCells = oSheet.getCellRangeByPosition (0, nStartRow, 1, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (2, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (3, nStartRow, 5, nStartRow)
|
||||
oCells.setPropertyValue ("TopBorder", aBorderDouble)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellRangeByPosition (2, nStartRow + 1, 2, nRow - 2)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells = oSheet.getCellByPosition (0, nRow - 1 - nGroups * (nGroups - 1) + 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (1, nRow - 1 - (nGroups - 1) + 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellByPosition (2, nRow - 1)
|
||||
oCells.setPropertyValue ("RightBorder", aBorderSingle)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
oCells = oSheet.getCellRangeByPosition (3, nRow - 1, 5, nRow - 1)
|
||||
oCells.setPropertyValue ("BottomBorder", aBorderDouble)
|
||||
End If
|
||||
End Sub
|
||||
</script:module>
|
225
oxt/StatTool/9Utils.xba
Normal file
225
oxt/StatTool/9Utils.xba
Normal 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">' Copyright (c) 2016 imacat.
|
||||
'
|
||||
' 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.
|
||||
|
||||
' 9Utils: The utility macros.
|
||||
' by imacat <imacat@mail.imacat.idv.tw>, 2016-08-10
|
||||
|
||||
Option Explicit
|
||||
|
||||
' fnCheckRangeName: Checks the range name and returns the range when
|
||||
' 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, ".")
|
||||
If nPos = 0 Then
|
||||
oSheet = oController.getActiveSheet
|
||||
Else
|
||||
sSheetName = Left (sRangeName, nPos - 1)
|
||||
If Left (sSheetName, 1) = "$" Then
|
||||
sSheetName = Right (sSheetName, Len (sSheetName) - 1)
|
||||
End If
|
||||
oSheet = oDoc.getSheets.getByName (sSheetName)
|
||||
End If
|
||||
fnCheckRangeName = oSheet.getCellRangeByName (sRangeName)
|
||||
|
||||
ErrorHandler:
|
||||
End Function
|
||||
|
||||
' fnQueryFormat: Returns the index of the number format, and creates
|
||||
' 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
|
||||
|
||||
' 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 ("AbsoluteName")
|
||||
nPos = InStr (sName, "$")
|
||||
Do While nPos <> 0
|
||||
sName = Left (sName, nPos - 1) & Right (sName, Len (sName) - nPos)
|
||||
nPos = InStr (sName, "$")
|
||||
Loop
|
||||
fnGetRangeName = sName
|
||||
End Function
|
||||
|
||||
' 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, ".")
|
||||
If nPos <> 0 Then
|
||||
sName = Right (sName, Len (sName) - nPos)
|
||||
End If
|
||||
fnGetLocalRangeName = sName
|
||||
End Function
|
||||
|
||||
' 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
|
||||
|
||||
' Runs the dialog
|
||||
oDialog = CreateUnoDialog (DialogLibraries.StatTool.Dlg2SpecData)
|
||||
oTextModel = oDialog.getControl ("txtPrompt1").getModel
|
||||
oTextModel.setPropertyValue ("Label", sPrompt1)
|
||||
oListModel1 = oDialog.getControl ("lstData1").getModel
|
||||
oListModel1.setPropertyValue ("StringItemList", mLabels)
|
||||
mSelected (0) = 0
|
||||
oListModel1.setPropertyValue ("SelectedItems", mSelected)
|
||||
oTextModel = oDialog.getControl ("txtPrompt2").getModel
|
||||
oTextModel.setPropertyValue ("Label", sPrompt2)
|
||||
oListModel2 = oDialog.getControl ("lstData2").getModel
|
||||
oListModel2.setPropertyValue ("StringItemList", mLabels)
|
||||
mSelected (0) = 1
|
||||
oListModel2.setPropertyValue ("SelectedItems", mSelected)
|
||||
|
||||
nResult = oDialog.execute
|
||||
oDialog.dispose
|
||||
|
||||
' Cancelled
|
||||
If nResult = 0 Then
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
nColumn = oListModel1.getPropertyValue ("SelectedItems") (0)
|
||||
mRanges (0) = oRange.getCellRangeByPosition ( _
|
||||
nColumn, 0, nColumn, oRange.getRows.getCount - 1)
|
||||
nColumn = oListModel2.getPropertyValue ("SelectedItems") (0)
|
||||
mRanges (1) = oRange.getCellRangeByPosition ( _
|
||||
nColumn, 0, nColumn, oRange.getRows.getCount - 1)
|
||||
fnSpecifyData = mRanges
|
||||
End Function
|
||||
|
||||
' fnAskDataRange: Asks the user for the data range, or null when
|
||||
' 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 = ""
|
||||
Else
|
||||
sCellsData = oRange.getPropertyValue ("AbsoluteName")
|
||||
End If
|
||||
sPrompt = "&27.Dlg1AskRange.txtPrompt.Label"
|
||||
|
||||
' Loop until we finds good data
|
||||
Do While sPrompt <> ""
|
||||
' Runs the dialog
|
||||
oDialog = CreateUnoDialog (DialogLibraries.StatTool.Dlg1AskRange)
|
||||
oTextModel = oDialog.getControl ("txtPrompt").getModel
|
||||
oTextModel.setPropertyValue ("Label", sPrompt)
|
||||
oEditModel = oDialog.getControl ("edtCellsData").getModel
|
||||
oEditModel.setPropertyValue ("Text", sCellsData)
|
||||
|
||||
nResult = oDialog.execute
|
||||
oDialog.dispose
|
||||
|
||||
' Cancelled
|
||||
If nResult = 0 Then
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
sCellsData = oEditModel.getPropertyValue ("Text")
|
||||
If sCellsData = "" Then
|
||||
sPrompt = "&27.Dlg1AskRange.txtPrompt.Label"
|
||||
Else
|
||||
oRange = fnCheckRangeName (oDoc, sCellsData)
|
||||
If IsNull (oRange) Then
|
||||
sPrompt = "&35.Dlg1AskRange.txtPrompt.LabelNotExists"
|
||||
Else
|
||||
If oRange.getRows.getCount < 2 Or oRange.getColumns.getCount < 2 Then
|
||||
sPrompt = "&36.Dlg1AskRange.txtPrompt.LabelTooSmall"
|
||||
Else
|
||||
sPrompt = ""
|
||||
oDoc.getCurrentController.select (oRange)
|
||||
fnAskDataRange = oRange
|
||||
Exit Function
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Loop
|
||||
End Function
|
||||
|
||||
' 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
|
||||
|
||||
' Some data ranges are already selected.
|
||||
If Not oSelection.supportsService ("com.sun.star.sheet.SheetCell") Then
|
||||
' Takes the first selection in multiple selections
|
||||
If oSelection.supportsService ("com.sun.star.sheet.SheetCellRanges") Then
|
||||
fnFindActiveDataRange = oSelection.getByIndex (0)
|
||||
' The only selection
|
||||
Else
|
||||
fnFindActiveDataRange = oSelection
|
||||
End If
|
||||
Exit Function
|
||||
End If
|
||||
|
||||
' 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 <= aCellAddress.Row _
|
||||
And aRangeAddress.EndRow >= aCellAddress.Row _
|
||||
And aRangeAddress.StartColumn <= aCellAddress.Column _
|
||||
And aRangeAddress.EndColumn >= aCellAddress.Column Then
|
||||
oDoc.getCurrentController.select (oRange)
|
||||
fnFindActiveDataRange = oRange
|
||||
Exit Function
|
||||
End If
|
||||
Next nI
|
||||
' Not in a data cell range
|
||||
End Function
|
||||
</script:module>
|
0
oxt/StatTool/DialogStrings_en_US.default
Normal file
0
oxt/StatTool/DialogStrings_en_US.default
Normal file
24
oxt/StatTool/DialogStrings_en_US.properties
Normal file
24
oxt/StatTool/DialogStrings_en_US.properties
Normal 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)
|
24
oxt/StatTool/DialogStrings_zh_CN.properties
Normal file
24
oxt/StatTool/DialogStrings_zh_CN.properties
Normal 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
|
24
oxt/StatTool/DialogStrings_zh_TW.properties
Normal file
24
oxt/StatTool/DialogStrings_zh_TW.properties
Normal 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
|
10
oxt/StatTool/Dlg1AskRange.xdl
Normal file
10
oxt/StatTool/Dlg1AskRange.xdl
Normal 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="&16.Dlg1AskRange.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&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="&26.Dlg1AskRange.txtPrompt.HelpText" dlg:value="&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="&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="&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="&34.Dlg1AskRange.btnOK.HelpText" dlg:default="true" dlg:button-type="ok"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
12
oxt/StatTool/Dlg2SpecData.xdl
Normal file
12
oxt/StatTool/Dlg2SpecData.xdl
Normal 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="&0.Dlg2SpecData.HelpText" dlg:closeable="true" dlg:moveable="true" dlg:title="&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="&2.Dlg2SpecData.txtPrompt1.HelpText" dlg:value="&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="&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="&5.Dlg2SpecData.txtPrompt2.HelpText" dlg:value="&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="&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="&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="&9.Dlg2SpecData.btnOK.HelpText" dlg:default="true" dlg:button-type="ok"/>
|
||||
</dlg:bulletinboard>
|
||||
</dlg:window>
|
6
oxt/StatTool/dialog.xlb
Normal file
6
oxt/StatTool/dialog.xlb
Normal 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
10
oxt/StatTool/script.xlb
Normal 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
26
oxt/description.xml
Normal 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>
|
4
oxt/pkg-desc/pkg-description.txt
Normal file
4
oxt/pkg-desc/pkg-description.txt
Normal file
@ -0,0 +1,4 @@
|
||||
StatTool - Office Statistics Tools
|
||||
Copyright (c) 2016 imacat
|
||||
|
||||
An additional Calc menu to for statistical tests.
|
4
oxt/pkg-desc/pkg-description.zh-CN.txt
Normal file
4
oxt/pkg-desc/pkg-description.zh-CN.txt
Normal file
@ -0,0 +1,4 @@
|
||||
StatTool - Office 统计工具
|
||||
版权所有 (c) 2016 依玛猫
|
||||
|
||||
新增 Calc 试算表统计菜单,计算统计检定。
|
4
oxt/pkg-desc/pkg-description.zh-TW.txt
Normal file
4
oxt/pkg-desc/pkg-description.zh-TW.txt
Normal file
@ -0,0 +1,4 @@
|
||||
StatTool - Office 統計工具
|
||||
版權所有 (c) 2016 依瑪貓
|
||||
|
||||
新增 Calc 試算表統計選單,計算統計檢定。
|
611
oxt/registration/LICENSE
Normal file
611
oxt/registration/LICENSE
Normal 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.
|
||||
|
||||
====================================================================
|
Loading…
Reference in New Issue
Block a user