LibreOffice Module xmerge (master) 1
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.openoffice.xmerge.converter.xml.TextStyle Class Reference

Represents a text Style in an OpenOffice document. More...

Inheritance diagram for org.openoffice.xmerge.converter.xml.TextStyle:
[legend]
Collaboration diagram for org.openoffice.xmerge.converter.xml.TextStyle:
[legend]

Public Member Functions

 TextStyle (Node node, StyleCatalog sc)
 Constructor for use when going from DOM to client device format. More...
 
 TextStyle (String name, String family, String parent, int mask, int values, int fontSize, String fontName, StyleCatalog sc)
 Constructor for use when going from client device format to DOM. More...
 
int getFontSize ()
 Return the font size for this Style. More...
 
String getFontName ()
 Return the name of the font for this Style. More...
 
Color getFontColor ()
 Return the font Color for this Style. More...
 
Color getBackgroundColor ()
 Return the background Color for this Style. More...
 
Style getResolved ()
 Return a Style object corresponding to this one, but with all of the inherited information from parent Style objects filled in. More...
 
void dumpCSV ()
 Dump this Style as a Comma Separated Value (CSV) line. More...
 
Node createNode (org.w3c.dom.Document parentDoc, String name)
 Create a new Node in the Document, and write this Style to it. More...
 
boolean isSubset (Style style)
 Return true if style specifies as much or less than this Style, and nothing it specifies contradicts this Style. More...
 
- Public Member Functions inherited from org.openoffice.xmerge.converter.xml.Style
 Style (Node node, StyleCatalog sc)
 Constructor for use when going from DOM to client device format. More...
 
 Style (String name, String family, String parent, StyleCatalog sc)
 Constructor for use when going from client device format to DOM. More...
 
void setCatalog (StyleCatalog sc)
 Set the StyleCatalog to be used when looking up the Style parent. More...
 
String getName ()
 Returns the name of this Style. More...
 
void setName (String newName)
 Sets the name of this Style. More...
 
String getFamily ()
 Return the family of this Style. More...
 
String getParent ()
 Return the name of the parent of this Style. More...
 
Style getResolved ()
 Return a Style object corresponding to this one, but with all of the inherited information from parent Style objects filled in. More...
 
Node createNode (org.w3c.dom.Document parentDoc, String name)
 Write a Node in parentDoc representing this Style. More...
 
boolean isSubset (Style style)
 Return true if Style is a subset of this one. More...
 

Static Public Member Functions

static void dumpHdr ()
 Print a Comma Separated Value (CSV) header line for the spreadsheet dump. More...
 

Private Member Functions

Color parseColorString (String value)
 Parse a color specification of the form #rrggbb More...
 
void handleAttribute (String attr, String value)
 Set an attribute. More...
 
void turnAttributesOn (int flags)
 Set one or more text attributes to on. More...
 
void turnAttributesOff (int flags)
 Set one or more text attributes to off. More...
 
void writeAttributes (Element node)
 Write this Style object's attributes to a Node in the Document. More...
 
String buildColorString (Color c)
 Given a Color, return a string of the form #rrggbb. More...
 
boolean isIgnored (String attribute)
 This code checks whether an attribute is one that we intentionally ignore. More...
 

Static Private Member Functions

static String toCSV (String value)
 Private function to return the value as an element in a Comma Separated Value (CSV) format. More...
 
static String toLastCSV (String value)
 Private function to return the value as a last element in a Comma Separated Value (CSV) format. More...
 

Private Attributes

int values = 0
 Values of text attributes. More...
 
int mask = 0
 Bitwise mask of text attributes. More...
 
int sizeInPoints = 0
 Font size in points. More...
 
String fontName = null
 Font name. More...
 
Color fontColor = null
 Font Color. More...
 
Color bgColor = null
 Background Color. More...
 

Static Private Attributes

final static int BOLD = 0x01
 Indicates bold text. More...
 
final static int ITALIC = 0x02
 Indicates italic text. More...
 
final static int UNDERLINE = 0x04
 Indicates underlined text. More...
 
final static int STRIKETHRU = 0x08
 Indicates strike-through in the text. More...
 
final static int SUPERSCRIPT = 0x10
 Indicates superscripted text. More...
 
final static int SUBSCRIPT = 0x20
 Indicates subscripted text. More...
 
static String[] ignored
 

Additional Inherited Members

- Protected Attributes inherited from org.openoffice.xmerge.converter.xml.Style
String name = null
 Name of the Style. More...
 
String family = null
 Family of the Style. More...
 
String parent = null
 Parent of the Style. More...
 
StyleCatalog sc
 A reference to the StyleCatalog to be used for looking up ancestor Style objects. More...
 

Detailed Description

Represents a text Style in an OpenOffice document.

Definition at line 35 of file TextStyle.java.

Constructor & Destructor Documentation

◆ TextStyle() [1/2]

org.openoffice.xmerge.converter.xml.TextStyle.TextStyle ( Node  node,
StyleCatalog  sc 
)
inline

Constructor for use when going from DOM to client device format.

Parameters
nodeThe style:style Node containing the Style. (This Node is assumed have a family attribute of text).
scThe StyleCatalog, which is used for looking up ancestor Style objects.

Definition at line 73 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute(), i, and String.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.getResolved(), and org.openoffice.xmerge.converter.xml.TextStyle.isSubset().

◆ TextStyle() [2/2]

org.openoffice.xmerge.converter.xml.TextStyle.TextStyle ( String  name,
String  family,
String  parent,
int  mask,
int  values,
int  fontSize,
String  fontName,
StyleCatalog  sc 
)
inline

Constructor for use when going from client device format to DOM.

Parameters
nameName of text Style. Can be null.
familyFamily of text Style (usually text). Can be null.
parentName of parent text Style, or null for none.
maskBitwise mask of text attributes that this text Style will specify. Can be any combination of the following, or'ed together: BOLD, ITALIC, UNDERLINE, STRIKETHRU, SUPERSCRIPT, SUBSCRIPT. This parameter determines what attributes this Style will specify. When an attribute is specified in a Style, its value can be either on or off. The on/off value for each attribute is controlled by the values parameter.
valuesValues of text attributes that this text Style will be setting. Any of the attributes (BOLD, etc) listed for mask can be used for this.
fontSizeFont size in points.
fontNameName of font.
scThe StyleCatalog, which is used for looking up ancestor Style objects.

Definition at line 138 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.Style.family, org.openoffice.xmerge.converter.xml.TextStyle.fontName, org.openoffice.xmerge.converter.xml.TextStyle.mask, org.openoffice.xmerge.converter.xml.Style.name, org.openoffice.xmerge.converter.xml.Style.parent, and org.openoffice.xmerge.converter.xml.TextStyle.values.

Member Function Documentation

◆ buildColorString()

String org.openoffice.xmerge.converter.xml.TextStyle.buildColorString ( Color  c)
inlineprivate

Given a Color, return a string of the form #rrggbb.

Parameters
cThe Color value.
Returns
The Color value in the form #rrggbb.

Definition at line 542 of file TextStyle.java.

References String.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.writeAttributes().

◆ createNode()

Node org.openoffice.xmerge.converter.xml.TextStyle.createNode ( org.w3c.dom.Document  parentDoc,
String  name 
)
inline

Create a new Node in the Document, and write this Style to it.

Parameters
parentDocParent Document of the Node to create.
nameName to use for the new Node (e.g. style:style)
Returns
Created Node.

Reimplemented from org.openoffice.xmerge.converter.xml.Style.

Definition at line 443 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.Style.name, and org.openoffice.xmerge.converter.xml.TextStyle.writeAttributes().

◆ dumpCSV()

void org.openoffice.xmerge.converter.xml.TextStyle.dumpCSV ( )
inline

◆ dumpHdr()

static void org.openoffice.xmerge.converter.xml.TextStyle.dumpHdr ( )
inlinestatic

Print a Comma Separated Value (CSV) header line for the spreadsheet dump.

Definition at line 408 of file TextStyle.java.

References System, org.openoffice.xmerge.converter.xml.TextStyle.toCSV(), and org.openoffice.xmerge.converter.xml.TextStyle.toLastCSV().

◆ getBackgroundColor()

Color org.openoffice.xmerge.converter.xml.TextStyle.getBackgroundColor ( )
inline

Return the background Color for this Style.

Can be null if none was specified.

Returns
Background Color value for this Style. Can be null.

Definition at line 289 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.bgColor, and Color.

◆ getFontColor()

Color org.openoffice.xmerge.converter.xml.TextStyle.getFontColor ( )
inline

Return the font Color for this Style.

Can be null if none was specified.

Returns
Color value for this Style. Can be null.

Definition at line 277 of file TextStyle.java.

References Color, and org.openoffice.xmerge.converter.xml.TextStyle.fontColor.

◆ getFontName()

String org.openoffice.xmerge.converter.xml.TextStyle.getFontName ( )
inline

Return the name of the font for this Style.

Returns
Name of font, or null if no font is specified by this Style.

Definition at line 266 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.fontName, and String.

◆ getFontSize()

int org.openoffice.xmerge.converter.xml.TextStyle.getFontSize ( )
inline

Return the font size for this Style.

Returns
The font size in points

Definition at line 256 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.sizeInPoints.

◆ getResolved()

Style org.openoffice.xmerge.converter.xml.TextStyle.getResolved ( )
inline

◆ handleAttribute()

void org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute ( String  attr,
String  value 
)
inlineprivate

◆ isIgnored()

boolean org.openoffice.xmerge.converter.xml.TextStyle.isIgnored ( String  attribute)
inlineprivate

This code checks whether an attribute is one that we intentionally ignore.

Parameters
attributeThe attribute to check.
Returns
true if attribute can be ignored, otherwise false.

Definition at line 567 of file TextStyle.java.

References attribute, org.openoffice.xmerge.converter.xml.TextStyle.ignored, and String.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute().

◆ isSubset()

boolean org.openoffice.xmerge.converter.xml.TextStyle.isSubset ( Style  style)
inline

Return true if style specifies as much or less than this Style, and nothing it specifies contradicts this Style.

Parameters
styleThe Style to check.
Returns
true if style is a subset, false otherwise.

Reimplemented from org.openoffice.xmerge.converter.xml.Style.

Definition at line 459 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.bgColor, org.openoffice.xmerge.converter.xml.TextStyle.fontColor, org.openoffice.xmerge.converter.xml.TextStyle.fontName, org.openoffice.xmerge.converter.xml.TextStyle.sizeInPoints, org.openoffice.xmerge.converter.xml.TextStyle.TextStyle(), and org.openoffice.xmerge.converter.xml.TextStyle.values.

◆ parseColorString()

Color org.openoffice.xmerge.converter.xml.TextStyle.parseColorString ( String  value)
inlineprivate

Parse a color specification of the form #rrggbb

Parameters
valueColor specification to parse.
Returns
The Color associated the value.

Definition at line 154 of file TextStyle.java.

References Color, org.openoffice.xmerge.util.Debug.ERROR, Integer, org.openoffice.xmerge.util.Debug.log(), and value.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute().

◆ toCSV()

static String org.openoffice.xmerge.converter.xml.TextStyle.toCSV ( String  value)
inlinestaticprivate

Private function to return the value as an element in a Comma Separated Value (CSV) format.

Parameters
valueThe value to format.
Returns
The formatted value.

Definition at line 383 of file TextStyle.java.

References String, and value.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.dumpCSV(), and org.openoffice.xmerge.converter.xml.TextStyle.dumpHdr().

◆ toLastCSV()

static String org.openoffice.xmerge.converter.xml.TextStyle.toLastCSV ( String  value)
inlinestaticprivate

Private function to return the value as a last element in a Comma Separated Value (CSV) format.

Parameters
valueThe value to format.
Returns
The formatted value.

Definition at line 398 of file TextStyle.java.

References String, and value.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.dumpCSV(), and org.openoffice.xmerge.converter.xml.TextStyle.dumpHdr().

◆ turnAttributesOff()

void org.openoffice.xmerge.converter.xml.TextStyle.turnAttributesOff ( int  flags)
inlineprivate

Set one or more text attributes to off.

Parameters
flagsThe flag values to set off.

Definition at line 370 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.mask, and org.openoffice.xmerge.converter.xml.TextStyle.values.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute().

◆ turnAttributesOn()

void org.openoffice.xmerge.converter.xml.TextStyle.turnAttributesOn ( int  flags)
inlineprivate

Set one or more text attributes to on.

Parameters
flagsFlag values to set on.

Definition at line 360 of file TextStyle.java.

References org.openoffice.xmerge.converter.xml.TextStyle.mask, and org.openoffice.xmerge.converter.xml.TextStyle.values.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.handleAttribute().

◆ writeAttributes()

void org.openoffice.xmerge.converter.xml.TextStyle.writeAttributes ( Element  node)
inlineprivate

Member Data Documentation

◆ bgColor

Color org.openoffice.xmerge.converter.xml.TextStyle.bgColor = null
private

◆ BOLD

final static int org.openoffice.xmerge.converter.xml.TextStyle.BOLD = 0x01
staticprivate

◆ fontColor

Color org.openoffice.xmerge.converter.xml.TextStyle.fontColor = null
private

◆ fontName

String org.openoffice.xmerge.converter.xml.TextStyle.fontName = null
private

◆ ignored

String [] org.openoffice.xmerge.converter.xml.TextStyle.ignored
staticprivate
Initial value:
= {
"style:text-autospace", "style:text-underline-color",
"fo:margin-left", "fo:margin-right", "fo:text-indent",
"fo:margin-top", "fo:margin-bottom", "text:line-number",
"text:number-lines", "style:country-asian",
"style:font-size-asian", "style:font-name-complex",
"style:language-complex", "style:country-complex",
"style:font-size-complex", "style:punctuation-wrap",
"fo:language", "fo:country",
"style:font-name-asian", "style:language-asian",
"style:line-break", "fo:keep-with-next"
}

Definition at line 546 of file TextStyle.java.

Referenced by org.openoffice.xmerge.converter.xml.TextStyle.isIgnored().

◆ ITALIC

final static int org.openoffice.xmerge.converter.xml.TextStyle.ITALIC = 0x02
staticprivate

◆ mask

int org.openoffice.xmerge.converter.xml.TextStyle.mask = 0
private

◆ sizeInPoints

int org.openoffice.xmerge.converter.xml.TextStyle.sizeInPoints = 0
private

◆ STRIKETHRU

final static int org.openoffice.xmerge.converter.xml.TextStyle.STRIKETHRU = 0x08
staticprivate

◆ SUBSCRIPT

final static int org.openoffice.xmerge.converter.xml.TextStyle.SUBSCRIPT = 0x20
staticprivate

◆ SUPERSCRIPT

final static int org.openoffice.xmerge.converter.xml.TextStyle.SUPERSCRIPT = 0x10
staticprivate

◆ UNDERLINE

final static int org.openoffice.xmerge.converter.xml.TextStyle.UNDERLINE = 0x04
staticprivate

◆ values

int org.openoffice.xmerge.converter.xml.TextStyle.values = 0
private

The documentation for this class was generated from the following file: