本文整理汇总了C++中KoGenStyle::addPropertyPt方法的典型用法代码示例。如果您正苦于以下问题:C++ KoGenStyle::addPropertyPt方法的具体用法?C++ KoGenStyle::addPropertyPt怎么用?C++ KoGenStyle::addPropertyPt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoGenStyle
的用法示例。
在下文中一共展示了KoGenStyle::addPropertyPt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
}
示例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: slotSectionEnd
void Document::slotSectionEnd(wvWare::SharedPtr<const wvWare::Word97::SEP> sep)
{
kDebug(30513);
KoGenStyle* masterPageStyle = 0;
KoGenStyle* pageLayoutStyle = 0;
QString pageLayoutName;
for (int i = 0; i < m_masterPageName_list.size(); i++) {
pageLayoutStyle = m_pageLayoutStyle_list[i];
masterPageStyle = m_masterPageStyle_list[i];
Q_ASSERT(pageLayoutStyle);
Q_ASSERT(masterPageStyle);
//set the margins - depends on whether a header/footer is present
if (m_hasHeader_list[i]) {
kDebug(30513) << "setting margin for header...";
pageLayoutStyle->addPropertyPt("fo:margin-top", (double)sep->dyaHdrTop / 20.0);
} else if (sep->brcTop.brcType == 0) {
kDebug(30513) << "setting margin for no header and no top border...";
pageLayoutStyle->addPropertyPt("fo:margin-top", (double)sep->dyaTop / 20.0);
}
if (m_hasFooter_list[i]) {
pageLayoutStyle->addPropertyPt("fo:margin-bottom", (double)sep->dyaHdrBottom / 20.0);
} else if (sep->brcBottom.brcType == 0) {
pageLayoutStyle->addPropertyPt("fo:margin-bottom", (double)sep->dyaBottom / 20.0);
}
pageLayoutName = m_mainStyles->insert(*pageLayoutStyle, "Mpm");
masterPageStyle->addAttribute("style:page-layout-name", pageLayoutName);
m_mainStyles->insert(*masterPageStyle, m_masterPageName_list[i], KoGenStyles::DontAddNumberToName);
//delete objects, we've added them to the collection
delete masterPageStyle;
delete pageLayoutStyle;
}
//clear lists
m_pageLayoutStyle_list.clear();
m_masterPageStyle_list.clear();
m_masterPageName_list.clear();
m_hasHeader_list.clear();
m_hasFooter_list.clear();
//reset header data
m_headerCount = 0;
}
示例4: 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");
return;
case Qt::SolidLine:
styleStroke.addProperty("draw:stroke", "solid");
break;
default: { // must be a dashed line
styleStroke.addProperty("draw:stroke", "dash");
// 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);
break;
}
}
if (pen.brush().gradient()) {
styleStroke.addProperty("koffice:stroke-gradient", saveOdfGradientStyle(mainStyles, pen.brush()));
}
else {
styleStroke.addProperty("svg:stroke-color", pen.color().name());
styleStroke.addProperty("svg:stroke-opacity", QString("%1").arg(pen.color().alphaF()));
}
styleStroke.addPropertyPt("svg:stroke-width", pen.widthF());
switch (pen.joinStyle()) {
case Qt::MiterJoin:
styleStroke.addProperty("draw:stroke-linejoin", "miter");
break;
case Qt::BevelJoin:
styleStroke.addProperty("draw:stroke-linejoin", "bevel");
break;
case Qt::RoundJoin:
styleStroke.addProperty("draw:stroke-linejoin", "round");
break;
default:
styleStroke.addProperty("draw:stroke-linejoin", "miter");
styleStroke.addProperty("koffice:stroke-miterlimit", QString("%1").arg(pen.miterLimit()));
break;
}
}
示例5: 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;
}
}
示例6: 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);
}
}
}
示例7: 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);
}
}
示例8: slotSectionEnd
void Document::slotSectionEnd(wvWare::SharedPtr<const wvWare::Word97::SEP> sep)
{
kDebug(30513);
KoGenStyle* masterPageStyle = 0;
KoGenStyle* pageLayoutStyle = 0;
QString pageLayoutName;
for (int i = 0; i < m_masterPageName_list.size(); i++) {
pageLayoutStyle = m_pageLayoutStyle_list[i];
masterPageStyle = m_masterPageStyle_list[i];
Q_ASSERT(pageLayoutStyle);
Q_ASSERT(masterPageStyle);
//set the margins - depends on whether a header/footer is present
// Set default left/right margins for the case when there is no border.
// This will be changed below if there are borders defined.
pageLayoutStyle->addPropertyPt("fo:margin-left", (double)sep->dxaLeft / 20.0);
pageLayoutStyle->addPropertyPt("fo:margin-right", (double)sep->dxaRight / 20.0);
// the pgbOffsetFrom variable determines how to calculate the margins and paddings.
switch (sep->pgbOffsetFrom) {
case pgbFromText:
pageLayoutStyle->addPropertyPt("fo:margin-left", sep->dxaLeft / 20.0 - sep->brcLeft.dptSpace);
pageLayoutStyle->addPropertyPt("fo:margin-right", sep->dxaRight / 20.0 - sep->brcRight.dptSpace);
if (m_hasHeader_list[i]) {
// If we have the header in the border, then our margin is the header top position
if (m_parser->dop().fIncludeHeader)
pageLayoutStyle->addPropertyPt("fo:margin-top", sep->dyaHdrTop / 20.0 - sep->brcTop.dptSpace);
else
pageLayoutStyle->addPropertyPt("fo:margin-top", (sep->dyaHdrTop + sep->dyaTop) / 20.0 - sep->brcTop.dptSpace);
} else {
pageLayoutStyle->addPropertyPt("fo:margin-top", sep->dyaTop / 20.0 - sep->brcTop.dptSpace);
}
if (m_hasFooter_list[i]) {
// If we have the footer in the border, then our margin is the header bottom position
if (m_parser->dop().fIncludeFooter)
pageLayoutStyle->addPropertyPt("fo:margin-bottom", sep->dyaHdrBottom / 20.0 - sep->brcBottom.dptSpace);
else
pageLayoutStyle->addPropertyPt("fo:margin-bottom", (sep->dyaHdrBottom + sep->dyaBottom) / 20.0 - sep->brcBottom.dptSpace);
} else {
// same comment for footer as for header
pageLayoutStyle->addPropertyPt("fo:margin-bottom", sep->dyaBottom / 20.0 - sep->brcBottom.dptSpace);
}
pageLayoutStyle->addPropertyPt("fo:padding-left", sep->brcLeft.dptSpace);
pageLayoutStyle->addPropertyPt("fo:padding-right", sep->brcRight.dptSpace);
pageLayoutStyle->addPropertyPt("fo:padding-top", sep->brcTop.dptSpace);
pageLayoutStyle->addPropertyPt("fo:padding-bottom", sep->brcBottom.dptSpace);
break;
case pgbFromEdge:
pageLayoutStyle->addPropertyPt("fo:margin-left", sep->brcLeft.dptSpace);
pageLayoutStyle->addPropertyPt("fo:margin-right", sep->brcRight.dptSpace);
pageLayoutStyle->addPropertyPt("fo:margin-top", sep->brcTop.dptSpace);
pageLayoutStyle->addPropertyPt("fo:margin-bottom", sep->brcBottom.dptSpace);
pageLayoutStyle->addPropertyPt("fo:padding-left", sep->dxaLeft / 20.0 - sep->brcLeft.dptSpace);
pageLayoutStyle->addPropertyPt("fo:padding-right", sep->dxaRight / 20.0 - sep->brcRight.dptSpace);
if (m_hasHeader_list[i]) {
// minimum height of headers is not yet calculated but should be smth like:
// sep->dyaTop - sep->dyaHdrTop
pageLayoutStyle->addPropertyPt("fo:padding-top", sep->dyaHdrTop / 20.0 - sep->brcTop.dptSpace);
} else {
pageLayoutStyle->addPropertyPt("fo:padding-top", sep->dyaTop / 20.0 - sep->brcTop.dptSpace);
}
if (m_hasFooter_list[i]) {
// same comment for footer as for header
pageLayoutStyle->addPropertyPt("fo:padding-bottom", sep->dyaHdrBottom / 20.0 - sep->brcBottom.dptSpace);
} else {
pageLayoutStyle->addPropertyPt("fo:padding-bottom", sep->dyaBottom / 20.0 - sep->brcBottom.dptSpace);
}
break;
}
pageLayoutName = m_mainStyles->insert(*pageLayoutStyle, "Mpm");
masterPageStyle->addAttribute("style:page-layout-name", pageLayoutName);
m_mainStyles->insert(*masterPageStyle, m_masterPageName_list[i], KoGenStyles::DontAddNumberToName);
//delete objects, we've added them to the collection
delete masterPageStyle;
delete pageLayoutStyle;
}
//clear lists
m_pageLayoutStyle_list.clear();
m_masterPageStyle_list.clear();
m_masterPageName_list.clear();
m_hasHeader_list.clear();
m_hasFooter_list.clear();
//reset header data
m_headerCount = 0;
}