本文整理汇总了C++中KoShapeSavingContext::addDataCenter方法的典型用法代码示例。如果您正苦于以下问题:C++ KoShapeSavingContext::addDataCenter方法的具体用法?C++ KoShapeSavingContext::addDataCenter怎么用?C++ KoShapeSavingContext::addDataCenter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoShapeSavingContext
的用法示例。
在下文中一共展示了KoShapeSavingContext::addDataCenter方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: 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);
}
示例3: 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() );
}