当前位置: 首页>>代码示例>>C++>>正文


C++ FL_DocLayout::findBlockAtPosition方法代码示例

本文整理汇总了C++中FL_DocLayout::findBlockAtPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ FL_DocLayout::findBlockAtPosition方法的具体用法?C++ FL_DocLayout::findBlockAtPosition怎么用?C++ FL_DocLayout::findBlockAtPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FL_DocLayout的用法示例。


在下文中一共展示了FL_DocLayout::findBlockAtPosition方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateValue

bool fp_FieldTOCNumRun::calculateValue(void)
{
	UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
//
// First Find page number.
//
	PL_StruxDocHandle sdh = getBlock()->getStruxDocHandle();
	PD_Document * pDoc = getBlock()->getDocument();
	PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
	FL_DocLayout * pLayout = getBlock()->getDocLayout();
	fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
	if(pBlockInDoc == NULL)
	{
		sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
		sz_ucs_FieldValue[1] = 0;
		return _setValue(sz_ucs_FieldValue);
	}
	fp_Line * pLine =  static_cast<fp_Line *>(pBlockInDoc->getFirstContainer());
	if(pLine == NULL)
	{
		sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
		sz_ucs_FieldValue[1] = 0;
		return _setValue(sz_ucs_FieldValue);
	}
	fp_Page * pPage = pLine->getPage();
	UT_sint32 iPage = pLayout->findPage(pPage);
	if( iPage < 0)
	{
		sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
		sz_ucs_FieldValue[1] = 0;
		return _setValue(sz_ucs_FieldValue);
	}
	iPage++; // Start from Page 1.
	UT_String sVal("");
	FootnoteType iType = getBlock()->getTOCNumType();
	pLayout->getStringFromFootnoteVal(sVal,iPage,iType);
	const char * psz = sVal.c_str();
	bool bStop = false;
	UT_sint32 i = 0;
	sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
	for(i=1; (i<FPFIELD_MAX_LENGTH) && !bStop; i++)
	{
		sz_ucs_FieldValue[i] = static_cast<UT_UCSChar>(*psz);
		if(*psz == 0)
		{
			bStop = true;
		}
		else
		{
			psz++;
		}
	}
	return _setValue(sz_ucs_FieldValue);
}
开发者ID:Distrotech,项目名称:abiword,代码行数:54,代码来源:fp_FieldTOCNum.cpp

示例2: _createPreviewFromGC

void AP_Dialog_Paragraph::_createPreviewFromGC(GR_Graphics * gc,
											   UT_uint32 width,
											   UT_uint32 height)
{
	UT_return_if_fail (gc);

	// g_free any attached preview
	DELETEP(m_paragraphPreview);

	// platform's runModal should have set this
	UT_return_if_fail (m_pFrame);

	AV_View * baseview = m_pFrame->getCurrentView();
	UT_return_if_fail (baseview);

	FV_View * view = static_cast<FV_View *> (baseview);

	FL_DocLayout * dl = view->getLayout();
	UT_return_if_fail (dl);

	fl_BlockLayout * bl = dl->findBlockAtPosition((PT_DocPosition) view->getPoint());
	UT_return_if_fail (bl);

	UT_GrowBuf gb;
	bool hadMem = bl->getBlockBuf(&gb);

	UT_UCSChar * tmp = NULL;
	if (hadMem && gb.getLength() > 0)
	{
		gb.truncate(NUM_CHARS_FOR_SAMPLE);
		UT_UCS4_cloneString(&tmp, (UT_UCSChar *) gb.getPointer(0));
	}
	else
	{
		const XAP_StringSet * pSS = m_pApp->getStringSet();

		// if the paragraph was empty, use our sample
		UT_UCS4_cloneString_char(&tmp, pSS->getValue(AP_STRING_ID_DLG_Para_PreviewSampleFallback));
	}

	m_paragraphPreview = new AP_Preview_Paragraph(gc, tmp, this);

	FREEP(tmp);

	UT_return_if_fail (m_paragraphPreview);

	m_paragraphPreview->setWindowSize(width, height);

	// TODO : any setup of the GC for drawing

}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:51,代码来源:ap_Dialog_Paragraph.cpp

示例3: calculateValue

bool fp_FieldListLabelRun::calculateValue(void)
{
	UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
	UT_uint32 i = 0;
	UT_UCSChar *  listlabel = NULL;
	if(getBlock()->isContainedByTOC())
	{
		xxx_UT_DEBUGMSG(("!!!!!!------!!!! ListLabel in TOC!!!! \n"));
//
// First Find the block in the document.
//
		pf_Frag_Strux* sdh = getBlock()->getStruxDocHandle();
		PD_Document * pDoc = getBlock()->getDocument();
		PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
		FL_DocLayout * pLayout = getBlock()->getDocLayout();
		fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
		if(pBlockInDoc == NULL)
		{
			sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
			sz_ucs_FieldValue[1] = 0;
			return _setValue(sz_ucs_FieldValue);
		}
		i = 0;
		listlabel = pBlockInDoc->getListLabel();

	}
	else
	{
		i = 0;
		listlabel = getBlock()->getListLabel();
	}
	if(listlabel == NULL)
	{
		sz_ucs_FieldValue[0] = 0;
	}
	else
	{
		//
		// This code is here because UT_UCS_copy_char is broken
		//
		i = 0;
		UT_uint32 len = UT_MIN( UT_UCS4_strlen(listlabel),FPFIELD_MAX_LENGTH + 1)  ;
		for(i=0; i<=len;i++)
		{
			sz_ucs_FieldValue[i] =  *listlabel++;
		}
//		sz_ucs_FieldValue[len] = 0;
//		m_sFieldValue[0] =  0; // Force an update!!!
	}
	return _setValue(sz_ucs_FieldValue);
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:51,代码来源:fp_FieldListLabelRun.cpp

示例4: calculateValue

bool fp_FieldTOCNumRun::calculateValue(void)
{
    UT_UCSChar sz_ucs_FieldValue[FPFIELD_MAX_LENGTH + 1];
//
// First Find page number.
//
    pf_Frag_Strux* sdh = getBlock()->getStruxDocHandle();
    PD_Document * pDoc = getBlock()->getDocument();
    PT_DocPosition pos = pDoc->getStruxPosition(sdh)+1;
    FL_DocLayout * pLayout = getBlock()->getDocLayout();
    fl_BlockLayout * pBlockInDoc = pLayout->findBlockAtPosition(pos);
    if(pBlockInDoc == NULL)
    {
        sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
        sz_ucs_FieldValue[1] = 0;
        return _setValue(sz_ucs_FieldValue);
    }
    fp_Line * pLine =  static_cast<fp_Line *>(pBlockInDoc->getFirstContainer());
    UT_sint32 kk = 0;
    bool b_goodLine = false;
    while (pLine && !b_goodLine)
    {
        for (kk = 0; kk < pLine->getNumRunsInLine(); kk++)
        {
            if(pLine->getRunFromIndex(kk)->getType() == FPRUN_TEXT)
            {
                b_goodLine = true;
                break;
            }
        }
        if (!b_goodLine)
        {
            pLine = static_cast<fp_Line *>(pLine->getNext());
        }
    }
    if(pLine == NULL)
    {
        sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
        sz_ucs_FieldValue[1] = 0;
        return _setValue(sz_ucs_FieldValue);
    }

    fp_Page * pPage = pLine->getPage();
    UT_sint32 iPage = pPage->getFieldPageNumber();
    bool b_hasSetFieldPageNumber = false;
    if(iPage < 0)
    {
        pPage->resetFieldPageNumber();
        iPage = pPage->getFieldPageNumber();
        b_hasSetFieldPageNumber = true;
        if (iPage < 0)
        {
            sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
            sz_ucs_FieldValue[1] = 0;
            return _setValue(sz_ucs_FieldValue);
        }
    }
    UT_String sVal("");
    FootnoteType iType = getBlock()->getTOCNumType();
    pLayout->getStringFromFootnoteVal(sVal,iPage,iType);
    const char * psz = sVal.c_str();

    if (b_hasSetFieldPageNumber)
    {
        // We need to set the field page number value to -1 so that we
        // recalculate the page number next time we enter this function
        pPage->setFieldPageNumber(-1);
    }
    bool bStop = false;
    UT_sint32 i = 0;
    sz_ucs_FieldValue[0] = static_cast<UT_UCSChar>(' ');
    for(i=1; (i<FPFIELD_MAX_LENGTH) && !bStop; i++)
    {
        sz_ucs_FieldValue[i] = static_cast<UT_UCSChar>(*psz);
        if(*psz == 0)
        {
            bStop = true;
        }
        else
        {
            psz++;
        }
    }
    return _setValue(sz_ucs_FieldValue);
}
开发者ID:tanya-guza,项目名称:abiword,代码行数:85,代码来源:fp_FieldTOCNum.cpp


注:本文中的FL_DocLayout::findBlockAtPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。