incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benson Margulies <ben...@basistech.com>
Subject Re: Looking for help upgrading from older toolkit
Date Wed, 16 Oct 2013 12:33:40 GMT
In the following, all the setAttributeNS calls are broken because that
method no longer exists, and the class OdfFontFace no longer exists.

stylesDom = outputDocument.getStylesDom();

        XPath xpath = XPathFactory.newInstance().newXPath();
        xpath.setNamespaceContext(stylesDom);
        OdfTextProperties defaultTp =
            (OdfTextProperties)
                xpath.

evaluate("/office:document-styles/office:styles/style:default-style/style:text-properties",
                         stylesDom,
                         XPathConstants.NODE);
        if (language == LanguageCode.ARABIC || language ==
LanguageCode.PERSIAN || language == LanguageCode.PUSHTO) {
            defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
"language-complex", language.ISO639_1());
            defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
"font-name-complex", ARABIC_FONT_NAME);
            OdfFontFaceDecls fontFaceDecls = (OdfFontFaceDecls)

xpath.evaluate("/office:document-content/office:font-face-decls",
                                   contentDom,
                                   XPathConstants.NODE);
            OdfFontFace face = new OdfFontFace(contentDom);
            face.setName(ARABIC_FONT_NAME);
            face.setFontFamily(ARABIC_FONT_NAME);
            face.setFontPitch(OdfFontPitchType.VARIABLE);
            face.setFontSize("20");
            fontFaceDecls.appendChild(face);
        }


On Wed, Oct 16, 2013 at 8:21 AM, Benson Margulies <benson@basistech.com>wrote:

> most of the classes in there are not just deprecated but deleted.
> details to follow.
>
> > On Oct 16, 2013, at 4:36 AM, Svante Schubert <svante.schubert@gmail.com>
> wrote:
> >
> > Uncertain what's the problem. Is it some deprecation?
> > In this case it is due to the Simple API, introduced by the IBM team.
> > I still work with the deprecated parts as I am free to change/refactor
> > more radical.
> > Name the problem and I will try to help.
> >
> > Best regards,
> > Svante
> >
> > Am 15.10.2013 21:22, schrieb Benson Margulies:
> >> Can someone help me out with the modern equivalent of the following?
> >>
> >>
> >> OdfTextProperties defaultTp =
> >>            (OdfTextProperties)
> >>                xpath.
> >>
> >>
> evaluate("/office:document-styles/office:styles/style:default-style/style:text-properties",
> >>                         stylesDom,
> >>                         XPathConstants.NODE);
> >>        if (language == LanguageCode.ARABIC || language ==
> >> LanguageCode.PERSIAN || language == LanguageCode.PUSHTO) {
> >>            defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
> >> "language-complex", language.ISO639_1());
> >>            defaultTp.setAttributeNS(OdfDocumentNamespace.STYLE.getUri(),
> >> "font-name-complex", ARABIC_FONT_NAME);
> >>            OdfFontFaceDecls fontFaceDecls = (OdfFontFaceDecls)
> >>
> >> xpath.evaluate("/office:document-content/office:font-face-decls",
> >>                                   contentDom,
> >>                                   XPathConstants.NODE);
> >>            OdfFontFace face = new OdfFontFace(contentDom);
> >>            face.setName(ARABIC_FONT_NAME);
> >>            face.setFontFamily(ARABIC_FONT_NAME);
> >>            face.setFontPitch(OdfFontPitchType.VARIABLE);
> >>            face.setFontSize("20");
> >>            fontFaceDecls.appendChild(face);
> >>        }
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message