本文整理汇总了C++中FV_View::getDocumentRangeOfCurrentSelection方法的典型用法代码示例。如果您正苦于以下问题:C++ FV_View::getDocumentRangeOfCurrentSelection方法的具体用法?C++ FV_View::getDocumentRangeOfCurrentSelection怎么用?C++ FV_View::getDocumentRangeOfCurrentSelection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FV_View
的用法示例。
在下文中一共展示了FV_View::getDocumentRangeOfCurrentSelection方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cacheCurrentSelection
void AP_UnixApp::cacheCurrentSelection(AV_View * pView)
{
if (pView)
{
// remember a temporary copy of the extent of the current
// selection in the given view. this is intended for the
// X11 middle mouse trick -- where we need to warp to a
// new location and paste the current selection (not the
// clipboard) and the act of warping clears the selection.
// TODO if we ever support multiple view types, we'll have to
// TODO change this.
FV_View * pFVView = static_cast<FV_View *>(pView);
pFVView->getDocumentRangeOfCurrentSelection(&m_cacheDocumentRangeOfSelection);
m_cacheSelectionView = pView;
m_cacheDeferClear = false;
}
else
{
if (m_cacheDeferClear)
{
m_cacheDeferClear = false;
m_bHasSelection = false;
}
m_cacheSelectionView = NULL;
}
}
示例2: getCurrentSelection
/*!
get the current contents of the selection in the
window last known to have a selection using one
of the formats in the given list.
\param formatList the list of acceptable formats
\param ppData
\param pLen a pointer to an integer representing the length
\param pszFormatFound a pointer for the data to be returned in
\return True if successful, false otherwise.
*/
bool AP_UnixApp::getCurrentSelection(const char** formatList,
void ** ppData, UT_uint32 * pLen,
const char **pszFormatFound)
{
int j;
*ppData = NULL; // assume failure
*pLen = 0;
*pszFormatFound = NULL;
if (!m_pViewSelection || !m_pFrameSelection || !m_bHasSelection)
return false; // can't do it, give up.
PD_DocumentRange dr;
if (m_cacheSelectionView == m_pViewSelection)
{
dr = m_cacheDocumentRangeOfSelection;
}
else
{
// TODO if we ever support multiple view types, we'll have to
// TODO change this.
FV_View * pFVView = static_cast<FV_View *>(m_pViewSelection);
pFVView->getDocumentRangeOfCurrentSelection(&dr);
}
m_selectionByteBuf.truncate(0);
for (j=0; (formatList[j]); j++)
{
if ( AP_UnixClipboard::isRichTextTag(formatList[j]) )
{
IE_Exp_RTF * pExpRtf = new IE_Exp_RTF(dr.m_pDoc);
if (!pExpRtf)
return false; // give up on memory errors
pExpRtf->copyToBuffer(&dr,&m_selectionByteBuf);
DELETEP(pExpRtf);
goto ReturnThisBuffer;
}
if ( AP_UnixClipboard::isHTMLTag(formatList[j]) )
{
IE_Exp_HTML * pExpHTML = new IE_Exp_HTML(dr.m_pDoc);
if (!pExpHTML)
return false;
pExpHTML->set_HTML4 (!strcmp (formatList[j], "text/html"));
pExpHTML->copyToBuffer(&dr,&m_selectionByteBuf);
DELETEP(pExpHTML);
goto ReturnThisBuffer;
}
if ( AP_UnixClipboard::isImageTag(formatList[j]) )
{
// TODO: we have to make a good way to tell if the current selection is just an image
FV_View * pView = NULL;
if(getLastFocussedFrame())
pView = static_cast<FV_View*>(getLastFocussedFrame()->getCurrentView());
if (pView && !pView->isSelectionEmpty())
{
// don't own, don't g_free
const UT_ByteBuf * png = 0;
pView->saveSelectedImage (&png);
if (png && png->getLength() > 0)
{
m_selectionByteBuf.ins (0, png->getPointer (0), png->getLength ());
goto ReturnThisBuffer;
}
}
}
if ( AP_UnixClipboard::isTextTag(formatList[j]) )
{
IE_Exp_Text * pExpText = new IE_Exp_Text(dr.m_pDoc, "UTF-8");
if (!pExpText)
return false;
pExpText->copyToBuffer(&dr,&m_selectionByteBuf);
DELETEP(pExpText);
goto ReturnThisBuffer;
}
// TODO add other formats as necessary
}
//.........这里部分代码省略.........