Examples of OdfOfficeStyles


Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

  /** Returns the current Locale for the OdfStyleProperty of the corresponding UnicodeGroup */
  private Locale getDefaultLanguageByProperty(OdfStyleProperty countryProp,
      OdfStyleProperty languageProp) throws Exception {
    String lang = null, ctry = null;

    OdfOfficeStyles styles = getStylesDom().getOfficeStyles();

    // get language and country setting from default style setting for
    // paragraph
    OdfDefaultStyle defaultStyle = styles.getDefaultStyle(OdfStyleFamily.Paragraph);
    if (defaultStyle != null) {
      if (defaultStyle.hasProperty(countryProp)
          && defaultStyle.hasProperty(languageProp)) {
        ctry = defaultStyle.getProperty(countryProp);
        lang = defaultStyle.getProperty(languageProp);
        return new Locale(lang, ctry);
      }
    }
    // if no default style setting for paragraph
    // get language and country setting from other default style settings
    Iterable<OdfDefaultStyle> defaultStyles = styles.getDefaultStyles();
    Iterator<OdfDefaultStyle> itera = defaultStyles.iterator();
    while (itera.hasNext()) {
      OdfDefaultStyle style = itera.next();
      if (style.hasProperty(countryProp)
          && style.hasProperty(languageProp)) {
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

   *            - an instance of Locale that the default language and country
   *            will be set to.
   * @throws Exception
   */
  private void setDefaultWesternLanguage(Locale locale) throws Exception {
    OdfOfficeStyles styles = getStylesDom().getOfficeStyles();
    Iterable<OdfDefaultStyle> defaultStyles = styles.getDefaultStyles();
    if (defaultStyles != null) {
      Iterator<OdfDefaultStyle> itera = defaultStyles.iterator();
      while (itera.hasNext()) {
        OdfDefaultStyle style = itera.next();
        if (style.getFamily().getProperties().contains(
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

   *            - an instance of Locale that the default Asian language and
   *            country will be set to.
   * @throws Exception
   */
  private void setDefaultAsianLanguage(Locale locale) throws Exception {
    OdfOfficeStyles styles = getStylesDom().getOfficeStyles();
    Iterable<OdfDefaultStyle> defaultStyles = styles.getDefaultStyles();
    if (defaultStyles != null) {
      Iterator<OdfDefaultStyle> itera = defaultStyles.iterator();
      while (itera.hasNext()) {
        OdfDefaultStyle style = itera.next();
        if (style.getFamily().getProperties().contains(
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

   *            - an instance of Locale that the default complex language and
   *            country will be set to.
   * @throws Exception
   */
  private void setDefaultComplexLanguage(Locale locale) throws Exception {
    OdfOfficeStyles styles = getStylesDom().getOfficeStyles();
    Iterable<OdfDefaultStyle> defaultStyles = styles.getDefaultStyles();
    if (defaultStyles != null) {
      Iterator<OdfDefaultStyle> itera = defaultStyles.iterator();
      while (itera.hasNext()) {
        OdfDefaultStyle style = itera.next();
        if (style.getFamily().getProperties().contains(
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

  public ImageDecorator(Document doc, URI imageUri) {
    OdfContentDom contentDocument;
    try {
      contentDocument = doc.getContentDom();
      styles = contentDocument.getAutomaticStyles();
      OdfOfficeStyles documentStyles = doc.getDocumentStyles();
      listStyle = styles.getListStyle(DEFAULT_NAME);
      // create image style
      if (listStyle == null) {
        listStyle = styles.newListStyle();
        String packagePath = null;
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

      }     
      if (autoStyles != null) {
        style = autoStyles.getListStyle(listName);
      }
      if (style == null) {
        OdfOfficeStyles styles = ((OdfSchemaDocument) fileDom.getDocument()).getDocumentStyles();
        if (styles != null) {
          style = styles.getListStyle(listName);
        }
      }
    } else {
      // if no style is specified at this particular list element, we
      // ask the parent list (if any)
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

      OdfStylesDom stylesDom = odfdoc.getStylesDom();
      Assert.assertNotNull(stylesDom);

      // test styles.xml:styles
      OdfOfficeStyles styles = odfdoc.getDocumentStyles();
      Assert.assertNotNull(styles);

      Assert.assertNotNull(styles.getDefaultStyle(OdfStyleFamily.Graphic));
      Assert.assertNotNull(styles.getDefaultStyle(OdfStyleFamily.Paragraph));
      Assert.assertNotNull(styles.getDefaultStyle(OdfStyleFamily.Table));
      Assert.assertNotNull(styles.getDefaultStyle(OdfStyleFamily.TableRow));

      OdfStyle style = styles.getStyle("Standard", OdfStyleFamily.Paragraph);
      Assert.assertNotNull(style);
      Assert.assertEquals(style.getStyleClassAttribute(), "text");

      style = styles.getStyle("List", OdfStyleFamily.Paragraph);
      Assert.assertNotNull(style);
      Assert.assertEquals(style.getProperty(StyleTextPropertiesElement.FontNameComplex), "Tahoma1");
      Assert.assertTrue(style.hasProperty(StyleTextPropertiesElement.FontNameComplex));
      Assert.assertFalse(style.hasProperty(StyleTextPropertiesElement.FontNameAsian));

      Assert.assertNull(styles.getStyle("foobar", OdfStyleFamily.Chart));

      // test styles.xml:automatic-styles
      OdfOfficeAutomaticStyles autostyles = stylesDom.getAutomaticStyles();
      Assert.assertNotNull(autostyles);
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

  }

  @Test
  public void testStyles() {
    try {
      OdfOfficeStyles officeStyles = odfdoc.getDocumentStyles();
      Assert.assertNotNull(officeStyles);

      Assert.assertNotNull(officeStyles.getGradient("Linear_20_blue_2f_white"));
      testIterator(DrawGradientElement.class, officeStyles.getGradients().iterator(), 1);

      Assert.assertNotNull(officeStyles.getMarker("Arrow"));
      testIterator(DrawMarkerElement.class, officeStyles.getMarker().iterator(), 1);

      Assert.assertNotNull(officeStyles.getHatch("Black_20_0_20_Degrees"));
      testIterator(DrawHatchElement.class, officeStyles.getHatches().iterator(), 1);

      Assert.assertNotNull(officeStyles.getFillImage("Aqua"));
      testIterator(DrawFillImageElement.class, officeStyles.getFillImages().iterator(), 1);

      // check for some styles
      Assert.assertNotNull(officeStyles.getDefaultStyle(OdfStyleFamily.Graphic));
      Assert.assertNotNull(officeStyles.getStyle("standard", OdfStyleFamily.Graphic));
      Assert.assertNotNull(officeStyles.getStyle("master-name-1-outline1", OdfStyleFamily.Presentation));

      Iterator<OdfStyle> style_iter = officeStyles.getStylesForFamily(OdfStyleFamily.Presentation).iterator();
      Assert.assertNotNull(style_iter);
      Assert.assertTrue(style_iter.hasNext());
    } catch (Exception e) {
      Logger.getLogger(PresentationTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
      Assert.fail(e.getMessage());
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

  public OutLineDecorator(Document doc) {
    OdfContentDom contentDocument;
    try {
      contentDocument = doc.getContentDom();
      styles = contentDocument.getAutomaticStyles();
      OdfOfficeStyles documentStyles = doc.getDocumentStyles();
      listStyle = styles.getListStyle(DEFAULT_NAME);
      // create outline style
      if (listStyle == null) {
        listStyle = styles.newListStyle();
        // <style:style style:name="Numbering_20_Symbols"
View Full Code Here

Examples of org.odftoolkit.odfdom.incubator.doc.office.OdfOfficeStyles

      try {
        String textStyleName = listElement.getTextStyleNameAttribute();
        Document doc = (Document) (((OdfFileDom) listElement.getOwnerDocument()).getDocument());
        OdfContentDom contentDocument = doc.getContentDom();
        OdfOfficeAutomaticStyles styles = contentDocument.getAutomaticStyles();
        OdfOfficeStyles documentStyles = doc.getDocumentStyles();
        OdfTextListStyle listStyle = styles.getListStyle(textStyleName);
        if (listStyle == null) {
          listStyle = documentStyles.getListStyle(textStyleName);
        }
        if (listStyle != null) {
          TextListLevelStyleElementBase listLevelStyle = listStyle.getLevel(1);
          if (listLevelStyle instanceof TextListLevelStyleBulletElement) {
            return ListType.BULLET;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.