本文整理汇总了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;
}
示例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();
}
示例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);
}
示例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);
}
示例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());
}
示例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
}
示例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
}
示例8: fillStyle
void KoColorBackground::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
KoOdfGraphicStyles::saveOdfFillStyle(style, context.mainStyles(), QBrush(d->color, d->style));
}