本文整理汇总了C++中DataObjectGtk::hasText方法的典型用法代码示例。如果您正苦于以下问题:C++ DataObjectGtk::hasText方法的具体用法?C++ DataObjectGtk::hasText怎么用?C++ DataObjectGtk::hasText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectGtk
的用法示例。
在下文中一共展示了DataObjectGtk::hasText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: markup
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
{
GtkClipboard* clipboard = PasteboardHelper::clipboardForFrame(frame);
ASSERT(clipboard);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
ASSERT(dataObject);
PasteboardHelper::helper()->getClipboardContents(clipboard);
if (dataObject->hasMarkup()) {
chosePlainText = false;
String markup(dataObject->markup());
if (!markup.isEmpty()) {
RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), markup, "");
if (fragment)
return fragment.release();
}
}
if (!allowPlainText || !dataObject->hasText())
return 0;
chosePlainText = true;
String text(dataObject->text());
RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), text);
if (fragment)
return fragment.release();
return 0;
}
示例2: createFragmentFromMarkup
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context,
bool allowPlainText, bool& chosePlainText)
{
PasteboardHelper* helper = PasteboardHelper::defaultPasteboardHelper();
GtkClipboard* clipboard = helper->getCurrentClipboard(frame);
DataObjectGtk* dataObject = DataObjectGtk::forClipboard(clipboard);
helper->getClipboardContents(clipboard);
chosePlainText = false;
if (dataObject->hasMarkup()) {
RefPtr<DocumentFragment> fragment = createFragmentFromMarkup(frame->document(), dataObject->markup(), "", FragmentScriptingNotAllowed);
if (fragment)
return fragment.release();
}
if (!allowPlainText)
return 0;
if (dataObject->hasText()) {
chosePlainText = true;
RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), dataObject->text());
if (fragment)
return fragment.release();
}
return 0;
}
示例3: createFragmentFromMarkup
static RefPtr<DocumentFragment> createFragmentFromPasteboardData(Pasteboard& pasteboard, Frame& frame, Range& range, bool allowPlainText, bool& chosePlainText)
{
chosePlainText = false;
if (!pasteboard.hasData())
return nullptr;
DataObjectGtk* dataObject = pasteboard.dataObject();
if (dataObject->hasMarkup() && frame.document())
return createFragmentFromMarkup(*frame.document(), dataObject->markup(), emptyString(), DisallowScriptingAndPluginContent);
if (!allowPlainText)
return nullptr;
if (dataObject->hasText()) {
chosePlainText = true;
return createFragmentFromText(range, dataObject->text());
}
return nullptr;
}