本文整理汇总了C++中KoParagraphStyle::loadOdf方法的典型用法代码示例。如果您正苦于以下问题:C++ KoParagraphStyle::loadOdf方法的具体用法?C++ KoParagraphStyle::loadOdf怎么用?C++ KoParagraphStyle::loadOdf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoParagraphStyle
的用法示例。
在下文中一共展示了KoParagraphStyle::loadOdf方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadOdf
bool KPrPlaceholderTextStrategy::loadOdf( const KoXmlElement & element, KoShapeLoadingContext & context )
{
if (KoTextSharedLoadingData *textSharedData = dynamic_cast<KoTextSharedLoadingData *>(context.sharedData(KOTEXT_SHARED_LOADING_ID))) {
KoShapeFactoryBase *factory = KoShapeRegistry::instance()->value("TextShapeID");
Q_ASSERT(factory);
delete m_textShape;
m_textShape = factory->createDefaultShape(context.documentResourceManager());
KoTextShapeData *shapeData = qobject_cast<KoTextShapeData*>(m_textShape->userData());
shapeData->document()->setUndoRedoEnabled(false);
QTextDocument *document = shapeData->document();
QTextCursor cursor(document);
QTextBlock block = cursor.block();
const QString styleName = element.attributeNS(KoXmlNS::presentation, "style-name");
if (!styleName.isEmpty()) {
const KoXmlElement *style = context.odfLoadingContext().stylesReader().findStyle(styleName, "presentation", context.odfLoadingContext().useStylesAutoStyles());
if (style) {
KoParagraphStyle paragraphStyle;
paragraphStyle.loadOdf(style, context);
paragraphStyle.applyStyle(block, false); // TODO t.zachmann is the false correct?
}
}
const QString textStyleName = element.attributeNS(KoXmlNS::draw, "text-style-name");
if (!textStyleName.isEmpty()) {
KoParagraphStyle *style = textSharedData->paragraphStyle(textStyleName, context.odfLoadingContext().useStylesAutoStyles());
if (style) {
style->applyStyle(block, false); // TODO t.zachmann is the false correct?
}
}
cursor.insertText(text());
shapeData->setDirty();
shapeData->document()->setUndoRedoEnabled(true);
}
return true;
}