public class CellStyleHandler extends DefaultStyleHandler
This class provides functions to handle the border settings, font settings, text alignment settings and so on.
isUseDefaultStyle, mDocument, mFamilyProperties, mGraphicProperties, mOdfElement, mParagraphProperties, mStyleElement, mTableCellProperties, mTableProperties, mTextProperties, mWritableGraphicProperties, mWritableParagraphProperties, mWritableStyleElement, mWritableTableCellProperties, mWritableTableProperties, mWritableTextProperties
Modifier and Type | Method and Description |
---|---|
Color |
getBackgroundColor()
Return the background color.
|
Border |
getBorder(StyleTypeDefinitions.CellBordersType type)
Return the border setting for a specific border.
|
String |
getCountry(Document.ScriptType type)
Return the country information for a specific script type
|
Font |
getFont(Document.ScriptType type)
Return the font definition for a specific script type.
|
StyleTypeDefinitions.HorizontalAlignmentType |
getHorizontalAlignment()
Return the horizontal alignment.
|
String |
getLanguage(Document.ScriptType type)
Return the language information for a specific script type
|
OdfStyle |
getStyleElementForWrite()
Return the style element for this cell, for read and write functions.
|
String |
getUsedStyleName()
Return the used style name of this cell.
|
StyleTypeDefinitions.VerticalAlignmentType |
getVerticalAlignment()
Return the vertical alignment.
|
boolean |
isTextWrapped()
Return the wrap option of this cell.
|
void |
setBackgroundColor(Color color)
Set the background color of this cell.
|
void |
setBorders(Border border,
StyleTypeDefinitions.CellBordersType bordersType)
Set the border style of this cell.
|
void |
setCountry(String country,
Document.ScriptType type)
Set the country information for a specific script type
|
void |
setFont(Font font)
Set the font definition.
|
void |
setFont(Font font,
Locale language)
Set the font definition.
|
void |
setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
Set the horizontal alignment.
|
void |
setLanguage(String language,
Document.ScriptType type)
Set the language information for a specific script type
|
void |
setTextWrapped(boolean isWrapped)
Set the wrap option of this cell.
|
void |
setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType alignType)
Set the vertical alignment setting of this cell.
|
getGraphicPropertiesForRead, getGraphicPropertiesForWrite, getParagraphPropertiesForRead, getParagraphPropertiesForWrite, getReadableStyleElementByName, getStyleElementForRead, getTableCellPropertiesForRead, getTableCellPropertiesForWrite, getTablePropertiesForRead, getTablePropertiesForWrite, getTextPropertiesForRead, getTextPropertiesForWrite, getWritableStyleElementByName
public String getCountry(Document.ScriptType type)
The country information in its parent style and default style will be taken into considered.
Null will be returned if there is no country information for this script type.
type
- - script typepublic Font getFont(Document.ScriptType type)
The font definition in its parent style and default style will be taken into considered.
A default font definition will be returned if there is no font definition for this script type at all.
type
- - script typepublic String getLanguage(Document.ScriptType type)
The language definition in its parent style and default style will be taken into considered.
Null will be returned if there is no language information for this script type at all.
type
- - script typepublic void setCountry(String country, Document.ScriptType type)
The consistency between country and script type is not verified.
If the parameter country
is null, the country information for this script type
will be removed.
country
- - the country informationtype
- - script typeTextProperties.setCountry(String, Document.ScriptType)
,
Document.ScriptType
public void setFont(Font font)
If the parameter font
is null, nothing will be happened.
font
- font definitionpublic void setFont(Font font, Locale language)
If the parameter font
is null, nothing will be happened.
font
- font definitionpublic void setLanguage(String language, Document.ScriptType type)
If the parameter language
is null, the language information for this script
type will be removed.
language
- - the language informationtype
- - script typepublic void setHorizontalAlignment(StyleTypeDefinitions.HorizontalAlignmentType alignType)
If the parameter alignType
is null, the horizontal alignment setting will be
removed.
alignType
- the horizontal alignmentpublic StyleTypeDefinitions.HorizontalAlignmentType getHorizontalAlignment()
The horizontal alignment in its parent style and default style will be taken into considered.
HorizontalAlignmentType.DEFAULT will be returned if there is no horizontal alignment setting.
public OdfStyle getStyleElementForWrite()
An empty style definition will be created if there is no style definition.
getStyleElementForWrite
in class DefaultStyleHandler
DefaultStyleHandler.getUsedStyleName()
public String getUsedStyleName()
If there is no style name defined for cell, the attribute "table:default-cell-style-name" in table row and table column would be returned.
getUsedStyleName
in class DefaultStyleHandler
public Color getBackgroundColor()
The background color in its parent style and default style will be taken into considered.
Color WHITE will be returned if there is no the background color definition or the background color definition is not valid.
public Border getBorder(StyleTypeDefinitions.CellBordersType type)
The accepted parameter can be TOP,BOTTOM,LEFT,RIGHT,DIAGONALBLTR and DIAGONALTLBR.
The border type with a collection of borders, e.g. ALL_FOUR, LEFT_RIGHT, are not legal arguments
The border definition in its parent style and default style will be taken into considered.
Border.NONE
will be returned if there is no the border definition for a
specific border.
type
- - the border type which describes a single borderpublic StyleTypeDefinitions.VerticalAlignmentType getVerticalAlignment()
If there is no vertical alignment definition, DEFAULT will be returned.
The vertical alignment definition in its parent style and default style will be taken into considered.
public boolean isTextWrapped()
The wrap option definition in its parent style and default style will be taken into considered.
true
if the cell content can be wrapped;
false
if the cell content cannot be wrapped.
public void setBackgroundColor(Color color)
color
- - the background color that need to set. If color
is null, background
color setting will be removed.public void setBorders(Border border, StyleTypeDefinitions.CellBordersType bordersType)
The second parameter bordersType
describes which borders you want to apply the
style to, e.g. up border, bottom border, left border, right border, diagonal lines or four
borders.
border
- - the border style descriptionbordersType
- - the type of the borderspublic void setVerticalAlignment(StyleTypeDefinitions.VerticalAlignmentType alignType)
If the alignment is set as Default or null, the explicit vertical alignment setting is removed.
alignType
- - the vertical alignment setting.public void setTextWrapped(boolean isWrapped)
isWrapped
- - whether the cell content can be wrapped or notCopyright © 2010–2018 Apache Software Foundation; Copyright © 2018–2020 The Document Foundation. All rights reserved.