本文整理汇总了C++中KoGenStyle::parentName方法的典型用法代码示例。如果您正苦于以下问题:C++ KoGenStyle::parentName方法的具体用法?C++ KoGenStyle::parentName怎么用?C++ KoGenStyle::parentName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoGenStyle
的用法示例。
在下文中一共展示了KoGenStyle::parentName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: insert
QString KoGenStyles::insert(const KoGenStyle& style, const QString& baseName, InsertionFlags flags)
{
// if it is a default style it has to be saved differently
if (style.isDefaultStyle()) {
// we can have only one default style per type
Q_ASSERT(!d->defaultStyles.contains(style.type()));
// default style is only possible for style:style in office:style types
Q_ASSERT(style.type() == KoGenStyle::TextStyle ||
style.type() == KoGenStyle::ParagraphStyle ||
style.type() == KoGenStyle::SectionStyle ||
style.type() == KoGenStyle::RubyStyle ||
style.type() == KoGenStyle::TableStyle ||
style.type() == KoGenStyle::TableColumnStyle ||
style.type() == KoGenStyle::TableRowStyle ||
style.type() == KoGenStyle::TableCellStyle ||
style.type() == KoGenStyle::GraphicStyle ||
style.type() == KoGenStyle::PresentationStyle ||
style.type() == KoGenStyle::DrawingPageStyle ||
style.type() == KoGenStyle::ChartStyle);
d->defaultStyles.insert(style.type(), style);
// default styles don't have a name
return QString();
}
if (flags & AllowDuplicates) {
StyleMap::iterator it = d->insertStyle(style, baseName, flags);
return it.value();
}
StyleMap::iterator it = d->styleMap.find(style);
if (it == d->styleMap.end()) {
// Not found, try if this style is in fact equal to its parent (the find above
// wouldn't have found it, due to m_parentName being set).
if (!style.parentName().isEmpty()) {
KoGenStyle testStyle(style);
const KoGenStyle* parentStyle = this->style(style.parentName(), style.familyName()); // ## linear search
if (!parentStyle) {
kDebug(30003) << "baseName=" << baseName << "parent style" << style.parentName()
<< "not found in collection";
} else {
// TODO remove
if (testStyle.m_familyName != parentStyle->m_familyName) {
kWarning(30003) << "baseName=" << baseName << "family=" << testStyle.m_familyName
<< "parent style" << style.parentName() << "has a different family:"
<< parentStyle->m_familyName;
}
testStyle.m_parentName = parentStyle->m_parentName;
// Exclude the type from the comparison. It's ok for an auto style
// to have a user style as parent; they can still be identical
testStyle.m_type = parentStyle->m_type;
// Also it's ok to not have the display name of the parent style
// in the auto style
QMap<QString, QString>::const_iterator it = parentStyle->m_attributes.find("style:display-name");
if (it != parentStyle->m_attributes.end())
testStyle.addAttribute("style:display-name", *it);
if (*parentStyle == testStyle)
return style.parentName();
}
}
it = d->insertStyle(style, baseName, flags);
}
return it.value();
}