本文整理汇总了C++中KoGenStyle::addProperty方法的典型用法代码示例。如果您正苦于以下问题:C++ KoGenStyle::addProperty方法的具体用法?C++ KoGenStyle::addProperty怎么用?C++ KoGenStyle::addProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoGenStyle
的用法示例。
在下文中一共展示了KoGenStyle::addProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveStyle
QString KoTosContainer::saveStyle(KoGenStyle &style, KoShapeSavingContext &context) const
{
Qt::Alignment alignment = textAlignment();
QString verticalAlignment = "top";
Qt::Alignment vAlignment(alignment & Qt::AlignVertical_Mask);
if (vAlignment == Qt::AlignBottom) {
verticalAlignment = "bottom";
} else if (vAlignment == Qt::AlignVCenter || vAlignment == Qt::AlignCenter) {
verticalAlignment = "middle";
}
style.addProperty("draw:textarea-vertical-align", verticalAlignment);
QString horizontalAlignment = "left";
Qt::Alignment hAlignment(alignment & Qt::AlignHorizontal_Mask);
if (hAlignment == Qt::AlignCenter || hAlignment == Qt::AlignHCenter) {
horizontalAlignment = "center";
} else if (hAlignment == Qt::AlignJustify) {
horizontalAlignment = "justify";
} else if (hAlignment == Qt::AlignRight) {
horizontalAlignment = "right";
}
style.addProperty("draw:textarea-horizontal-align", horizontalAlignment);
return KoShapeContainer::saveStyle(style, context);
}
示例2: saveStyle
QString Extrude::saveStyle(KoGenStyle& style, KoShapeSavingContext& context) const
{
style.addProperty("dr3d:depth", QString("%1").arg(m_depth));
style.addProperty("dr3d:close-front", m_closeFront);
style.addProperty("dr3d:close-back", m_closeBack);
if (m_backScale != 1.0) {
style.addProperty("dr3d:back-scale", QString("%1").arg(m_backScale));
}
return KoShape::saveStyle(style, context);
}
示例3: fillStyle
void KoShapeShadow::fillStyle(KoGenStyle &style, KoShapeSavingContext &context)
{
Q_UNUSED(context);
style.addProperty("draw:shadow", d->visible ? "visible" : "hidden", KoGenStyle::GraphicType);
style.addProperty("draw:shadow-color", d->color.name(), KoGenStyle::GraphicType);
if (d->color.alphaF() != 1.0)
style.addProperty("draw:shadow-opacity", QString("%1%").arg(d->color.alphaF() * 100.0), KoGenStyle::GraphicType);
style.addProperty("draw:shadow-offset-x", QString("%1pt").arg(d->offset.x()), KoGenStyle::GraphicType);
style.addProperty("draw:shadow-offset-y", QString("%1pt").arg(d->offset.y()), KoGenStyle::GraphicType);
if (d->blur != 0)
style.addProperty("calligra:shadow-blur-radius", QString("%1pt").arg(d->blur), KoGenStyle::GraphicType);
}
示例4: 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);
}
示例5: saveOdf
void KoTableRowStyle::saveOdf(KoGenStyle &style) const
{
QList<int> keys = d->stylesPrivate.keys();
foreach(int key, keys) {
if (key == QTextFormat::BackgroundBrush) {
QBrush backBrush = background();
if (backBrush.style() != Qt::NoBrush)
style.addProperty("fo:background-color", backBrush.color().name(), KoGenStyle::TableRowType);
else
style.addProperty("fo:background-color", "transparent", KoGenStyle::TableRowType);
} else if (key == MinimumRowHeight) {
style.addPropertyPt("style:min-row-height", minimumRowHeight(), KoGenStyle::TableRowType);
} else if (key == RowHeight) {
style.addPropertyPt("style:row-height", rowHeight(), KoGenStyle::TableRowType);
} else if (key == UseOptimalHeight) {
style.addProperty("style:use-optimal-row-height", useOptimalHeight(), KoGenStyle::TableRowType);
} else if (key == BreakBefore) {
style.addProperty("fo:break-before", KoText::textBreakToString(breakBefore()), KoGenStyle::TableRowType);
} else if (key == BreakAfter) {
style.addProperty("fo:break-after", KoText::textBreakToString(breakAfter()), KoGenStyle::TableRowType);
} else if (key == KeepTogether) {
if (keepTogether())
style.addProperty("fo:keep-together", "always", KoGenStyle::TableRowType);
else
style.addProperty("fo:keep-together", "auto", KoGenStyle::TableRowType);
}
}
}
示例6: tableCellEnd
void WordsTableHandler::tableCellEnd()
{
kDebug(30513);
if (!m_cellOpen) {
kDebug(30513) << "BUG: !m_cellOpen";
return;
}
// Text lists aren't closed explicitly so we have to close them
// when something happens like a new paragraph or, in this case,
// the table cell ends.
if (document()->textHandler()->listIsOpen()) {
document()->textHandler()->closeList();
}
KoXmlWriter* writer = currentWriter();
QList<const char*> openTags = writer->tagHierarchy();
for (int i = 0; i < openTags.size(); ++i) {
kDebug(30513) << openTags[i];
}
writer->endElement();//table:table-cell
m_cellOpen = false;
// If this cell covers other cells (i.e. is merged), then create as many
// table:covered-table-cell tags as there are covered columns.
for (int i = 1; i < m_colSpan; i++) {
writer->startElement("table:covered-table-cell");
writer->endElement();
}
m_colSpan = 1;
//Leaving out the table:style-name attribute and creation of the
//corresponding style for covered table cells in the tableCellStart f.
if (!m_tap || m_cellStyleName.isEmpty()) {
return;
}
//process shading information
const wvWare::Word97::SHD& shd = m_tap->rgshd[ m_column ];
QString color = Conversion::shdToColorStr(shd,
document()->textHandler()->paragraphBgColor(),
document()->textHandler()->paragraphBaseFontColorBkp());
if (!color.isNull()) {
KoGenStyle* cellStyle = m_mainStyles->styleForModification(m_cellStyleName, "table-cell");
Q_ASSERT(cellStyle);
if (cellStyle) {
cellStyle->addProperty("fo:background-color", color, KoGenStyle::TableCellType);
}
m_cellStyleName.clear();
//add the current background-color to stack
// document()->pushBgColor(color);
}
}
示例7: saveOdfSmilAttributes
void KPrPageEffect::saveOdfSmilAttributes( KoGenStyle & style ) const
{
QString speed("slow");
if (m_duration < 2500) {
speed = "fast";
}
else if (m_duration < 7500) {
speed = "medium";
}
style.addProperty("presentation:transition-speed", speed);
return m_strategy->saveOdfSmilAttributes(style);
}
示例8: prepareStyle
void KoColumnStyle::prepareStyle(KoGenStyle& style) const
{
if(m_breakAfter != NoBreak) {
style.addProperty("fo:break-after", breakStyleMap.value(m_breakAfter));
}
if(m_breakBefore != NoBreak) {
style.addProperty("fo:break-before", breakStyleMap.value(m_breakBefore));
}
switch(m_widthType) {
case MinimumWidth:
style.addPropertyPt("style:min-column-width", m_width);
break;
case ExactWidth:
style.addPropertyPt("style:column-width", m_width);
break;
case OptimalWidth:
style.addProperty("style:use-optimal-column-width", "true");
break;
}
}
示例9: saveOdf
void KoSectionStyle::saveOdf(KoGenStyle &style)
{
// only custom style have a displayname. automatic styles don't have a name set.
if (!d->name.isEmpty() && !style.isDefaultStyle()) {
style.addAttribute("style:display-name", d->name);
}
QList<int> keys = d->stylesPrivate.keys();
foreach(int key, keys) {
if (key == KoSectionStyle::TextProgressionDirection) {
int directionValue = 0;
bool ok = false;
directionValue = d->stylesPrivate.value(key).toInt(&ok);
if (ok) {
QString direction;
if (directionValue == KoText::LeftRightTopBottom)
direction = "lr-tb";
else if (directionValue == KoText::RightLeftTopBottom)
direction = "rl-tb";
else if (directionValue == KoText::TopBottomRightLeft)
direction = "tb-lr";
else if (directionValue == KoText::InheritDirection)
direction = "page";
if (!direction.isEmpty())
style.addProperty("style:writing-mode", direction, KoGenStyle::DefaultType);
}
} else if (key == QTextFormat::BackgroundBrush) {
QBrush backBrush = background();
if (backBrush.style() != Qt::NoBrush)
style.addProperty("fo:background-color", backBrush.color().name(), KoGenStyle::ParagraphType);
else
style.addProperty("fo:background-color", "transparent", KoGenStyle::DefaultType);
} else if (key == QTextFormat::BlockLeftMargin) {
style.addPropertyPt("fo:margin-left", leftMargin(), KoGenStyle::DefaultType);
} else if (key == QTextFormat::BlockRightMargin) {
style.addPropertyPt("fo:margin-right", rightMargin(), KoGenStyle::DefaultType);
}
}
}
示例10: prepareStyle
void KoTblStyle::prepareStyle(KoGenStyle& style) const
{
if(m_backgroundColor.isValid()) {
style.addProperty("fo:background-color", m_backgroundColor.name());
}
if (m_breakAfter != KoTblStyle::NoBreak) {
style.addProperty("fo:break-after", breakStyleMap.value(m_breakAfter));
}
if (m_breakBefore != KoTblStyle::NoBreak) {
style.addProperty("fo:break-before", breakStyleMap.value(m_breakBefore));
}
style.addProperty("fo:keep-with-next", keepWithNextMap.value(m_keepWithNext));
style.addPropertyPt("fo:margin-top", m_topMargin);
style.addPropertyPt("fo:margin-right", m_rightMargin);
style.addPropertyPt("fo:margin-bottom", m_bottomMargin);
style.addPropertyPt("fo:margin-left", m_leftMargin);
// style:width may not be 0, use style:rel-width if width is 0
if (m_widthUnit == PercentageUnit || m_width <= 0) {
style.addProperty("style:rel-width", QString::number(m_width) + QLatin1Char('%'));
} else {
style.addPropertyPt("style:width", m_width);
}
style.addProperty("style:may-break-between-rows", m_allowBreakBetweenRows ? "true" : "false");
style.addProperty("style:writing-mode", writingModeMap.value(m_writingMode));
style.addProperty("table:align", horizontalAlignMap.value(m_horizontalAlign));
style.addProperty("table:border-model", borderModelMap.value(m_borderModel));
if(!m_display) {
style.addProperty("table:display", "false");
}
if(!m_masterPageName.isEmpty()) {
style.addAttribute("style:master-page-name", m_masterPageName);
}
}
示例11: copyPropertiesFromStyle
void KoGenStyle::copyPropertiesFromStyle(const KoGenStyle &sourceStyle, KoGenStyle &targetStyle, PropertyType type)
{
if (type == DefaultType) {
type = sourceStyle.m_propertyType;
}
const StyleMap& map = sourceStyle.m_properties[type];
if (!map.isEmpty()) {
QMap<QString, QString>::const_iterator it = map.constBegin();
const QMap<QString, QString>::const_iterator end = map.constEnd();
for (; it != end; ++it) {
targetStyle.addProperty(it.key(), it.value(), type);
}
}
}
示例12: definePositionAttributes
void WordsGraphicsHandler::definePositionAttributes(KoGenStyle& style, const DrawStyle& ds)
{
if (m_processingGroup) return;
const KoGenStyle::PropertyType gt = KoGenStyle::GraphicType;
if (m_objectType == Inline) {
style.addProperty("style:vertical-rel", "baseline", gt);
style.addProperty("style:vertical-pos", "top", gt);
} else {
style.addProperty("style:horizontal-pos", getHorizontalPos(ds.posH()), gt);
style.addProperty("style:horizontal-rel", getHorizontalRel(ds.posRelH()), gt);
style.addProperty("style:vertical-pos", getVerticalPos(ds.posV()), gt);
style.addProperty("style:vertical-rel", getVerticalRel(ds.posRelV()), gt);
}
}
示例13: saveOdfStrokeStyle
void KoOdfGraphicStyles::saveOdfStrokeStyle(KoGenStyle &styleStroke, KoGenStyles &mainStyles, const QPen &pen)
{
// TODO implement all possibilities
switch (pen.style()) {
case Qt::NoPen:
styleStroke.addProperty("draw:stroke", "none", KoGenStyle::GraphicType);
return;
case Qt::SolidLine:
styleStroke.addProperty("draw:stroke", "solid", KoGenStyle::GraphicType);
break;
default: { // must be a dashed line
styleStroke.addProperty("draw:stroke", "dash", KoGenStyle::GraphicType);
// save stroke dash (14.14.7) which is severly limited, but still
KoGenStyle dashStyle(KoGenStyle::StrokeDashStyle);
dashStyle.addAttribute("draw:style", "rect");
QVector<qreal> dashes = pen.dashPattern();
dashStyle.addAttribute("draw:dots1", static_cast<int>(1));
dashStyle.addAttributePt("draw:dots1-length", dashes[0]*pen.widthF());
dashStyle.addAttributePt("draw:distance", dashes[1]*pen.widthF());
if (dashes.size() > 2) {
dashStyle.addAttribute("draw:dots2", static_cast<int>(1));
dashStyle.addAttributePt("draw:dots2-length", dashes[2]*pen.widthF());
}
QString dashStyleName = mainStyles.insert(dashStyle, "dash");
styleStroke.addProperty("draw:stroke-dash", dashStyleName, KoGenStyle::GraphicType);
break;
}
}
if (pen.brush().gradient()) {
styleStroke.addProperty("calligra:stroke-gradient", saveOdfGradientStyle(mainStyles, pen.brush()), KoGenStyle::GraphicType);
}
else {
styleStroke.addProperty("svg:stroke-color", pen.color().name(), KoGenStyle::GraphicType);
styleStroke.addProperty("svg:stroke-opacity", QString("%1").arg(pen.color().alphaF()), KoGenStyle::GraphicType);
}
styleStroke.addPropertyPt("svg:stroke-width", pen.widthF(), KoGenStyle::GraphicType);
switch (pen.joinStyle()) {
case Qt::MiterJoin:
styleStroke.addProperty("draw:stroke-linejoin", "miter", KoGenStyle::GraphicType);
break;
case Qt::BevelJoin:
styleStroke.addProperty("draw:stroke-linejoin", "bevel", KoGenStyle::GraphicType);
break;
case Qt::RoundJoin:
styleStroke.addProperty("draw:stroke-linejoin", "round", KoGenStyle::GraphicType);
break;
default:
styleStroke.addProperty("draw:stroke-linejoin", "miter", KoGenStyle::GraphicType);
styleStroke.addProperty("calligra:stroke-miterlimit", QString("%1").arg(pen.miterLimit()), KoGenStyle::GraphicType);
break;
}
switch (pen.capStyle()) {
case Qt::RoundCap:
styleStroke.addProperty("svg:stroke-linecap", "round", KoGenStyle::GraphicType);
break;
case Qt::SquareCap:
styleStroke.addProperty("svg:stroke-linecap", "square", KoGenStyle::GraphicType);
break;
default:
styleStroke.addProperty("svg:stroke-linecap", "butt", KoGenStyle::GraphicType);
break;
}
}
示例14: saveOdfFillStyle
void KoOdfGraphicStyles::saveOdfFillStyle(KoGenStyle &styleFill, KoGenStyles& mainStyles, const QBrush & brush)
{
switch (brush.style()) {
case Qt::Dense1Pattern:
styleFill.addProperty("draw:transparency", "94%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense2Pattern:
styleFill.addProperty("draw:transparency", "88%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense3Pattern:
styleFill.addProperty("draw:transparency", "63%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense4Pattern:
styleFill.addProperty("draw:transparency", "50%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense5Pattern:
styleFill.addProperty("draw:transparency", "37%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense6Pattern:
styleFill.addProperty("draw:transparency", "12%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::Dense7Pattern:
styleFill.addProperty("draw:transparency", "6%");
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
break;
case Qt::LinearGradientPattern:
case Qt::RadialGradientPattern:
case Qt::ConicalGradientPattern:
styleFill.addProperty("draw:fill", "gradient");
styleFill.addProperty("draw:fill-gradient-name", saveOdfGradientStyle(mainStyles, brush));
break;
case Qt::HorPattern:
case Qt::VerPattern:
case Qt::CrossPattern:
case Qt::BDiagPattern:
case Qt::FDiagPattern:
case Qt::DiagCrossPattern:
styleFill.addProperty("draw:fill", "hatch");
styleFill.addProperty("draw:fill-hatch-name", saveOdfHatchStyle(mainStyles, brush));
break;
case Qt::SolidPattern:
styleFill.addProperty("draw:fill", "solid");
styleFill.addProperty("draw:fill-color", brush.color().name());
if (! brush.isOpaque())
styleFill.addProperty("draw:opacity", QString("%1%").arg(brush.color().alphaF() * 100.0));
break;
case Qt::NoBrush:
default:
styleFill.addProperty("draw:fill", "none");
break;
}
}
示例15: defineWrappingAttributes
void WordsGraphicsHandler::defineWrappingAttributes(KoGenStyle& style, const DrawStyle& ds)
{
if (m_processingGroup) return;
if (m_objectType == Inline) return;
const KoGenStyle::PropertyType gt = KoGenStyle::GraphicType;
wvWare::Word97::FSPA* spa = m_pSpa;
// style:number-wrapped-paragraphs
// style:run-through
// style:wrap
// style:wrap-contour
// style:wrap-contour-mode
// style:wrap-dynamic-threshold
if (spa != 0) {
bool check_wrk = false;
switch (spa->wr) {
case 0: //wrap around the object
case 2: //square wrapping
check_wrk = true;
break;
case 1: //top and bottom wrapping
style.addProperty("style:wrap", "none", gt);
break;
case 3: //in front or behind the text
style.addProperty("style:wrap", "run-through", gt);
//check if shape is behind the text
if ((spa->fBelowText == 1) || (ds.fBehindDocument())) {
style.addProperty("style:run-through", "background", gt);
} else {
style.addProperty("style:run-through", "foreground", gt);
}
break;
case 4: //tight wrapping
check_wrk = true;
style.addProperty("style:wrap-contour", "true", gt);
style.addProperty("style:wrap-contour-mode", "outside", gt);
break;
case 5: //through wrapping
check_wrk = true;
style.addProperty("style:wrap-contour", "true", gt);
style.addProperty("style:wrap-contour-mode", "full", gt);
break;
}
//check details of the text wrapping around this shape
if (check_wrk) {
switch (spa->wrk) {
case 0:
style.addProperty("style:wrap", "parallel", gt);
break;
case 1:
style.addProperty("style:wrap", "left", gt);
break;
case 2:
style.addProperty("style:wrap", "right", gt);
break;
case 3:
style.addProperty("style:wrap", "biggest", gt);
break;
}
}
// ODF-1.2: specifies the number of paragraphs that can wrap around a
// frame if wrap mode is in {left, right, parallel, dynamic} and anchor
// type is in {char, paragraph}
if ((spa->wr != 1) && (spa->wr != 3)) {
style.addProperty("style:number-wrapped-paragraphs", "no-limit");
}
} else {
style.addProperty("style:wrap", "run-through", gt);
if (ds.fBehindDocument()) {
style.addProperty("style:run-through", "background", gt);
} else {
style.addProperty("style:run-through", "foreground", gt);
}
}
}