本文整理汇总了C++中KWDocument::addTextImageRequest方法的典型用法代码示例。如果您正苦于以下问题:C++ KWDocument::addTextImageRequest方法的具体用法?C++ KWDocument::addTextImageRequest怎么用?C++ KWDocument::addTextImageRequest使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KWDocument
的用法示例。
在下文中一共展示了KWDocument::addTextImageRequest方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void KWTextImage::load( QDomElement & parentElem )
{
// This code is similar to KWPictureFrameSet::load
KWDocument * doc = static_cast<KWTextDocument *>(parent)->textFrameSet()->kWordDocument();
// <IMAGE> (KOffice 1.0) or <PICTURE> (KWord 1.2)
QDomNode node=parentElem.namedItem( "PICTURE" );
if ( node.isNull() )
{
node=parentElem.namedItem( "IMAGE" );
}
QDomElement image = node.toElement();
if ( image.isNull() )
image = parentElem; // The data is directly child of <FORMAT>
// <KEY>
QDomElement keyElement = image.namedItem( "KEY" ).toElement();
if ( !keyElement.isNull() )
{
KoPictureKey key;
key.loadAttributes( keyElement );
m_image.setKey(key);
doc->addTextImageRequest( this );
}
else
{
// <FILENAME> (old format, up to KWord-1.1-beta2)
QDomElement filenameElement = image.namedItem( "FILENAME" ).toElement();
if ( !filenameElement.isNull() )
{
QString filename = filenameElement.attribute( "value" );
m_image.setKey( KoPictureKey( filename ) );
doc->addTextImageRequest( this );
}
else
{
kdError(32001) << "Missing KEY or FILENAME tag in IMAGE (KWTextImage::load)" << endl;
}
}
}
示例2: save
void KWTextImage::save( QDomElement & parentElem )
{
// This code is similar to KWPictureFrameSet::save
KWDocument * doc = static_cast<KWTextDocument *>(parent)->textFrameSet()->kWordDocument();
QDomElement imageElem = parentElem.ownerDocument().createElement( "PICTURE" );
parentElem.appendChild( imageElem );
//imageElem.setAttribute( "keepAspectRatio", "true" );
QDomElement elem = parentElem.ownerDocument().createElement( "KEY" );
imageElem.appendChild( elem );
image().getKey().saveAttributes( elem );
// Now we must take care that a <KEY> element will be written as a child of <PICTURES>
doc->addTextImageRequest( this );
}