public MasterPage getMasterPage(String sName) { return (MasterPage) masterPage.getStyle(sName); }
private void loadStylesFromDOM(Node node, boolean bAllParagraphsAreSoft) { // node should be office:master-styles, office:styles or office:automatic-styles boolean bAutomatic = XMLString.OFFICE_AUTOMATIC_STYLES.equals(node.getNodeName()); if (node.hasChildNodes()) { NodeList nl = node.getChildNodes(); int nLen = nl.getLength(); for (int i = 0; i < nLen; i++) { Node child = nl.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { if (child.getNodeName().equals(XMLString.STYLE_STYLE)) { String sFamily = Misc.getAttribute(child, XMLString.STYLE_FAMILY); if ("text".equals(sFamily)) { text.loadStyleFromDOM(child, bAutomatic); } else if ("paragraph".equals(sFamily)) { par.loadStyleFromDOM(child, bAutomatic && !bAllParagraphsAreSoft); } else if ("section".equals(sFamily)) { section.loadStyleFromDOM(child, bAutomatic); } else if ("table".equals(sFamily)) { table.loadStyleFromDOM(child, bAutomatic); } else if ("table-column".equals(sFamily)) { column.loadStyleFromDOM(child, bAutomatic); } else if ("table-row".equals(sFamily)) { row.loadStyleFromDOM(child, bAutomatic); } else if ("table-cell".equals(sFamily)) { cell.loadStyleFromDOM(child, bAutomatic); } else if ("graphics".equals(sFamily)) { frame.loadStyleFromDOM(child, bAutomatic); } else if ("graphic".equals(sFamily)) { // oasis frame.loadStyleFromDOM(child, bAutomatic); } else if ("presentation".equals(sFamily)) { presentation.loadStyleFromDOM(child, bAutomatic); } else if ("drawing-page".equals(sFamily)) { // Bug in OOo 1.x: The same name may be used for a real and an automatic style... if (drawingPage.getStyle(Misc.getAttribute(child, XMLString.STYLE_NAME)) == null) { drawingPage.loadStyleFromDOM(child, bAutomatic); } } } else if (child.getNodeName().equals(XMLString.STYLE_PAGE_MASTER)) { // old pageLayout.loadStyleFromDOM(child, bAutomatic); } else if (child.getNodeName().equals(XMLString.STYLE_PAGE_LAYOUT)) { // oasis pageLayout.loadStyleFromDOM(child, bAutomatic); } else if (child.getNodeName().equals(XMLString.STYLE_MASTER_PAGE)) { masterPage.loadStyleFromDOM(child, bAutomatic); if (firstMasterPage == null) { firstMasterPage = (MasterPage) masterPage.getStyle(Misc.getAttribute(child, XMLString.STYLE_NAME)); } } else if (child.getNodeName().equals(XMLString.TEXT_LIST_STYLE)) { list.loadStyleFromDOM(child, bAutomatic); } else if (child.getNodeName().equals(XMLString.TEXT_OUTLINE_STYLE)) { outline.loadStyleFromDOM(child); } else if (child.getNodeName().equals(XMLString.STYLE_DEFAULT_STYLE)) { String sFamily = Misc.getAttribute(child, XMLString.STYLE_FAMILY); if ("paragraph".equals(sFamily)) { StyleWithProperties defaultPar = new StyleWithProperties(); defaultPar.loadStyleFromDOM(child); par.setDefaultStyle(defaultPar); } else if ("graphics".equals(sFamily) || "graphic".equals(sFamily)) { // oasis: no s StyleWithProperties defaultFrame = new StyleWithProperties(); defaultFrame.loadStyleFromDOM(child); frame.setDefaultStyle(defaultFrame); } else if ("table-cell".equals(sFamily)) { StyleWithProperties defaultCell = new StyleWithProperties(); defaultCell.loadStyleFromDOM(child); cell.setDefaultStyle(defaultCell); } } } } } }
public ListStyle getListStyle(String sName) { return (ListStyle) list.getStyle(sName); }
public PageLayout getPageLayout(String sName) { return (PageLayout) pageLayout.getStyle(sName); }
public StyleWithProperties getPresentationStyle(String sName) { return (StyleWithProperties) presentation.getStyle(sName); }
public StyleWithProperties getDrawingPageStyle(String sName) { return (StyleWithProperties) drawingPage.getStyle(sName); }
public StyleWithProperties getCellStyle(String sName) { return (StyleWithProperties) cell.getStyle(sName); }
public StyleWithProperties getFrameStyle(String sName) { return (StyleWithProperties) frame.getStyle(sName); }
public StyleWithProperties getColumnStyle(String sName) { return (StyleWithProperties) column.getStyle(sName); }
public StyleWithProperties getRowStyle(String sName) { return (StyleWithProperties) row.getStyle(sName); }
public StyleWithProperties getTableStyle(String sName) { return (StyleWithProperties) table.getStyle(sName); }
public StyleWithProperties getSectionStyle(String sName) { return (StyleWithProperties) section.getStyle(sName); }
public StyleWithProperties getParStyle(String sName) { return (StyleWithProperties) par.getStyle(sName); }
public StyleWithProperties getTextStyle(String sName) { return (StyleWithProperties) text.getStyle(sName); }
/** * Get a specific font declaration * * @param sName the name of the font declaration * @return a <code>FontDeclaration</code> representing the font */ public FontDeclaration getFontDeclaration(String sName) { return (FontDeclaration) font.getStyle(sName); }