本文整理汇总了C++中KoXmlWriter::addAttributePt方法的典型用法代码示例。如果您正苦于以下问题:C++ KoXmlWriter::addAttributePt方法的具体用法?C++ KoXmlWriter::addAttributePt怎么用?C++ KoXmlWriter::addAttributePt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoXmlWriter
的用法示例。
在下文中一共展示了KoXmlWriter::addAttributePt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveOdfLabel
void saveOdfLabel(KoShape *label, KoXmlWriter &bodyWriter,
KoGenStyles &mainStyles, LabelType labelType)
{
// Don't save hidden labels, as that's the way of removing them
// from a chart.
if (!label->isVisible())
return;
TextLabelData *labelData = qobject_cast<TextLabelData*>(label->userData());
if (!labelData)
return;
if (labelType == FooterLabelType)
bodyWriter.startElement("chart:footer");
else if (labelType == SubTitleLabelType)
bodyWriter.startElement("chart:subtitle");
else // if (labelType == TitleLabelType)
bodyWriter.startElement("chart:title");
bodyWriter.addAttributePt("svg:x", label->position().x());
bodyWriter.addAttributePt("svg:y", label->position().y());
bodyWriter.addAttributePt("svg:width", label->size().width());
bodyWriter.addAttributePt("svg:height", label->size().height());
// TODO: Save text label color
QTextCursor cursor(labelData->document());
QFont labelFont = cursor.charFormat().font();
KoGenStyle autoStyle(KoGenStyle::ChartAutoStyle, "chart", 0);
autoStyle.addPropertyPt("style:rotation-angle", 360 - label->rotation());
saveOdfFont(autoStyle, labelFont, QColor());
bodyWriter.addAttribute("chart:style-name", mainStyles.insert(autoStyle, "ch"));
bodyWriter.startElement("text:p");
bodyWriter.addTextNode(labelData->document()->toPlainText());
bodyWriter.endElement(); // text:p
bodyWriter.endElement(); // chart:title/subtitle/footer
}
示例2: tableStart
// Called by Document before invoking the table-row-functors
void WordsTableHandler::tableStart(Words::Table* table)
{
kDebug(30513);
Q_ASSERT(table);
Q_ASSERT(!table->name.isEmpty());
wvWare::SharedPtr<const wvWare::Word97::TAP> tap = table->tap;
KoXmlWriter* writer = currentWriter();
m_currentTable = table;
m_cellOpen = false;
m_row = -1;
m_currentY = 0;
#ifdef DEBUG_TABLEHANDLER
for (unsigned int i = 0; i < (unsigned int)table->m_cellEdges.size(); i++) {
kDebug(30513) << table->m_cellEdges[i];
}
#endif
if (m_currentTable->floating) {
const KoGenStyle::PropertyType gt = KoGenStyle::GraphicType;
KoGenStyle style(KoGenStyle::GraphicAutoStyle, "graphic");
if (document()->writingHeader()) {
style.setAutoStyleInStylesDotXml(true);
}
//style:wrap
if (tap->textWrap) {
if (tap->dxaAbs == -8) {
style.addProperty("style:wrap", "left", gt);
}
else if (tap->dxaAbs == 0) {
style.addProperty("style:wrap", "right", gt);
} else {
style.addProperty("style:wrap", "parallel", gt);
}
//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}.
style.addProperty("style:number-wrapped-paragraphs", "no-limit", gt);
} else {
style.addProperty("style:wrap", "none", gt);
}
//fo:margin
style.addPropertyPt("fo:margin-left", twipsToPt(tap->dxaFromText), gt);
style.addPropertyPt("fo:margin-right", twipsToPt(tap->dxaFromTextRight), gt);
style.addPropertyPt("fo:margin-top", twipsToPt(tap->dyaFromText), gt);
style.addPropertyPt("fo:margin-bottom", twipsToPt(tap->dyaFromTextBottom), gt);
int dxaAbs = 0;
int dyaAbs = 0;
//style:horizontal-pos - horizontal position of the anchor
QString pos = Conversion::getHorizontalPos(tap->dxaAbs);
style.addProperty("style:horizontal-pos", pos, gt);
if (pos == "from-left") {
dxaAbs = tap->dxaAbs;
}
//style:vertical-pos - vertical position of the anchor
pos = Conversion::getVerticalPos(tap->dyaAbs);
style.addProperty("style:vertical-pos", pos, gt);
if (pos == "from-top") {
dyaAbs = tap->dyaAbs;
}
//style:vertical-rel - relative vertical position of the anchor
pos = Conversion::getVerticalRel(tap->pcVert);
if (!pos.isEmpty()) {
style.addProperty("style:vertical-rel", pos, gt);
}
//style:horizontal-rel - relative horizontal position of the anchor
pos = Conversion::getHorizontalRel(tap->pcHorz);
if (!pos.isEmpty()) {
style.addProperty("style:horizontal-rel", pos, gt);
}
//draw:auto-grow-height
style.addProperty("draw:auto-grow-height", "true", gt);
const QString drawStyleName = m_mainStyles->insert(style);
writer->startElement("draw:frame");
writer->addAttribute("draw:style-name", drawStyleName.toUtf8());
writer->addAttribute("text:anchor-type", "paragraph");
int width = table->m_cellEdges[table->m_cellEdges.size() - 1] - table->m_cellEdges[0];
writer->addAttributePt("svg:width", twipsToPt(width));
if (style.property("style:horizontal-pos", gt) == "from-left") {
writer->addAttributePt("svg:x", twipsToPt(dxaAbs + tap->rgdxaCenter[0]));
}
writer->addAttributePt("svg:y", twipsToPt(dyaAbs));
writer->startElement("draw:text-box");
} //absolutely positioned table
KoGenStyle tableStyle(KoGenStyle::TableAutoStyle, "table");
if (document()->writingHeader()) {
tableStyle.setAutoStyleInStylesDotXml(true);
//.........这里部分代码省略.........