org.odftoolkit.simple.style
Class MasterPage

java.lang.Object
  extended by org.odftoolkit.simple.style.MasterPage

public class MasterPage
extends Object

This class represents the master page style settings. It provides methods to access page layout styles. More functions will be added latter.

This class is a corresponding high level class for element "style:master-page". It provides methods to access the attributes and children of "style:master-page".

Since:
0.8

Method Summary
 double getFootnoteMaxHeight()
          Get the footnote max height of the the PageLayoutProperties referenced by this master page.
 String getFootnoteSepAdjustment()
          Get the way in which a footnote separator line aligned to a page, which is set by the PageLayoutProperties referenced by this master page.
 String getFootnoteSepColor()
          Get the color of a footnote separator which is set by the PageLayoutProperties referenced by this master page.
 double getFootnoteSepDistanceAfterSep()
          Get the distance between a footnote separator and the footnote area, which is set by the PageLayoutProperties referenced by this master page.
 double getFootnoteSepDistanceBeforeSep()
          Get the distance between the text area and the footnote separator, which is set by the PageLayoutProperties referenced by this master page.
 String getFootnoteSepLineStyle()
          Get the line style of a footnote separator which is set by the PageLayoutProperties referenced by this master page.
 double getFootnoteSepThickness()
          Get the thickness of a footnote separator which is set by the PageLayoutProperties referenced by this master page.
 double getFootnoteSepWidth()
          Get the real width of a footnote separator which is set by the PageLayoutProperties referenced by this master page.
 double getMarginBottom()
          Get the bottom margin of the PageLayoutProperties referenced by this master page.
 double getMarginLeft()
          Get the left margin of the PageLayoutProperties referenced by this master page.
 double getMarginRight()
          Get the right margin of the PageLayoutProperties referenced by this master page.
 double getMarginTop()
          Get the top margin of the PageLayoutProperties referenced by this master page.
 String getName()
          Get the name of this master page.
 String getNumberFormat()
          Get the number format of the the PageLayoutProperties referenced by this master page.
static MasterPage getOrCreateMasterPage(Document doc, String name)
          Return a master page according to its name and its document.
 double getPageHeight()
          Get the page height of the the PageLayoutProperties referenced by this master page.
 double getPageWidth()
          Get the page width of the the PageLayoutProperties referenced by this master page.
 String getPrintOrientation()
          Get the print orientation of the the PageLayoutProperties referenced by this master page.
 String getWritingMode()
          Get the writing mode of the the PageLayoutProperties referenced by this master page.
 void setFootnoteMaxHeight(double height)
          Set the footnote max height of the PageLayoutProperties referenced by this master page.
 void setFootnoteSepProperties(StyleTypeDefinitions.AdjustmentStyle adjustment, Color color, double distanceAfterSep, double distanceBeforeSep, StyleTypeDefinitions.LineStyle lineStyle, Percent width, double thickness)
          Set the foot note separator properties of the PageLayoutProperties referenced by this master page.
 void setMargins(double marginTop, double marginBottom, double marginLeft, double marginRight)
          Set the margins of the PageLayoutProperties referenced by this master page.
 void setNumberFormat(String format)
          Set the number format of the PageLayoutProperties referenced by this master page.
 void setPageHeight(double pageHeight)
          Set the page height of the PageLayoutProperties referenced by this master page.
 void setPageWidth(double pageWidth)
          Set the page width of the PageLayoutProperties referenced by this master page.
 void setPrintOrientation(StyleTypeDefinitions.PrintOrientation orientation)
          Set the print orientation of the PageLayoutProperties referenced by this master page.
 void setWritingMode(StyleTypeDefinitions.WritingMode mode)
          Set the writing mode of the PageLayoutProperties referenced by this master page.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getOrCreateMasterPage

public static MasterPage getOrCreateMasterPage(Document doc,
                                               String name)
                                        throws Exception
Return a master page according to its name and its document.

If there is no existing master page defined by this name in the document, a new master with this name will be created and returned.

Parameters:
doc - - the document to which the master page belongs.
name - - the name of the master page
Returns:
a master page
Throws:
Exception - if the style DOM cannot be initialized

getName

public String getName()
Get the name of this master page.

This represents the attribute style:name of style:master-page.

Returns:
the style name of this master page.

getMarginTop

public double getMarginTop()
Get the top margin of the PageLayoutProperties referenced by this master page.

Returns:
the top margin (in Millimeter)

getMarginRight

public double getMarginRight()
Get the right margin of the PageLayoutProperties referenced by this master page.

Returns:
the right margin (in Millimeter)

getMarginLeft

public double getMarginLeft()
Get the left margin of the PageLayoutProperties referenced by this master page.

Returns:
the left margin (in Millimeter)

getMarginBottom

public double getMarginBottom()
Get the bottom margin of the PageLayoutProperties referenced by this master page.

Returns:
the bottom margin (in Millimeter)

setMargins

public void setMargins(double marginTop,
                       double marginBottom,
                       double marginLeft,
                       double marginRight)
                throws Exception
Set the margins of the PageLayoutProperties referenced by this master page.

If the margin size is set to zero, the corresponding margin definition will be removed.

Parameters:
marginTop - the size of the top margin (in Millimeter)
marginBottom - the size of the bottom margin (in Millimeter)
marginLeft - the size of the left margin (in Millimeter)
marginRight - the size of the right margin (in Millimeter)
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getPageWidth

public double getPageWidth()
Get the page width of the the PageLayoutProperties referenced by this master page.

Returns:
the size of page width (in Millimeter)

setPageWidth

public void setPageWidth(double pageWidth)
                  throws Exception
Set the page width of the PageLayoutProperties referenced by this master page.

If the size is set to zero, the page width definition will be removed.

Parameters:
pageWidth - the size of the page width (in Millimeter)
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getPageHeight

public double getPageHeight()
Get the page height of the the PageLayoutProperties referenced by this master page.

Returns:
the size of page height (in Millimeter)

setPageHeight

public void setPageHeight(double pageHeight)
                   throws Exception
Set the page height of the PageLayoutProperties referenced by this master page.

If the size is set to zero, the page height definition will be removed.

Parameters:
pageHeight - the size of the page height (in Millimeter)
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getNumberFormat

public String getNumberFormat()
Get the number format of the the PageLayoutProperties referenced by this master page.

Returns:
the value of number format

setNumberFormat

public void setNumberFormat(String format)
                     throws Exception
Set the number format of the PageLayoutProperties referenced by this master page.

Parameters:
format - specify the number format. The values of the style:num-format attribute are 1, i, I, string, an empty string, a or A.
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getPrintOrientation

public String getPrintOrientation()
Get the print orientation of the the PageLayoutProperties referenced by this master page.

Returns:
the value of print orientation

setPrintOrientation

public void setPrintOrientation(StyleTypeDefinitions.PrintOrientation orientation)
                         throws Exception
Set the print orientation of the PageLayoutProperties referenced by this master page.

If the parameter orientation is null, the print orientation definition will be removed.

Parameters:
orientation - - the print orientation
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getWritingMode

public String getWritingMode()
Get the writing mode of the the PageLayoutProperties referenced by this master page.

Returns:
the value of writing mode

setWritingMode

public void setWritingMode(StyleTypeDefinitions.WritingMode mode)
                    throws Exception
Set the writing mode of the PageLayoutProperties referenced by this master page.

Parameters:
mode - - writing mode
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getFootnoteMaxHeight

public double getFootnoteMaxHeight()
Get the footnote max height of the the PageLayoutProperties referenced by this master page.

Returns:
the value of footnote max height

setFootnoteMaxHeight

public void setFootnoteMaxHeight(double height)
                          throws Exception
Set the footnote max height of the PageLayoutProperties referenced by this master page.

Parameters:
height - - the max height of a footnote area
Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.

getFootnoteSepAdjustment

public String getFootnoteSepAdjustment()
Get the way in which a footnote separator line aligned to a page, which is set by the PageLayoutProperties referenced by this master page.

Returns:
the adjustment of a footnote separator line

getFootnoteSepColor

public String getFootnoteSepColor()
Get the color of a footnote separator which is set by the PageLayoutProperties referenced by this master page.

Returns:
the color of a footnote separator line

getFootnoteSepDistanceAfterSep

public double getFootnoteSepDistanceAfterSep()
Get the distance between a footnote separator and the footnote area, which is set by the PageLayoutProperties referenced by this master page.

Returns:
the distance after a footnote separator line

getFootnoteSepDistanceBeforeSep

public double getFootnoteSepDistanceBeforeSep()
Get the distance between the text area and the footnote separator, which is set by the PageLayoutProperties referenced by this master page.

Returns:
the distance before a footnote separator line

getFootnoteSepLineStyle

public String getFootnoteSepLineStyle()
Get the line style of a footnote separator which is set by the PageLayoutProperties referenced by this master page.

Returns:
the line style of a footnote separator line

getFootnoteSepWidth

public double getFootnoteSepWidth()
Get the real width of a footnote separator which is set by the PageLayoutProperties referenced by this master page.

Returns:
the real width of a footnote separator line

getFootnoteSepThickness

public double getFootnoteSepThickness()
Get the thickness of a footnote separator which is set by the PageLayoutProperties referenced by this master page.

Returns:
the thickness of a footnote separator line

setFootnoteSepProperties

public void setFootnoteSepProperties(StyleTypeDefinitions.AdjustmentStyle adjustment,
                                     Color color,
                                     double distanceAfterSep,
                                     double distanceBeforeSep,
                                     StyleTypeDefinitions.LineStyle lineStyle,
                                     Percent width,
                                     double thickness)
                              throws Exception
Set the foot note separator properties of the PageLayoutProperties referenced by this master page.

Throws:
Exception - if the corresponding StylePageLayoutElement cannot be accessed for write.
See Also:
PageLayoutProperties#setFootnoteSepProperties(AdjustmentStyle, Color, double, double, LineStyle, Percent, double)


Copyright © 2010-2017 The Apache Software Foundation. All Rights Reserved.