/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
class RTFAttributes
{
static {
0f, 0));
0f, 0));
0f, 0));
"sa", 0));
"sb", 0));
/* The following aren't actually recognized by Swing */
"strike"));
"deleted"));
"paperw", 12240));
"paperh", 15840));
"margl", 1800));
"margr", 1800));
"margt", 1440));
"margb", 1440));
"gutter", 0));
"nowidctlpar", False));
"widctlpar", True));
"widowctrl", True));
attributes = attrs;
}
{
}
return d;
}
/************************************************************************/
/************************************************************************/
static abstract class GenericAttribute
{
int domain;
{
domain = d;
swingName = s;
rtfName = r;
}
boolean force)
throws IOException
{
}
boolean force)
throws IOException
{
return false;
}
}
static class BooleanAttribute
extends GenericAttribute
implements RTFAttribute
{
boolean rtfDefault;
boolean swingDefault;
{
super(d, s, r);
swingDefault = ds;
rtfDefault = dr;
}
{
super(d, s, r);
swingDefault = false;
rtfDefault = false;
}
{
/* TODO: There's some ambiguity about whether this should
*set* or *toggle* the attribute. */
return true; /* true indicates we were successful */
}
{
/* See above note in the case that parameter==1 */
return true; /* true indicates we were successful */
}
{
if (swingDefault != rtfDefault ||
return true;
}
boolean force)
throws IOException
{
else
if (val.booleanValue()) {
} else {
}
}
return true;
}
}
static class AssertiveAttribute
extends GenericAttribute
implements RTFAttribute
{
{
super(d, s, r);
}
{
super(d, s, r);
swingValue = v;
}
{
super(d, s, r);
}
{
if (swingValue == null)
else
return true;
}
{
return false;
}
{
return true;
}
boolean force)
throws IOException
{
return ! force;
}
return true;
}
return ! force;
}
}
static class NumericAttribute
extends GenericAttribute
implements RTFAttribute
{
int rtfDefault;
float scale;
{
super(d, s, r);
rtfDefault = 0;
swingDefault = null;
scale = 1f;
}
{
}
{
super(d, s, r);
swingDefault = ds;
rtfDefault = dr;
}
{
}
int dr)
{
}
{
return false;
}
{
if (scale == 1f)
else
return true;
}
{
old = swingDefault;
))
return true;
return true;
}
boolean force)
throws IOException
{
/* TODO: What is the proper behavior if the Swing object does
not specify a value, and we don't know its default value?
Currently we pretend that the RTF default value is
equivalent (probably a workable assumption) */
return true;
}
return true;
}
}
}