예제 #1
0
void OdtReaderWikiBackend::outputTextStyle(KoXmlStreamReader &reader,
                                           OdfReaderWikiContext *wikiContext)
{
    KoOdfStyle *style = wikiContext->popStyle();
    KoOdfStyleProperties *styleProperties = style->properties().value("style:text-properties");
    if (!styleProperties) {
        wikiContext->pushStyle(style);
        return;
    }

    // Output italic and bold.
    QString fontWeightProperty = "fo:font-weight";
    QString fontStyleProperty = "fo:font-style";
    if ((styleProperties->attribute(fontWeightProperty) == "bold")
        && (styleProperties->attribute(fontStyleProperty) == "italic"))
    {
        wikiContext->outStream << "'''''";
    } else if (styleProperties->attribute(fontWeightProperty) == "bold") {
        wikiContext->outStream << "'''";
    } else if (styleProperties->attribute(fontStyleProperty) == "italic") {
        wikiContext->outStream << "''";
    }

    QString textPositionProperty = "style:text-position";
    QString textLineThroughProperty = "style:text-line-through-style";
    if (reader.isStartElement()) {
        // Output strikeout text.
        if (styleProperties->attribute(textLineThroughProperty) == "solid") {
            wikiContext->outStream << "<s>";
        }
        // Output sub and super script.
        if (styleProperties->attribute(textPositionProperty) == "sub") {
           wikiContext->outStream << "<sub>";
        }
        else if (styleProperties->attribute(textPositionProperty) == "super") {
            wikiContext->outStream << "<sup>";
        }
    }
    else {
        if (styleProperties->attribute(textLineThroughProperty)== "solid") {
            wikiContext->outStream << "</s>";
        }
        if (styleProperties->attribute(textPositionProperty) == "sub") {
           wikiContext->outStream << "</sub>";
        }
        else if (styleProperties->attribute(textPositionProperty) == "super") {
            wikiContext->outStream << "</sup>";
        }
    }
    wikiContext->pushStyle(style);
}
예제 #2
0
QString KoOdfStyle::property(QString &propertySet, QString &property) const
{
    KoOdfStyleProperties *props = d->properties.value(propertySet, 0);
    if (props)
        return props->attribute(property);
    else
        return QString();
}