本文整理汇总了C++中KoShapeLoadingContext::documentResourceManager方法的典型用法代码示例。如果您正苦于以下问题:C++ KoShapeLoadingContext::documentResourceManager方法的具体用法?C++ KoShapeLoadingContext::documentResourceManager怎么用?C++ KoShapeLoadingContext::documentResourceManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KoShapeLoadingContext
的用法示例。
在下文中一共展示了KoShapeLoadingContext::documentResourceManager方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadText
bool KoTosContainer::loadText(const KoXmlElement &element, KoShapeLoadingContext &context)
{
Q_D(const KoTosContainer);
KoXmlElement child;
forEachElement(child, element) {
// only recreate the text shape if there's something to be loaded
if (child.localName() == "p" || child.localName() == "list") {
KoShape *textShape = createTextShape(context.documentResourceManager());
if (!textShape) {
return false;
}
//apply the style properties to the loaded text
setTextAlignment(d->alignment);
// In the case of text on shape, we cannot ask the text shape to load
// the odf, since it expects a complete document with style info and
// everything, so we have to use the KoTextShapeData object instead.
KoTextShapeDataBase *shapeData = qobject_cast<KoTextShapeDataBase*>(textShape->userData());
Q_ASSERT(shapeData);
shapeData->loadStyle(element, context);
bool loadOdf = shapeData->loadOdf(element, context);
return loadOdf;
}
}
return true;
}
示例2: tryWrapShape
void ShrinkToFitShapeContainer::tryWrapShape(KoShape *shape, const KoXmlElement &element, KoShapeLoadingContext &context)
{
KoTextShapeData* data = dynamic_cast<KoTextShapeData*>(shape->userData());
if (!data || data->resizeMethod() != KoTextShapeData::ShrinkToFitResize)
return;
KoShapeContainer *oldParent = shape->parent();
ShrinkToFitShapeContainer *tos = wrapShape(shape, context.documentResourceManager());
if (!tos->loadOdf(element, context)) {
shape->setParent(oldParent);
delete tos;
}
}
示例3: tryWrapShape
// static
void KoTextOnShapeContainer::tryWrapShape(KoShape *shape, const KoXmlElement &element, KoShapeLoadingContext &context)
{
KoXmlElement text = KoXml::namedItemNS(element, KoXmlNS::text, "p");
if (!text.isNull()) {
KoShapeContainer *oldParent = shape->parent();
KoTextOnShapeContainer *tos = new KoTextOnShapeContainer(shape,
context.documentResourceManager());
if (!tos->loadOdf(element, context)) {
// failed, delete it again.
shape->setParent(oldParent);
delete tos;
}
}
}
示例4: 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;
}
示例5: loadOdf
bool KPrSoundEventAction::loadOdf( const KoXmlElement & element, KoShapeLoadingContext &context )
{
KoXmlElement sound = KoXml::namedItemNS( element, KoXmlNS::presentation, "sound" );
bool retval = false;
if ( ! sound.isNull() ) {
KPrSoundCollection *soundCollection = context.documentResourceManager()->resource(KPresenter::SoundCollection).value<KPrSoundCollection*>();
if ( soundCollection ) {
QString href = sound.attributeNS( KoXmlNS::xlink, "href" );
if ( !href.isEmpty() ) {
m_soundData = new KPrSoundData( soundCollection, href );
retval = true;
}
}
else {
kWarning(33000) << "sound collection could not be found";
Q_ASSERT( soundCollection );
}
}
return retval;
}