当前位置: 首页>>代码示例>>C++>>正文


C++ KoShapeSavingContext::mainStyles方法代码示例

本文整理汇总了C++中KoShapeSavingContext::mainStyles方法的典型用法代码示例。如果您正苦于以下问题:C++ KoShapeSavingContext::mainStyles方法的具体用法?C++ KoShapeSavingContext::mainStyles怎么用?C++ KoShapeSavingContext::mainStyles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KoShapeSavingContext的用法示例。


在下文中一共展示了KoShapeSavingContext::mainStyles方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: saveParagraphStyle

QString KoTextWriter::saveParagraphStyle(const QTextBlockFormat &blockFormat, const QTextCharFormat &charFormat, KoStyleManager * styleManager, KoShapeSavingContext &context)
{
    KoParagraphStyle *defaultParagraphStyle = styleManager->defaultParagraphStyle();
    KoParagraphStyle *originalParagraphStyle = styleManager->paragraphStyle(blockFormat.intProperty(KoParagraphStyle::StyleId));
    if (!originalParagraphStyle)
        originalParagraphStyle = defaultParagraphStyle;

    QString generatedName;
    QString displayName = originalParagraphStyle->name();
    QString internalName = QString(QUrl::toPercentEncoding(displayName, "", " ")).replace('%', '_');

    // we'll convert the blockFormat to a KoParagraphStyle to check for local changes.
    KoParagraphStyle paragStyle(blockFormat, charFormat);
    if (paragStyle == (*originalParagraphStyle)) { // This is the real, unmodified character style.
        // TODO zachmann: this could use the name of the saved style without saving it again
        // therefore we would need to store that information in the saving context
        if (originalParagraphStyle != defaultParagraphStyle) {
            KoGenStyle style(KoGenStyle::ParagraphStyle, "paragraph");
            originalParagraphStyle->saveOdf(style, context);
            generatedName = context.mainStyles().insert(style, internalName, KoGenStyles::DontAddNumberToName);
        }
    } else { // There are manual changes... We'll have to store them then
        KoGenStyle style(KoGenStyle::ParagraphAutoStyle, "paragraph", internalName);
        if (context.isSet(KoShapeSavingContext::AutoStyleInStyleXml))
            style.setAutoStyleInStylesDotXml(true);
        if (originalParagraphStyle) {
            paragStyle.removeDuplicates(*originalParagraphStyle);
            paragStyle.setParentStyle(originalParagraphStyle);
        }
        paragStyle.saveOdf(style, context);
        generatedName = context.mainStyles().insert(style, "P");
    }
    return generatedName;
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:34,代码来源:KoTextWriter.cpp

示例2: saveOdf

void DateVariable::saveOdf(KoShapeSavingContext & context)
{
    // TODO support data-style-name
    KoXmlWriter *writer = &context.xmlWriter();
    if (m_displayType == Time) {
        writer->startElement("text:time", false);
    } else {
        writer->startElement("text:date", false);
    }

    if (!m_definition.isEmpty()) {
        QString styleName = KoOdfNumberStyles::saveOdfDateStyle(context.mainStyles(), m_definition, false);
        writer->addAttribute("style:data-style-name", styleName);
    }

    if (m_type == Fixed) {
        writer->addAttribute("text:fixed", "true");
        // only write as much information as we read: just date/time or datetime
        if (m_displayType == Time) {
            const QString timeValue = (m_valueType == DateTime) ?
                m_datetime.toString(Qt::ISODate) :
                m_datetime.time().toString(Qt::ISODate);
            writer->addAttribute("text:time-value", timeValue);
        } else {
            const QString dateValue = (m_valueType == DateTime) ?
                m_datetime.toString(Qt::ISODate) :
                m_datetime.date().toString(Qt::ISODate);
            writer->addAttribute("text:date-value", dateValue);
        }
    } else {
        writer->addAttribute("text:fixed", "false");
    }
    writer->addTextNode(value());
    writer->endElement();
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:35,代码来源:DateVariable.cpp

示例3: fillStyle

void KoPatternBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
    Q_D(KoPatternBackground);
    if (! d->imageData)
        return;

    switch (d->repeat) {
    case Original:
        style.addProperty("style:repeat", "no-repeat");
        break;
    case Tiled:
        style.addProperty("style:repeat", "repeat");
        break;
    case Stretched:
        style.addProperty("style:repeat", "stretch");
        break;
    }

    if (d->repeat == Tiled) {
        QString refPointId = "top-left";
        switch (d->refPoint) {
        case TopLeft: refPointId = "top-left"; break;
        case Top: refPointId = "top"; break;
        case TopRight: refPointId = "top-right"; break;
        case Left: refPointId = "left"; break;
        case Center: refPointId = "center"; break;
        case Right: refPointId = "right"; break;
        case BottomLeft: refPointId = "bottom-left"; break;
        case Bottom: refPointId = "bottom"; break;
        case BottomRight: refPointId = "bottom-right"; break;
        }
        style.addProperty("draw:fill-image-ref-point", refPointId);
        if (d->refPointOffsetPercent.x() > 0.0)
            style.addProperty("draw:fill-image-ref-point-x", QString("%1%").arg(d->refPointOffsetPercent.x()));
        if (d->refPointOffsetPercent.y() > 0.0)
            style.addProperty("draw:fill-image-ref-point-y", QString("%1%").arg(d->refPointOffsetPercent.y()));
    }

    if (d->repeat != Stretched) {
        QSizeF targetSize = d->targetSize();
        QSizeF imageSize = d->imageData->imageSize();
        if (targetSize.height() != imageSize.height())
            style.addPropertyPt("draw:fill-image-height", targetSize.height());
        if (targetSize.width() != imageSize.width())
            style.addPropertyPt("draw:fill-image-width", targetSize.width());
    }

    KoGenStyle patternStyle(KoGenStyle::FillImageStyle /*no family name*/);
    patternStyle.addAttribute("xlink:show", "embed");
    patternStyle.addAttribute("xlink:actuate", "onLoad");
    patternStyle.addAttribute("xlink:type", "simple");
    patternStyle.addAttribute("xlink:href", context.imageHref(d->imageData));

    QString patternStyleName = context.mainStyles().insert(patternStyle, "picture");
    style.addProperty("draw:fill", "bitmap");
    style.addProperty("draw:fill-image-name", patternStyleName);

    context.addDataCenter(d->imageCollection);
}
开发者ID:IGLOU-EU,项目名称:krita,代码行数:59,代码来源:KoPatternBackground.cpp

示例4: fillStyle

void KoShapeStroke::fillStyle(KoGenStyle &style, KoShapeSavingContext &context) const
{
    QPen pen = d->pen;
    if (d->brush.gradient())
        pen.setBrush(d->brush);
    else
        pen.setColor(d->color);
    KoOdfGraphicStyles::saveOdfStrokeStyle(style, context.mainStyles(), pen);
}
开发者ID:NavyZhao1978,项目名称:QCalligra,代码行数:9,代码来源:KoShapeStroke.cpp

示例5: saveOdf

void TableShape::saveOdf(KoShapeSavingContext & context) const
{
    if (!sheet())
        return;
    const Map* map = sheet()->map();
    // Saving the custom cell styles including the default cell style.
    map->styleManager()->saveOdf(context.mainStyles());

    // Saving the default column style
    KoGenStyle defaultColumnStyle(KoGenStyle::TableColumnStyle, "table-column");
    defaultColumnStyle.addPropertyPt("style:column-width", map->defaultColumnFormat()->width());
    defaultColumnStyle.setDefaultStyle(true);
    context.mainStyles().insert(defaultColumnStyle, "Default", KoGenStyles::DontAddNumberToName);

    // Saving the default row style
    KoGenStyle defaultRowStyle(KoGenStyle::TableRowStyle, "table-row");
    defaultRowStyle.addPropertyPt("style:row-height", map->defaultRowFormat()->height());
    defaultRowStyle.setDefaultStyle(true);
    context.mainStyles().insert(defaultRowStyle, "Default", KoGenStyles::DontAddNumberToName);

    OdfSavingContext tableContext(context);
    sheet()->saveOdf(tableContext);
    tableContext.valStyle.writeStyle(context.xmlWriter());
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:24,代码来源:TableShape.cpp

示例6: saveOdf

void Surface::saveOdf( KoShapeSavingContext &context )
{
    KoXmlWriter &bodyWriter = context.xmlWriter();
    KoGenStyles &mainStyles = context.mainStyles();
    KoGenStyle style = KoGenStyle( KoGenStyle::StyleGraphicAuto, "chart" );

    // Fixme: Also save floor
    bodyWriter.startElement( "chart:wall" );

    QBrush backgroundBrush = d->kdPlane->backgroundAttributes().brush();
    QPen framePen = d->kdPlane->frameAttributes().pen();
    KoOdfGraphicStyles::saveOdfFillStyle( style, mainStyles, backgroundBrush );
    KoOdfGraphicStyles::saveOdfStrokeStyle( style, mainStyles, framePen );

    bodyWriter.addAttribute( "chart:style-name", mainStyles.lookup( style, "ch" ) );

    bodyWriter.endElement(); // chart:wall
}
开发者ID:JeremiasE,项目名称:KFormula,代码行数:18,代码来源:Surface.cpp

示例7: saveOdf

void Surface::saveOdf(KoShapeSavingContext &context, const char *elementName)
{
    KoXmlWriter  &bodyWriter = context.xmlWriter();
    KoGenStyles  &mainStyles = context.mainStyles();
    KoGenStyle    style      = KoGenStyle(KoGenStyle::GraphicAutoStyle, "chart");

    // elementName is chart:floor or chart:wall
    bodyWriter.startElement(elementName);

    QBrush backgroundBrush;
    if (d->kdPlane->backgroundAttributes().isVisible())
        backgroundBrush = d->kdPlane->backgroundAttributes().brush();
    QPen framePen(Qt::NoPen);
    if (d->kdPlane->frameAttributes().isVisible())
        framePen = d->kdPlane->frameAttributes().pen();

    KoOdfGraphicStyles::saveOdfFillStyle(style, mainStyles, backgroundBrush);
    KoOdfGraphicStyles::saveOdfStrokeStyle(style, mainStyles, framePen);

    bodyWriter.addAttribute("chart:style-name", mainStyles.insert(style, "ch"));

    bodyWriter.endElement(); // chart:floor or chart:wall
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:23,代码来源:Surface.cpp

示例8: fillStyle

void KoColorBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
    KoOdfGraphicStyles::saveOdfFillStyle(style, context.mainStyles(), QBrush(d->color, d->style));
}
开发者ID:KDE,项目名称:calligra-history,代码行数:4,代码来源:KoColorBackground.cpp


注:本文中的KoShapeSavingContext::mainStyles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。