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


C++ KoShapeSavingContext类代码示例

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


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

示例1: saveOdf

bool KoTextInlineRdf::saveOdf(KoShapeSavingContext &context, KoXmlWriter *writer)
{
    kDebug(30015) << " this:" << (void*)this << " xmlid:" << d->id;
    QString oldID = d->id;
    KoSharedSavingData *sharedData = context.sharedData(KOTEXT_SHARED_SAVING_ID);
    KoTextSharedSavingData *textSharedData = 0;
    if (sharedData) {
        textSharedData = dynamic_cast<KoTextSharedSavingData *>(sharedData);
    }
    QString newID = createXmlId(writer);
    if (KoTextSharedSavingData *sharedData =
            dynamic_cast<KoTextSharedSavingData *>(context.sharedData(KOTEXT_SHARED_SAVING_ID))) {
        sharedData->addRdfIdMapping(oldID, newID);
    }
    kDebug(30015) << "oldID:" << oldID << " newID:" << newID;
    writer->addAttribute("xml:id", newID);
    if (!d->subject.isEmpty()) {
        writer->addAttribute("xhtml:about", d->subject);
    }
    if (!d->predicate.isEmpty()) {
        writer->addAttribute("xhtml:property", d->predicate);
    }
    if (!d->dt.isEmpty()) {
        writer->addAttribute("xhtml:datatype", d->dt);
    }
    if (d->isObjectAttriuteUsed) {
        writer->addAttribute("xhtml:content", d->object);
    }
    kDebug(30015) << "done..";
    return true;
}
开发者ID:KDE,项目名称:calligra-history,代码行数:31,代码来源:KoTextInlineRdf.cpp

示例2: saveOdf

void EnhancedPathHandle::saveOdf(KoShapeSavingContext &context) const
{
    if (!hasPosition()) {
        return;
    }
    context.xmlWriter().startElement("draw:handle");
    context.xmlWriter().addAttribute("draw:handle-position", m_positionX->toString() + ' ' + m_positionY->toString());
    if (isPolar()) {
        context.xmlWriter().addAttribute("draw:handle-polar", m_polarX->toString() + ' ' + m_polarY->toString());
        if (m_minRadius) {
            context.xmlWriter().addAttribute("draw:handle-radius-range-minimum", m_minRadius->toString());
        }
        if (m_maxRadius) {
            context.xmlWriter().addAttribute("draw:handle-radius-range-maximum", m_maxRadius->toString());
        }
    } else {
        if (m_minimumX) {
            context.xmlWriter().addAttribute("draw:handle-range-x-minimum", m_minimumX->toString());
        }
        if (m_maximumX) {
            context.xmlWriter().addAttribute("draw:handle-range-x-maximum", m_maximumX->toString());
        }
        if (m_minimumY) {
            context.xmlWriter().addAttribute("draw:handle-range-y-minimum", m_minimumY->toString());
        }
        if (m_maximumY) {
            context.xmlWriter().addAttribute("draw:handle-range-y-maximum", m_maximumY->toString());
        }
    }
    context.xmlWriter().endElement(); // draw:handle
}
开发者ID:ChrisJong,项目名称:krita,代码行数:31,代码来源:EnhancedPathHandle.cpp

示例3: 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

示例4: QString

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

示例5: saveOdf

void VideoShape::saveOdf(KoShapeSavingContext &context) const
{
    // make sure we have a valid image data pointer before saving
    VideoData *videoData = qobject_cast<VideoData*>(userData());
    if (videoData == 0)
        return;

    KoXmlWriter &writer = context.xmlWriter();

    writer.startElement("draw:frame");
    saveOdfAttributes(context, OdfAllAttributes);
    writer.startElement("draw:plugin");
    // In the spec, only the xlink:href attribute is marked as mandatory, cool :)
    QString name = videoData->tagForSaving(m_videoCollection->saveCounter);
    writer.addAttribute("xlink:type", "simple");
    writer.addAttribute("xlink:show", "embed");
    writer.addAttribute("xlink:actuate", "onLoad");
    writer.addAttribute("xlink:href", name);
    writer.addAttribute("draw:mime-type", "application/vnd.sun.star.media");
    writer.endElement(); // draw:plugin
    saveOdfCommonChildElements(context);
    writer.endElement(); // draw:frame

    context.addDataCenter(m_videoCollection);
}
开发者ID:UIKit0,项目名称:calligra,代码行数:25,代码来源:VideoShape.cpp

示例6: 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

示例7: saveOdf

void KoFormulaShape::saveOdf( KoShapeSavingContext& context ) const
{
    // FIXME: Add saving of embedded document if m_isInline is false;

    kDebug() <<"Saving ODF in Formula";
    KoXmlWriter& writer = context.xmlWriter();
    writer.startElement("draw:frame");
    saveOdfAttributes(context, OdfAllAttributes);
    writer.startElement( "draw:object" );
    // TODO add some namespace magic to avoid adding "math:" namespace everywhere
    formulaData()->formulaElement()->writeMathML( &context.xmlWriter() );
    writer.endElement(); // draw:object
    writer.endElement(); // draw:frame
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:14,代码来源:KoFormulaShape.cpp

示例8: saveOdf

void Legend::saveOdf(KoShapeSavingContext &context) const
{
    KoXmlWriter &bodyWriter = context.xmlWriter();

    bodyWriter.startElement("chart:legend");
    saveOdfAttributes(context, OdfPosition);

    // Legend specific attributes
    QString lp = PositionToString(d->position);
    if (!lp.isEmpty()) {
        bodyWriter.addAttribute("chart:legend-position", lp);
    }
    QString lalign;  // FIXME: This string is always empty.  What gives?
    if (!lalign.isEmpty()) {
        bodyWriter.addAttribute("chart:legend-align", lalign);
    }

    // Legend style FIXME: Check if more styling then just the font goes here.
    KoGenStyle style(KoGenStyle::ChartAutoStyle, "chart", 0);
    saveOdfFont(style, d->font, d->fontColor);
    bodyWriter.addAttribute("chart:style-name", saveStyle(style, context));

    QString  lexpansion;
    switch (expansion()) {
    case WideLegendExpansion:      lexpansion = "wide";      break;
    case HighLegendExpansion:      lexpansion = "high";      break;
    case BalancedLegendExpansion:  lexpansion = "balanced";  break;
    };
    bodyWriter.addAttribute("style:legend-expansion", lexpansion);

    if (!title().isEmpty())
        bodyWriter.addAttribute("office:title", title());

    bodyWriter.endElement(); // chart:legend
}
开发者ID:UIKit0,项目名称:calligra,代码行数:35,代码来源:Legend.cpp

示例9:

void Object3D::saveObjectOdf(KoShapeSavingContext &context) const
{
    if (!m_transform3D.isEmpty()) {
        KoXmlWriter &writer = context.xmlWriter();
        writer.addAttribute("dr3d:transform", m_transform3D);
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:7,代码来源:Object3D.cpp

示例10: saveOdf

void RectangleShape::saveOdf(KoShapeSavingContext & context) const
{
    if (isParametricShape()) {
        context.xmlWriter().startElement("draw:rect");
        saveOdfAttributes(context, OdfAllAttributes);
        if (m_cornerRadiusX > 0 && m_cornerRadiusY > 0) {
            context.xmlWriter().addAttributePt("svg:rx", m_cornerRadiusX * (0.5*size().width()) / 100.0);
            context.xmlWriter().addAttributePt("svg:ry", m_cornerRadiusY * (0.5*size().height()) / 100.0);
        }
        saveOdfCommonChildElements(context);
        saveText(context);
        context.xmlWriter().endElement();
    } else {
        KoPathShape::saveOdf(context);
    }
}
开发者ID:KDE,项目名称:calligra,代码行数:16,代码来源:RectangleShape.cpp

示例11: saveOdf

void KPrSoundEventAction::saveOdf( KoShapeSavingContext & context ) const
{
    context.xmlWriter().startElement( "presentation:event-listener" );
    context.xmlWriter().addAttribute( "script:event-name", "dom:click" );
    context.xmlWriter().addAttribute( "presentation:action", "sound" );

    //<presentation:sound xlink:href="/opt/kde4t/share/sounds/KDE-Im-Contact-In.ogg" xlink:type="simple" xlink:show="new" xlink:actuate="onRequest"/>
    context.xmlWriter().startElement( "presentation:sound" );
    context.xmlWriter().addAttribute( "xlink:href", m_soundData->tagForSaving() );
    context.xmlWriter().addAttribute( "xlink:type", "simple" );
    context.xmlWriter().addAttribute( "xlink:actuate", "onRequest" );
    context.xmlWriter().endElement();

    context.xmlWriter().endElement();

    context.addDataCenter( m_soundData->soundCollection() );
}
开发者ID:crayonink,项目名称:calligra-2,代码行数:17,代码来源:KPrSoundEventAction.cpp

示例12: 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

示例13: 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

示例14: d

KoTextWriter::KoTextWriter(KoShapeSavingContext &context, KoDocumentRdfBase *rdfData)
    : d(new Private(context))
{
    d->rdfData = rdfData;
    KoSharedSavingData *sharedData = context.sharedData(KOTEXT_SHARED_SAVING_ID);
    if (sharedData) {
        d->sharedData = dynamic_cast<KoTextSharedSavingData *>(sharedData);
    }

    if (!d->sharedData) {
        d->sharedData = new KoTextSharedSavingData();
        if (!sharedData) {
            context.addSharedData(KOTEXT_SHARED_SAVING_ID, d->sharedData);
        } else {
            kWarning(32500) << "A different type of sharedData was found under the" << KOTEXT_SHARED_SAVING_ID;
            Q_ASSERT(false);
        }
    }
}
开发者ID:abhishekmurthy,项目名称:Calligra,代码行数:19,代码来源:KoTextWriter.cpp

示例15: saveOdf

void KPrPlaceholderShape::saveOdf( KoShapeSavingContext & context ) const
{
    KoXmlWriter & writer = context.xmlWriter();
    writer.startElement( "draw:frame" );
    saveOdfAttributes( context, OdfAllAttributes );
    if ( m_strategy ) {
        m_strategy->saveOdf( context );
    }
    saveOdfCommonChildElements( context );
    writer.endElement(); // draw:frame
}
开发者ID:TheTypoMaster,项目名称:calligra,代码行数:11,代码来源:KPrPlaceholderShape.cpp


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