aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/poi/ss/usermodel/FontFormatting.java
blob: ca7335aac57dad64a0e96bd4e08595bd50bc91fc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
/*
 *  ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one or more
 *    contributor license agreements.  See the NOTICE file distributed with
 *    this work for additional information regarding copyright ownership.
 *    The ASF licenses this file to You under the Apache License, Version 2.0
 *    (the "License"); you may not use this file except in compliance with
 *    the License.  You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 * ====================================================================
 */

package org.apache.poi.ss.usermodel;

import org.apache.poi.util.Removal;

/**
 * High level representation for Font Formatting component
 * of Conditional Formatting settings
 */
public interface FontFormatting {
    // TODO: refactor and unify Font & FontFormatting in POI 5.0.0

    /**
     * Escapement type - None
     *
     * @deprecated use {@link Font#SS_NONE} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    short SS_NONE  = 0;
    /**
     * Escapement type - Superscript
     *
     * @deprecated use {@link Font#SS_SUPER} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    short SS_SUPER = 1;
    /**
     * Escapement type - Subscript
     *
     * @deprecated use {@link Font#SS_SUB} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    short SS_SUB   = 2;

    /**
     * Underline type - None
     *
     * @deprecated use {@link Font#U_NONE} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    byte U_NONE              = 0;
    /**
     * Underline type - Single
     *
     * @deprecated use {@link Font#U_SINGLE} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    byte U_SINGLE            = 1;
    /**
     * Underline type - Double
     *
     * @deprecated use {@link Font#U_DOUBLE} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    byte U_DOUBLE            = 2;
    /**
     * Underline type - Single Accounting
     *
     * @deprecated use {@link Font#U_SINGLE_ACCOUNTING} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    byte U_SINGLE_ACCOUNTING = 0x21;
    /**
     * Underline type - Double Accounting
     *
     * @deprecated use {@link Font#U_DOUBLE_ACCOUNTING} instead
     */
    @Deprecated
    @Removal(version = "5.0.0")
    byte U_DOUBLE_ACCOUNTING = 0x22;

    /**
     * get the type of super or subscript for the font
     *
     * @return super or subscript option
     * @see Font#SS_NONE
     * @see Font#SS_SUPER
     * @see Font#SS_SUB
     */
    short getEscapementType();

    /**
     * set the escapement type for the font
     *
     * @param escapementType  super or subscript option
     * @see Font#SS_NONE
     * @see Font#SS_SUPER
     * @see Font#SS_SUB
     */
    void setEscapementType(short escapementType);

    /**
     * @return font colour index, or 0 if not indexed (XSSF only)
     */
    short getFontColorIndex();

    /**
     * Sets the indexed colour to use
     * @param color font colour index
     */
    void setFontColorIndex(short color);

    /**
     * @return The colour of the font, or null if no colour applied
     */
    Color getFontColor();

    /**
     * Sets the colour to use
     * @param color font colour to use
     */
    void setFontColor(Color color);

    /**
     * gets the height of the font in 1/20th point units
     *
     * @return fontheight (in points/20); or -1 if not modified
     */
    int getFontHeight();

    /**
     * Sets the height of the font in 1/20th point units
     *
     * @param height the height in twips (in points/20)
     */
    void setFontHeight(int height);

    /**
     * get the type of underlining for the font
     *
     * @return font underlining type
     *
     * @see Font#U_NONE
     * @see Font#U_SINGLE
     * @see Font#U_DOUBLE
     * @see Font#U_SINGLE_ACCOUNTING
     * @see Font#U_DOUBLE_ACCOUNTING
     */
    short getUnderlineType();

    /**
     * set the type of underlining type for the font
     *
     * @param underlineType  super or subscript option
     *
     * @see Font#U_NONE
     * @see Font#U_SINGLE
     * @see Font#U_DOUBLE
     * @see Font#U_SINGLE_ACCOUNTING
     * @see Font#U_DOUBLE_ACCOUNTING
     */
    void setUnderlineType(short underlineType);

    /**
     * get whether the font weight is set to bold or not
     *
     * @return bold - whether the font is bold or not
     */
    boolean isBold();

    /**
     * @return true if font style was set to <i>italic</i>
     */
    boolean isItalic();


    /**
     * @return true if font strikeout is on
     */
    boolean isStruckout();

    /**
     * set font style options.
     *
     * @param italic - if true, set posture style to italic, otherwise to normal
     * @param bold if true, set font weight to bold, otherwise to normal
     */
    void setFontStyle(boolean italic, boolean bold);

    /**
     * set font style options to default values (non-italic, non-bold)
     */
    void resetFontStyle();
}